Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at imagehelp@codebetter.com
Good Code Is ...

Simple

Without a doubt, simple code is better code - more really is less. To misquote Einstein, "Make everything as simple as possible, but not simpler". Rarely have I encountered complicated code that needed to be complicated, even complicated logic does not not require complicated code.

If you aim for nothing else in your code, make it as simple as you can possibly achieve - someone will thank you for it one day, and it may even be yourself. 

Expressive of Intent

It should be simple for a casual reader to browse your code, and figure out what you were trying to do. This comes down partially to using meaningful names for variables and methods, and partially down to structuring your code in a slightly better way. Don't sacrifice code clarity for secondary concerns like optimisation or the "wow factor". Simplicity has a lot to bring to this objective, but so does elegance.

Elegant

Code that is well written should be elegant, it should flow, it should read more like poetry than a technical manual. A well written code base is a joy to read, it leads you through the functionality, and always leaves you with a smile on your face. It takes no more than a brief glance at a source file to tell you if it has this quality. You only have to glance at open source projects like Castle or Rhino Mocks to see just how beautiful well written code can be.

Easy to Identify, Hard to Write

And the crux of the problem - good code is hard to write. Really hard to write.

An average developer can pick up a good code base and immediately identify it as being "really good code", but it takes a lot of experience to be the one to create it in the first place. The real skill in writing good code is knowing what you can take away, till nothing remains but the purest form of the solution.

Good developers are creatives, not technical people - technical things can be trained, but creativity is something that you have within and need to nurture. Practice, practice, and practice more - always strive to write simpler, more expressive and more elegant code.

 


Posted 05-06-2008 7:08 AM by Jak Charlton

[Advertisement]

Comments

Dew Drop - May 6, 2008 | Alvin Ashcraft's Morning Dew wrote Dew Drop - May 6, 2008 | Alvin Ashcraft's Morning Dew
on 05-06-2008 9:09 AM

Pingback from  Dew Drop - May 6, 2008 | Alvin Ashcraft's Morning Dew

jdn wrote re: Good Code Is ...
on 05-06-2008 11:52 AM

"it should read more like poetry"

Well, I don't know.  We talking Yeates of Ginsberg here or what?

Jak Charlton wrote re: Good Code Is ...
on 05-06-2008 12:15 PM

My personal style is more beatnik...

Christopher Bennage wrote re: Good Code Is ...
on 05-19-2008 10:18 AM

I need an espresso.

About The CodeBetter.Com Blog Network
CodeBetter.Com FAQ

Our Mission

Advertisers should contact Brendan

Subscribe
Google Reader or Homepage

del.icio.us CodeBetter.com Latest Items
Add to My Yahoo!
Subscribe with Bloglines
Subscribe in NewsGator Online
Subscribe with myFeedster
Add to My AOL
Furl CodeBetter.com Latest Items
Subscribe in Rojo

Member Projects
DimeCasts.Net - Derik Whittaker

Friends of Devlicio.us
Red-Gate Tools For SQL and .NET

NDepend

SlickEdit
 
SmartInspect .NET Logging
NGEDIT: ViEmu and Codekana
LiteAccounting.Com
DevExpress
Fixx
NHibernate Profiler
Unfuddle
Balsamiq Mockups
Scrumy
JetBrains - ReSharper
Umbraco
NServiceBus
RavenDb
Web Sequence Diagrams
Ducksboard<-- NEW Friend!

 



Site Copyright © 2007 CodeBetter.Com
Content Copyright Individual Bloggers

 

Community Server (Commercial Edition)