Your habits are important

Being an awesome developer is all about being a genius. It’s the only way you can get a job at a cool company and it’s the only way you can build anything amazing.

Oh wait, no it’s not.

Here’s the thing. If you care enough to actually want to be a better developer, you’re already ahead of 99% of field. So now what? Get smarter? Start a project with the perfect blend of flavour of the month and pop culture that goes viral on github? You could do that or you could do something with a concrete return on investment…

Build good habits.

Building good habits is a great investment for a developer because it goes a long way to making what you do consistent, repeatable and valuable.  Building good habits takes those things we know we should be doing and makes them just, “the way”.  Let’s be honest, if you don’t make a habit out of something, it’s going to be dropped the second any pressure is applied.

Good habits I’m working on:

  • Smaller steps!  Whether it’s a new feature or refactoring legacy nonsense, taking smaller steps is great.
  • Making sure tests really are driving what I’m doing.  It’s so tempting to race off ahead, but it ends in tears every time.
  • Automate it.  Rake, powershell, whatever.  Just stop doing it manually.
  • Keep the excitement, keep the love.  There’s more to life than coding and it’s easy to burn out.  Mix it up, do other things.

What are you working on?

 

Code smells – data clumps

Staying up to date with good practices in software can be difficult.  What was a good practice only a moment ago has fallen out of favour replaced by something leaner, more agile and completely incompatible with the way we used to do things.  While it’s great for all those guys who need ways to fill time between giving conference talks, we mere mortals have things like clients, bosses, legacy code and less than stellar teams to deal with.

So, I believe an easy win is in order.  Presenting, the data clump.

“Whenever two or three values are gathered together – turn them into a $%#$%^ object.”

— Martin Fowler

So, what is a data clump?
Whenever the same variables are being passed around together, it’s generally because they’re related. This sort of implicit relationship means something within our code, it represents a “thing”. The problem with this is, we want our code to be explicit, no muddied waters, no things that aren’t things but really are things. Data clumps make code harder to understand, harder to change and as a result, harder to live with.

Awesome, now what?
Work out what the implicit relationship between the variables is, throw them in a meaningful class and marvel at your cleaner, explicit code.

Easy win, you say?
You only need to do this once and you’ll see the benefits. Do it twice and suddenly it starts to jump off the screen at you. Keep doing it and it becomes a habit that makes you a way better developer.