How a Little Duck Typing Could Have Saved the World
The term duck typing will be familiar to most developers. It means that if you're developing a game about farming and into the barn enters a new animal that you know nothing about, but it quacks like a duck and it walks like a duck. In that case for all intents and purposes it is safe to treat it as if it is a duck. It doesn't actually matter if it is a duck, as long as it quacks the game won't break, but if you ask it to bark, unless you're dealing with a new species that can both bark and quack, the game is likely to break.
Applying this to the world outside programming, if I said that there is something that acts like a psychopath, bullies the handicapped, talks like a homophobe, a xenophobe, a racist, a sexist and a misogynist. Would it not be prudent in this case to assume until proven otherwise that it is all these things? At the very least treat it as if it is.
A Big Ball of Mud
Another concept that many developers will know of is the big ball of mud. That is legacy code that has been built and added on without refactoring it to be more understandable, thus making the developer's job more difficult. Each little piece he adds makes it more difficult to understand how that ball of mud works. Often it is untested as well which makes it very difficult to predict its behavior, especially when needing to make a small change.
What needs to be done to that ball of mud is to refactor it. There can not be some creature that depending on conditions either quacks, barks or grunts. This will make the code brittle and bug ridden and if left as is for long enough, needs to be rewritten completely because it is no longer possible to understand.
Therefore something that talks like a racist, sexist and misogynist shouldn't exist. It will only bog down development and if not fixed in time will require a complete reboot of the project. Note that adding compassion, grace and other good qualities will not improve the code at this point, neither much the behavior as it continues to be unpredictable. It will only make it more difficult to maintain. The legacy needs to be fixed first before things can be added, usually not without removing other things or you may get what developers call feature bloat.
60 Million
60 million people, give or take, cast a vote for a big ball of mud yesterday. The main reason seems to have been that the alternative was too much legacy. The problem as I see it is that they disregard the fact that much of that legacy has been and continues to be tested and has proven to work, if not perfectly, with an acceptable amount of defects. Sometimes it needs a bigger rewrite to keep up with current events but generally it's okay, something to be proud of.
60 million people have just spent a lot of time building an untested ball of mud of gigantic proportions. Together we can fix it, but it will require the efforts of everyone. There are already many more than 60 million who take pride in creating something that is not a big ball of mud. Something that with all its defects is elegant, functional and user friendly although sometimes a bit bloated with features.
But that means getting rid of the mud.
No comments:
Post a Comment