My Adventures in Coding

June 23, 2010

Coding is still writing

Filed under: Refactoring,UberConf 2010 — Brian @ 10:15 pm

While at UberConf I had the great opportunity to attend a talk by Venkat Subramaniam titled “How to Approach Refactoring”. Many times I have attended talks and read articles focusing on refactoring techniques, but rarely do these other sources discuss the behaviours that allow refactoring to work. Knowing all of the refactoring techniques without understanding the fundamentals that make refactoring beneficial, can result in making code worse!

There are many great refactoring books out there such as

However, during Venkat’s talk he recommended a book that is not about programming, but instead about non-fiction writing in general: On Writing Well by William Zinsser. Whether you are writing a newspaper article, a book, or writing code, many of the same principles for better writing still apply.

  • Simplicity – Writing is a about communication. Often as developers we make code unnecessarily complex. We do this because for some developers it feels good and impresses others. A developer should never be proud of complexity in code, but instead focus on simplicity.
  • Clarity – Make it clear. Don’t use cryptic naming, instead make it clear and easy to understand.
  • Brevity – Make it short, but be careful not to take it too far. Reading a very long piece of text can make it take time to understand a piece of code, but it is also easy to make it too short. Use only as many words as it takes to make the code understandable and no more.
  • Humanity – Write it for people. Remember that code is going to be read by other developers, so consider how others will interpret what you have written and keep that in mind when writing code to make it simple, clear, and concise.
Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: