Is it a Good Design?

May 5, 2010 · 2 comments

When I show students in my classes a particularly bad design and ask them to evaluate it, they feel uneasy but very few have language to describe what is bad (or good) about a design. Without a common language that distinguishes good code from bad code we have little power.

Reviewing a design is like critiquing art. We can recognize what we like or don’t like but we often can’t describe what makes a design good. Without this kind of language it is very hard for teams to generate good designs and quickly gain consensus.

This is why I am such a big believer in code qualities. Code qualities are specific, easily identifiable features of good code; code that has stood the test of time and proves to be easier to maintain and extend.

I talk about six key code qualities but there are many more. I point out six because they are easy to see and often focusing on just them is enough to guide us to write good code. Of course, they are only guidelines and there are times when we want to abandon them, like for performance or security reasons. But most of the time code qualities are good to strive for when we write software.

I will describe these qualities in coming posts. They are all easy to understand and you are probably already familiar with them. However, when we use them the benefits are so great that it is worth keeping them top of mind.

{ 2 comments… read them below or add one }

Scott Bain May 5, 2010 at 4:11 pm

Hey David…

You know you’re preaching to the choir with me, but I thought to contribute one interesting idea. I think I got this from Amir Kolsky, but it may have been Rob Myers. Anyway…

One thing I look for is how they are using inheritance. Rather, what “kind” of inheritance they have put in place. One kind is like inheriting traits from your parents (I am like my parents in these ways…), The other is like getting your parents’ stuff when they die (my dad left this ring to me). We like trait inheritance (life) much more than stuff inheritance (death).

🙂

Reply

davidbernstein May 6, 2010 at 11:17 am

Hi Scott,

Thank you for your comment. I like it a lot. It is a great way to think of inheritance. We have both seen inheritance overused by developers so it always helps to have ways of determining “good” inheritance from “bad” inheritance.

David.

Reply

Leave a Comment

Previous post:

Next post: