Friday, May 04, 2007

High Tech and the Monkeys

You may have heard the story of the monkeys and the cold water.

http://www.mountainhome.af.mil/news/story.asp?id=123027878

http://www.eve-tribune.com/index.php?no=1_26&page=4

I'm sure this happens in all industries, and it can happen a lot in high tech. What happens is that at some point there is some limitation, restriction, bug, inexperience, or lack of knowledge about some technology. So we start doing things in a certain non-optimal way to work around the bug or because we didn't know the correct way at the time. The incorrect way becomes the standard and we continue doing things that way far into the future, long after the original constraint has disappeared.

The thing with software is that we are often using leading edge technology. Often the new technology can contain bugs or limitations that requires workarounds that are kludgy, ugly or verbose. In later releases the problems from the earlier releases are fixed so the workarounds are no longer required. However the workarounds become standardized so we don't update the old code and continue to write new code to the old ways.

Also because of schedules we don't always have time to fully explore the libraries we work with. So if a new version of something comes out that makes it easier to accomplish some task, the programmers might not even know about it because they didn't explore all the new features and fixes in the new release. They just use the old code with the new libraries.

So you might come across stuff like this as generic examples.

Q: Why do we use all this verbose formatting instead of printf?
A: printf wasn't around until Java 1.5. This code was written before that so we did it that way.

Q: Why is the security stuff with JSP, EJB and roles so strange?
A: Well, _blank_ who doesn't work here anymore, set it up this way originally years ago. Plus there was a requirement at the time which was later dropped for a special 'guest user' mode that we had to accomodate. It just became the standard and was never revisited once it was working.

Q: Why is there so much awkwardness around setting and getting DATE fields with the database.
A: Originally five years ago there was a bug in the Oracle JDBC driver so we had to do these ugly workarounds with dates and UTC.
Q: But that JDBC driver bug was fixed years ago.
A: Yes well we didn't realize it was fixed and once we got it working after much pain it just became the standard way.


When new people join an established team with an older (like 2+ years) code base then the new person will often have a fresh untainted perspective and can point out some stuff that the existing developers were doing wrong or non-optimally. Sometimes the original developers will not be aware of all the newest library features, or will be operating under old constraints that no longer exist.

If you join a new team and are working with new technology and the existing code base is several years old, you may see stuff that might not make a lot of sense. There's a good reason it's there because of the monkeys.