Friday, August 21, 2009

Maybe I was Wrong

Curses of James Gosling’s name were common utterances from my mouth back when I was in school and was forced to use Java. No pointers? No private inheritance? No passing by reference? I detected the evolution of programming was watering it down for the lowest common denominator, and it made me livid.

My attitude was, and to a certain extent, still is, leave the dangerous language features in and if people are stupid enough to use them that is their problem. Most everybody agrees that multiple inheritance can lead to some major problems; however, it is immature to assume that it is always bad just because you have yet to find a good use for it. A do-while loop appears to be a useless feature at first sight, but once a programmer encounters a situation where he always needs to do something at least once his tune may change. Thinking in terms of absolutes is dogmatic and ineffectual. My ego is not small, however, even I am not arrogant enough to think that I have iterated through every possible situation to be encountered when creating an application. I am very much against passing by reference; however, when a developer needs to switch object references inside a function and cannot; it is frustrating to say the least.

I always welcome new features to a language that have the potential to make my life easier. I welcomed the implicit typing feature (var) to C# 3 because I assumed that developers would know not to use it as shorthand (as opposed for runtime created objects) in production code; I assumed wrongly. It was easy to sit back and criticize Gosling when I was sitting alone in my basement writing code for my own amusement; however, cursing him is becoming more difficult with each passing day.

A Change of Heart?

As I have left school and started working I have learned one very important lesson; if a language feature exists, programmers will use it. This is because it is always easier to use a feature to work around a mistake than to reengineer the entire program. It is not hard imagine some programmer 15 years back forgetting to implement a feature in a base object and then using multiple inheritance as a workaround; next the other members of his team inheriting from his work are greeted with diamonds. Additionally, most programmers are big on conventions. This sometimes means a programmer will knowingly repeat a mistake, or reuse a language feature that was only appropriate in a particular instance. The sometimes irrational tendency of programmers to stick to conventions at all costs can exacerbate use of bad language feature; even spreading it across a team like a retrovirus.

My frustration at the removal of “dangerous” language features has not subsided; however, I now understand why it has been done. My realization of some of the more ineffectual habits that programmers can exhibit has perhaps changed my mind on the validity of removing features, but it does not make me like it any more.

No comments:

Post a Comment