Thursday, September 17, 2009

Never put things above a user specified path

If you tell a program to use a path to store something you normally expect that the program puts its data inside that path and not into the parent. Sounds simple, but in the last 24 hours I ran two times into violations of this basic principle.


1. For the next release of our Wind River Workbench product we will use p2. We have thought our customers to use the -configuration option to redirect the place where eclipse puts its "stuff" if they use a shared installation. If they have different installations or different versions installed, that worked nicely (before p2): for version 3.0 they would use -configuration /someplace/wrwb3.0 and for version 3.1 they would use -configuration /someplace/wrwb3.1. Unfortunately since version 3.4 eclipse violates the principle "never put things above a user specified path" (bug 230384) and puts things like artifacts.xml and the p2 directory above the directory specified. If customers mix different versions of our product the old way, then they get a mess because two configurations that are supposed to live side by side suddenly share the potentially incompatible information in the parent. We are thinking to change the behavior of -configuration to add implicitly one more directory (to turn a user specified -configuration /someplace/wrwb3.0 into -configuration /someplace/wrwb3.0/configuration) so that the two configurations -configuration /someplace/wrwb3.0 and -configuration /someplace/wrwb3.1 do not infer with each other.


2. I am really excited about Xtext! Yesterday I created a new Xtext language project (let's call it gr.scharf.mylanguage). The wizard suggests to call my language gr.scharf.MyLanguage. Sounds good, but it puts its files into the package gr.scharf which is not such a good idea, because it pollutes the parent name space (see bug 289780) and therefore violates the principle "never put things above a user specified path".

Conclusion: if the user gives you a path put things underneath the path and do not touch the parent!

...think twice to make sure not to violate this simple principle....