Like beauty, quality is often in the eye of the beholder, and because perspective and values matter in how code is judged, it can be hard to nail down a proper definition for code quality with which everyone would agree.

For example, often a client will list code being “optimized” as a requirement. Sounds good, but what does that really mean? What should it mean?

For many, “optimized” means “speed.” The code must be fast and performant. But that is not the only interpretation. In other situations, optimized code means that the code must be easily maintained or portable to other platforms. In fact there are as many ways to interpret this word as there are dimensions to measure the quality of code. It all comes down to what is valued by those who will ultimately own the result.

This means that in many instances, the communications that describe the goal of any project are often more important than the technology ultimately chosen to implement it. This is especially true in the .NET development world because assumptions can affect where a project begins and what compromises are needed to get it done well enough to be accepted, or fast enough to hit a deliverable.

Code developed with any language on any framework against any platform requires this clear communication to have a chance to meet expectations, and there are other factors at work as well. So you have to ask yourself, what matters to you? What does optimized mean for your project? Think about that while we will cover the things that most agree lead to or define low-quality code.

The foundation matters
When setting out to construct anything, the foundation matters. Marketing, building construction and even literature succeed most when the opening or foundation is of high quality. Quality code has an even greater dependence in this regard since, in most cases, you are not writing machine language. We all depend on many abstraction layers, for better or worse, to do everything.

As far as foundations go, the .NET Framework is a good pick these days. It is mature and roundly tested for all manner of purposes. It is hard to imagine a use (suitable to a framework) that it has not addressed over the last decade.

This argument for well-worn code being higher in quality is something the component vendors emphasize as well, and it makes sense. There is a reason that adoption follows a curve where early adopters are followed at a distance by the masses.#!At the BUILD conference in early April, Microsoft committed to open-source many libraries, including much of .NET itself. Never before have .NET developers had this much access to the guts of the platform, and there is hope that this act will increase the quality, security and stability of the .NET platform in the long run. But for now, .NET developers have to rely on the current quality of the platform. In most cases, this is a good dependency: .NET is well proven and has improved over several major iterations when we focus on the Base Class Libraries.