What does a good programmer's code look like? [closed]

I am a hobbyist programmer (started with VBA to make excel quicker) and have been working with VB.NET / C#.NET and am trying to learn ADO.NET.

A facet of programming that has always frustrated me is what does 'good' look like? I am not a professional so have little to compare against. What makes a better programmer? Is it:

  • They have a better understanding of all the objects / classes / methods in a given language?
  • Their programs are more efficient?
  • The design of their programs are much better in terms of better documentation, good choice of names for functions etc.?

Put another way, if I were to look at the code of a professional programmer, what is the first thing that I would notice about their code relative to mine? For example, I read books like 'Professional ASP.NET' by Wrox press. Are the code examples in that book 'world class'? Is that the pinnacle? Would any top-gun programmer look at that code and think it was good code?


The list below is not comprehensive, but these are the things that I thought of in considering your question.

  • Good code is well-organized. Data and operations in classes fit together. There aren't extraneous dependencies between classes. It does not look like "spaghetti."

  • Good code comments explain why things are done not what is done. The code itself explains what is done. The need for comments should be minimal.

  • Good code uses meaningful naming conventions for all but the most transient of objects. the name of something is informative about when and how to use the object.

  • Good code is well-tested. Tests serve as an executable specification of the code and examples of its use.

  • Good code is not "clever". It does things in straightforward, obvious ways.

  • Good code is developed in small, easy to read units of computation. These units are reused throughout the code.

I haven't read it yet, but the book I'm planning to read on this topic is Clean Code by Robert C. Martin.


The first thing you'd notice is that their code follows a consistent coding-style. They always write their structure blocks the same, indent religiously and comment where appropriate.

The second things you'd notice is that their code is segmented into small methods / functions spanning no more than a couple dozen lines at the most. They also use self describing method names and generally their code is very readable.

The third thing you'd notice, after you messed around with the code a little is that the logic is easy to follow, easy to modify - and therefore easily maintainable.

After that, you'll need some knowledge and experience in software design techniques to understand the specific choices they took constructing their code architecture.

Regarding books, I haven't seen many books where the code could be considered "world-class". In books they try mostly to present simple examples, which might be relevant to solving very simple problems but aren't reflective of more complex situations.


Quoting Fowler, summizing readability:

Any fool can write code that a computer can understand.
Good programmers write code that humans can understand.

'nough said.