Tuesday, March 5, 2013

The right code is the code that works right

"The right code is the code that works right."

Pretty much that's how I see code.  All code.

If you're on my team and you come to me and start explaining how you coded this or that assignment, I'll listen politely for a very short time and then I'll want to know if it works.  For the user.

If your code doesn't work for the user, I am not interested in how you did it.  That might sound harsh to some but, for me, the purpose of all code is to produce something.  If it doesn't produce, then in my head I am thinking "why are we having this conversation 'cause it ain't about the solution?"

"Geez, Russ, playing Mr. Nice today I see.  What's your point here?"

Well, let's say you come to me and say right up front that your code works great for the user but then you proceed to tell me you reproduced @DbLookup() functionality using Java even though you could have just used @DbLookup().  Well, now we could have another problem.  I'm gonna' want to know why you did that.  If you tell me it is solely because you believe it will perform better for the user by x milliseconds, we now have a confirmed problem.

"Uh Russ?  You saying you want everyone to use @DbColumn()?  I'm not following..."

Many times over the last 18 months I have found myself writing code adhering to the standard mother's warning: "Wear clean underwear in case you're in an accident and have to go to the hospital." (There are variations I'm sure and perhaps only American mothers say/said this to their kids...but I digress...)

The point is, I found myself writing my code so that if someone else saw it they wouldn't think I was a complete idiot.  I'll take it a step further - I actually wanted them to see how smart I was.  Bad idea.  (Uh, not because I'm not smart, uh, I mean, well, I'm no genius but, uh...once again...digression.)  Bad idea because it can lead to faulty thinking about architectural design decisions.

"Is this guy ever going to make a point? Maybe there's something at planetlotus...squirrel!"

Here it is: Do not let the wizards of our industry convince you that you have to write code a certain way.

Specifically I am referring to Tim Tripcony and Declan Lynch's latest efforts to shepherd XPagers into Java.  Let me me 100% clear: I fully support what they are doing.  They are very intelligent guys, they know of which they speak, their intentions are good and I applaud their significant efforts to help others.  As a matter of fact...you want some good Java knowledge?  Well you should!  Go check out their Java blog posts.  Now.  Hurry!  Go!  Click! (Not here silly...the links are above.)

I am, however, also 100% in support of those XPagers in the trenches trying to deliver solutions in an increasingly competitive environment who may feel that they need to write "artful" code because someone they respect said they really should be coding this way and not that way.

Certainly more knowledge is better but there is a lot more to developing than knowing more code.

Make solutions that work and don't get too caught up in the "art"of programming.  Your users don't care as long as it works well for them.  Your manager might not mind so much either.

Your fellow XPagers?  Yeah, well, we get it because we've all been there.

Tomorrow I'll share a situation where I put my advice to use.