Programming Tip #9 - Do not hard code file/tool configuration references
Most of the time the production environment is not the same as development environment or for that matter similar to your desktop. It is natural when developers work on the desktop, to code to the programs and other tools/technologies that is locally deployed. It is easy to get carried away to do a local test, the references are hard coded. For example the database connection configurations or loading a property file with an absolute path. The first mistake would be to not notice it during the code review. The next stage of mistake is to check in that code in the version control system. And if not scrutinized this code would go all the way to various environments. And if it’s not trivial enough to show up as an error on the screen in the environments it may go all the way up to production environment.
Most of the time the issue shows up when the platforms are totally different. The Windows vs. UNIX environment differences can make the deployment difficult based upon how much of relative coding is done. Added to that is the forward vs. backward slash difference in folder representation, which is not a significant threat if the UNIX standard is followed early on. All said the point is that all these pain points can be avoided if developers can handle the file/tool configuration references relative to the application and separated in a configuration file (properties or xml files).









