Be loyal to your codebase.

I’ve been pair-programming with a good developer in the past few weeks and we were talking about the philosophy behind “good development”. Bob Martin teaches us about professionalism and TDD, but in real life – most developers… nay, almost zero developers actually do what we know we should do. For me though, I’ve turned a corner. I’ve decided to be a bit more militant about it – and I’ve decided to be loyal to my codebase. What does that mean?

Well, in any profession, there is “what the customer sees” and “how things are done behind the scenes”. In the case of software, there is “the user interface” with which the customer uses and “the codebase”, which is the source code behind it. Pretty much every developer will do ANYTHING for the UI, while we only do the very, very bare minimum for the codebase; we are not loyal or respectful of the codebase.

To further explain this, let’s look at some other industries.

Food Presentation versus Food Prep:
How would you feel if you went to a restaurant and saw food like this:


and went back and saw a kitchen like this?


Grocery Store:
What about at a grocery story? What if you saw shelves like this:


but a stock room, in the back like this:


Why Care? Because: professionalism.
So – why don’t we see this often? For the most part, there is a balance between the presentation of a product/service and the organization/cleanliness of the preparation.

Keeping things organized is what most people consider to be professional behavior.

You keep your workspace tidy, you put care into organizing your products and tools so that you can readily and repeatably serve your customers.

Not only is it more desirable for everyone involved, it’s also a sustainable technique. So, for most professions, we see good food presentation and clean kitchens. We see beautiful store shelves and fairly-organized stock rooms. But then there is computer software…

Enter modern-day programming:
If you are a business developer (or have been on in the past 20 years), you know that just about all code out there looks like the imbalance, above.

As a rule, the UI for the app is functional and sometimes pretty, and the code is a train wreck.

I think most every developer would agree that this is not an anomaly, that is the rule in almost all cases.

We, as software professionals, spend all of our time on the UI and bending to the will of the business at the expense of the quality of the codebase. We forsake the code quality to squeeze out an extra feature. This, in my professional opinion is wrong – very, very, very wrong. I, for one, am not going to do it anymore.

What should we be doing?
In my opinion, we should be giving equal time to the code. That means things like:

  • Having unit tests and high code coverage
  • Having a consistent mechanism for injecting your dependencies – via OO, mocking framework, interfaces, delegates, etc…
  • Make sure you have conventional and intention-revealing class and class-member names.
  • Doing argument validation on EVERY method
  • Adding XML code comments to every public class and public member, remembering to “publish” which exceptions can be thrown, in the XML code comments with an <exception cref=””/> tag (PRO TIP: ReSharper can do this for you!)
  • Wrapping or bubbling appropriate, expected exceptions – and publishing those exceptions in the XML code comments too

Your reaction might be “Sheesh, that’s kind of a lot of work.” I agree, if you haven’t been doing this all along, you are talking about a day or two of “extra” work. Is it really “extra” though?

What’s funny about this is that if you ever have a conversation with your business area and ask them what they think the code looks like – they assume that is is very secure, very stable, very pliable and easy-to-change. Now, what if you told them: “I don’t validate a single argument. If anyone ever passes in a null, you will see an unhandled NullReferenceException and the app is going to crash” – how do you think they would take it? My point is, the business already assumes we are writing professional-grade software!!

Your business areas (9 times out of 10) are already assuming you are doing ALL of this stuff. They are assuming that when you gave your estimate, it included writing high-quality, professional-grade software.

This is similar to me hiring a general contractor. I am assuming he knows what he is doing and is going to build a professional-grade product, adherent to all the known best-practices. Imagine my shock and horror if he said he only ever does the bare minimum to barely make a building stand up!!

I’m expecting this:


But I’m really getting this!


So, the answer – just like the problem, can be found in other industries. Generally-speaking, it’s always easier to do things as part of a habit, as you go about your work. The classic example is the sushi chef or the Japanese steakhouse chef: ever notice how there don’t have to do any cleaning when they are done? This is because they’ve been cleaning all along!


Similarly, next time you go into a Subway sandwich shop – notice how they clean up food scraps/crumbs before and after preparing each sandwich? Imagine if they didn’t? They’d be looking at hours of “extra” work at the end of the day. Note that if it’s not part of the work, it becomes “extra” work!


Similarly, I’m proposing doing the same thing. Don’t “clean up the code” as a part of the project. Instead, stop saying “I’ll clean that up in a minute” and clean it up now. Take the time to do it right. As the saying goes, if you don’t have time to do it now – you definitely aren’t going to have time to do it later, when you are even more crunched for time.

Make the time, now.

Going forward…
So what does this mean? What is this rant all about?

For me, it’s me putting my thoughts into words, and setting an accountability goal for myself – and for you, it’s a call to action.

From now on, when I write code, I will REFUSE to put code in production that doesn’t have these minimal attributes. There is no reason… nay, no justification I can find for releasing non-professional code. I’m paid to be a professional developer and I think I’ve come to a point where I am going to hold myself to a higher standard and I’m going to encourage all my programmer brethren and sistren to do the same.

So please, if you put an hour into the working code, put up to an hour into refactoring, writing unit tests, getting the names right, argument validation, exception handling, XML code comments. If you agree or disagree, please let me know in the comments!

Posted in Organization will set you free, Professional Development, Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.


Enter your email address to follow this blog and receive notifications of new posts by email.

Join 9 other followers

%d bloggers like this: