Category Archives: Uncategorized

The Psychological Case For Clean Code

This is a little bit of philosophising that came out of a (misunderstood, as it happens) request by Marcel Du Preez for a list of things that characterise clean code. See what you think.

The Psychological Case For Clean Code

The following is how working on clean code makes programmers feel, and as such, for our own sakes, why we all should give a damn about it.

Writing code is a creative process, we feel the code itself represents who we are as professionals and as people. We judge ourselves and others by it, just as a musician is judged by the quality of the music they perform. It matters.

So, here is how we feel when we work with clean code:

Productive
We spend very little time debugging, deciphering code or reworking badly written classes. When we start a new feature, we can work on it straight away rather than have to re-steady the foundations all the time. Estimation is not daunting – we know even complex features will be smooth, predictable.

Clear headed
The code speaks to us, takes it easy on us. We only need to understand a few things at a time, not massively interweaved concepts. Abstractions are consistent, tangible. We know exactly what we are working on at any one time, we can explain it to someone else in a few sentences.

Motivated
We like working in the code. Progress is always being made. Things actually get easier as time goes on, compelling us to stick with it, even under pressure, so we can reap the rewards.

Confident
We are not scared to make changes. We are bold, feeling free to refactor, rip everything apart. We know if something goes wrong, we’ll be the first to know, and no-one will get hurt.

Competent
We understand the code, even when it achieves extremely complex things. We are not confused, the code is learnable. We feel like a better programmers having worked on it.

Ambitious
We sense the code is already powerful, well thought out. We have clear ideas about how we can make it even more capable. The potential is so ripe, that out goals grow. We can’t help say yes to features, because we can see so much is possible.

Proud
It is an honour to work on the code. We want it on our CVs. We blog about it, we are happy to publish code snippits. When new members join the team, we can’t wait to show them the best bits.

Vigilant
We hate seeing the code spoilt – we take issue when bad code is committed. We refactor when new code isn’t as good as what is already there. We believe the code deserves to get better every day. Hacks are just revolting. We reject bad ideas that don’t make the grade.

Calm
Nothing in the code scares us. It does what it is supposed to. Deadlines are not overwhelming, as we know strange bugs will not appear at the last minute.

Open minded
We are not afraid of someone coming in with criticism, new ideas. The code doesn’t require a defensive attitude to maintain team members’ self esteem, it can stand it. Anyone can see it is good already, any way to make it better is welcome.

To wrap it all up, clean code makes programmers feel in the flow, in control. For businesses that rely on software, this can have more effect than most people even dare to imagine.

Getting going

Righto. So this blog is going to be an outlet, and also a journal, of my efforts to get some more skills under my belt.

This is my second “day per fortnight” to really allow myself time to look into the things I want to look into. The end goal is to propel myself towards a great job when I get back to NZ. I am making no secret of the fact that that job might be at http://www.righthemisphere.com. The sooner they find out, the easier it will be for everyone.

I have figured the easiest way to get this all going will be to contrive some sort of half-real project. Which by sheer force of will will have everything I am interested involved. Somewho.

What are those things? So far my list is:

  • Rails
  • Android
  • Deeper into Linq
  • Entity Framework
  • Umbraco
  • WordPress
  • Android (Java)
  • Silverlight Windows 7
  • XNA Windows 7
  • Git
  • oData
  • Powershell
  • Jquery
  • WPF
  • Raven
  • Mongo
  • IIS 7

Its a bit of a eclectic mix.. At the moment I think it will have to be some sort of website and/or suite of apps driven by some sort of service. Hmmm… now to decide what that will be…