Writing "good" code: How do you understand code?

Published Monday, March 19, 2007 7:22 AM

John Morales has a great post on understanding complexity and how to think about difficult concepts.   

I think John hits on a key concept in the idea of "good code" while I realize it wasn't the main focus of his post: good code is simple for everyone (the team in question) to understand. I think this falls in nicely with our typical #1 goal on projects - writing maintainable code.

I always smile when I hear the saying "if it is was hard to write, it should be hard to read" and nothing could be further from the truth.

Remember the three purposes of code according to Bob Martin:

  • Perform the job (in other words, actually work)
  • Be maintainable
  • Clearly communicate its intent

Communicating clearly typically means simplicity for the intended audience.

In many ways, writing good code is like teaching. A good teacher will keep the message clear and simple and appropriate for their audience. In tackling a difficult programming task - our job is to bring the right metaphors for the system and team, then present it in a clear manner that we will easily understand in 6 months and the most junior person on the team could maintain (sometimes a tall order but who said things were easy) and therein lies OUR challenge.

Nice post John! :)

 

Jonathan Cogley is the CEO and founder of Thycotic Software, a .NET consulting company and ISV in Washington DC.  Our product, Secret Server, is a secure web-based solution for teams to secure their passwords.  Where do you keep your passwords or do you use the same one everywhere (snicker)?

Comments

# Reader said on Monday, March 19, 2007 12:29 PM

Jonathan, I am unable to get to Johns post. This page is not loading:http://cs.thycotic.net/blogs/john_morales/archive/2007/03/09/Its-all-relative.aspx

# Jonathan Cogley said on Monday, March 19, 2007 7:54 PM

Hmmm ... the link is working for me.  Wonder if it was just down when you tried?

This Blog

Syndication