.NET Zone is brought to you in partnership with:

Ayende Rahien is working for Hibernating Rhinos LTD, a Israeli based company producing developer productivity tools for OLTP applications such as NHibernate Profiler (nhprof.com), Linq to SQL Profiler(l2sprof.com), Entity Framework Profiler (efprof.com) and more. Ayende is a DZone MVB and is not an employee of DZone and has posted 462 posts at DZone. You can read more from them at their website. View Full User Profile

On Professional Code

09.11.2012
| 8503 views |
  • submit to reddit

Trystan made a useful comment on my post about unprofessional code:

I think it's interesting that your definition of "professional" is not about solid code, infrastructure, or any other technical issues. "Professional" means that you, or the support staff, can easily see what the system is doing in production and why.


Pretty accurate. More to the point, a professional system is one that is easy to support in production. One of the most unprofessional things you can say is, “I have no idea what's going on.”

We've been paying a lot of attention recently to production readiness. We can’t afford not to. Building the software is often not enough. In many cases, if a problem arises, we can’t just debug through the process. Either because reproducing the problem is too hard, or because it happens on a client-side with their own private data. Even more importantly, if we can give the ops team the tools to see what is going on within the system, we drastically reduce the number of support calls we have to take.

Software that actively supports the ops team gets into the actual data center a lot faster and more easily than software that doesn’t. Sure, clean code is important, but production-ready code is often not clean code. I read this a long time ago, and it stuck:

Back to that two page function. Yes, I know, it's just a simple function to display a window, but it has grown little hairs and stuff on it and nobody knows why. Well, I'll tell you why: those are bug fixes. One of them fixes that bug that Nancy had when she tried to install the thing on a computer that didn't have Internet Explorer. Another one fixes that bug that occurs in low memory conditions. Another one fixes that bug that occurred when the file is on a floppy disk and the user yanks out the disk in the middle. That LoadLibrary call is ugly but it makes the code work on old versions of Windows 95.

Each of these bugs took weeks of real-world usage before they were found. The programmer might have spent a couple of days reproducing the bug in the lab and fixing it. If it's like a lot of bugs, the fix might be one line of code, or it might even be a couple of characters, but a lot of work and time went into those two characters.


Some parts of the RavenDB code are ugly. HttpServer class, for example, goes on for over thousands lines of mostly error detection and recovery modes. But it works, and it allows us to inspect it on a running production server. That's important, and it's the difference between good code and production-worthy code.

Published at DZone with permission of Ayende Rahien, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)