Thursday, 29 September 2011
[Programming Language] is great because non technical people can understand it
(follow up to the VBScript from hell)
It was a popular marketing motto for pushing new programming languages a while ago. "BASIC/COBOL/xxxx is great because I (or my boss) can understand it".
And you are probably be able to understand it because it is full of global variables, pieces of code that repeat over and over, simple operations that can be resolved with library calls reinvented again because nobody bothered to read the documentation, and who cares if this piece of data is a string, a number or some string representation of a number that eventually, and if you use the proper internationalization settings, will be understood as a number when the time comes. It works, right?
To which I say: if you think that pieces of code that are weakly typed, not structured and redundant, that don't provide a self contained solution to the problem in a encapsulated or reusable way and have substandard performance is great, you deserve to maintain it. Or better yet, your boss or manager or whoever loves this kind of programming style should be cursed with the work of changing it.
Me, I prefer structured, encapsulated, strongly typed (or as close as possible) and using existing facilities in as much as possible. The worst part is that transforming one of these legacy beasts into something manageable leads you to the edge of the refactor/rewrite decision. But likely you don't have tests to ensure that your rewrite is correct, so the first thing to do is to create tests, which leads you to the point of becoming familiar enough with the old code to look at refactoring as a much safer option.
Remember, just because we understand how, or even why, a plane flies does not qualify us as pilots.
Perhaps there is hope, I've not heard that sentence in the last two or three years. Well, maybe is because I tend to avoid programming language discussions.