Message to all hard-coding coders out there...

14. December 2007

For the love of everything Microsoft if you’re a programmer and you get the crazy idea in your head that you want to specify the full directory path to a database connection , or any file for that matter in code, stop, move away from the computer, and hit your face into the wall. If you’re hitting your face into the padded cube wall then you walk yourself out into the hall and you give yourself a second whack into the concrete wall.

 

If you’re in a situation where you need a file path put the code into the App.Config file and reference it from AppSettings.Get(“DatabaseConnectionPath”) or something useful. I’ve been working on a project where text files were hard coded, changing the application’s icon was hard coded to the previous developers My Documents folder. I’ve even run into a situation where database table names were using the linked data table’s name instead of the actual tables name on the deployed server.

 

Sir, if you ever read this you owe me five smacks of your face into the wall. That or you need to read on patterns and practices because your code looks like something I did five years ago.

Business, Programming , ,