soft coding

I enjoy Worse Than Failure for the quick laughs some days. But you can’t have a site that shows bad practices in IT, without thinking about what the good alternatives are.

Yesterday they had a thought provoking discursive article on Soft Coding, which looks at the tension between hard coding values in a program versus getting them from some kind of configuration system. The suggestion is that a sufficiently involved ‘configuration system’ turns into a kind of programming language of its own, and often not a very good one.

This seemed a familiar idea to me. I’ve worked on a number of systems in the past which ended up groaning under the weight of XML configuration files, XSLT, database ‘metadata’ and similar ideas. There’s always a promise with these systems that by removing the ‘technical’ aspects of programming you can enable the ‘business’ people to make changes themselves, so reducing their reliance on IT people. But in practice, in each of the examples I worked on, the required changes always ended up being done by the developers, even when they didn’t need changes to the ‘program code’ as such.

This could be a suggestion that there is more to being a software developer than just knowing the syntax of a programming language. Maybe I’ll come back to that another time.

Back to my example. We basically have a situation where developers are making changes to a system by editing some large XML files and some database data. XML was not designed to be a programming language, and while there are tools around to help use it, they aren’t the tools that help with programming. If you have programmers making the changes, you may as well have them do it in a real programming language that can express algorithms much more clearly and have tools to help the programmer – this will probably make the program logic easier and quicker to change.

I’m not suggesting that you scatter hard coded values throughout the program code: you still have to think about good design. But dropping values out of code into a ‘configuration file’ is something that should be done after a consideration of the costs and benefits, not automatically out of a fear of future change.