Code Comments

Comments like the ones in the link are useful and necessary.  Sometimes it’s for the stress relief of the developer and sometimes it’s just a way to document the strange oddities that come out of some developers.

I’ve been known to put comments in code (generally in OPC projects and unfortunately one or two of my own projects) to the effect of, “I have no friggin’ clue why this was done this way.  If you change this value really, really bad things happen when trying to do ‘x’.”  For one client I had dozens of comments that said, “Because AM told me to do it this way, “ and it would be preceded by commented out code where they had me do the exact opposite thing.  Such is the life of a developer.

Now, on to the comments about why the PSD format is horrible and how it ever got that bad.  I suspect that in the beginning it wasn’t so bad.  It was probably written by one or two developers working very closely together.  Then another developer was hired to do a new feature who was either incompetent or too lazy to figure out the way it was done before.  Then another developer was hired to either fix bugs or add yet another new feature and was either lazy, incompetent, or under the gun to get it out and re-used code from the earlier implementations that was one of the three ways of doing it.  And then another and another did the same thing.

Finally you get a big, ugly, incomprehensible, complex thing that no one can figure out unless you life with the code day in and day out.  I have no doubt that the Photoshop developers can look back and be embarrassed about such complexity.  But I understand how it goes.  You start with something fairly simple and you keep bolting pieces on to it and you try to keep it as simple but it just keep growing.  It’s like a virus that goes unchecked.

The worst thing though, is that eventually, its complexity gives  the parent company a barrier of entry from copycats.  In this case, anyone wanting to work with PhotoShop documents has to figure it out.  Likewise I suspect that MS Office suffers from some of the same issues.

One could argue that these companies want the complexity so they can keep stranglehold on their market.  That might be the reason why these things are never cleaned up.  Engineers and developers cringe when they hear this but sometimes it’s true.  From a business standpoint it works, so why fix it?

Anyway, I spent way more time talking about code comments than I expected.  Thoughts?