Code as if the next guy to maintain your code is a homicidal maniac who knows where you live.

One of my all time favorite quotes comes from Kathy Sierra and Bert Bates.  “Code as if the next guy to maintain your code is a homicidal maniac who knows where you live.” I have brought it up several times before, but every once in a while, while maintaining legacy code, you come across a gem that really hits home.  The following was sent to me by a former colleague:

19 try {
20 PersistenceManagerFactory persistenceManagerFactory =
JDOUtil.getPersistenceManagerFactory(new TestDatabaseInfo());
21 PersistenceManager pm = persistenceManagerFactory.getPersistenceManager();
22
23 FileSizeDpiCalculator.calculateFileSizeDpi(pm);
24 } catch (Throwable t) {
25 LogUtil.error(this, “I hate it when this happens: “, t);
26 System.exit(-1);
27 }

Really?  “I hate it when this happens?” THAT is the error code I am gong to see in the logs in the event of a thrown exception?  Don’t get me wrong, I see the humor in it.  Hey, I hate it when it happens too.  It was probably funny to see that little Easter Egg pop up in the logs when you were developing the code.  However, maybe you could try and make it a little less aggravating for those of us who come after you. ;)

The author of that code should be thankful that my colleague isn’t one of the before referenced homicidal maniacs…

Comments

Returning visitor? Please login or register.

Be the first to comment!

Leave A Comment

Please help us stop spam by answering the question below: