Being that I work in the software development industry and also work on open source projects, it’s needless to say I’ve seen my fair share of ugly code. I’m not just talking about ‘poorly engineered’ code either. Poor indentation practices, inconsistent variable naming conventions, mixed white space, and comment-less code are all things I identify as ugly code. Some of my own work included. We’ve all got code we’re not proud of. That’s the nature of software development. The key is being able to identify these issues and correct them as time goes on.
Over the past couple years I’ve started to focus on cleanly formatting my code (on top of properly engineered code of course). It ends with a much nicer product and when I have to troubleshoot later, it’s easier to navigate my previous work. At one point though, I realized that clean code shows craftsmanship.
Trade-skills are slowly becoming a thing of the past in the digital era. Working with your hands is taking a backseat to typing on a keyboard or pushing a mouse around (myself included), and with that, I think the idea of good craftsmanship can get lost. After all, it’s code, who’s going to see it? Let’s take woodworking for example.
When I was a kid, my dad spent a lot of time building things out of wood. It would take hours for him to complete a project, but the end result would be beautiful. When I’d work on something, it’d fall apart in a week (come on I was like 10 years old!), but I digress. Now, we could probably all build a table if given the proper materials. You’d first setup your requirements:
Requirements for a Table
- 4 Legs
- Table Top
- Supports weight
- Proper height
You need nothing more for that table to be considered a table than those 5 things. Would it be one somebody was proud to put on display? Use daily? Have someone else repair? Probably not, but it’s a table none-the-less.
So how would you make it something to be proud of?
- You’d take the time to choose the right wood (maybe a nice dark oak, or walnut)
- You’d sand the top to perfection so there were no bumps from the grain
- You could do inlay patterns with different types of wood
- Add in a removable leaf to expand for the company that comes once a year during a holiday
- Use a more ascetically pleasing joint type, maybe a nice dove tail
- Spend the time to put a few coats of stain on (instead of one) and finish it off with a clear coat
I think it’s pretty obvious to see what I’m getting at. Taking pride in your development work goes FAR beyond what is functionally necessary to meet requirements. Holding yourself to a higher standard in your practices produces something that you can be proud to show off to other developers and shows you take pride in what you do.
As a software developer, your skill is your ability to quickly adapt and write functional code, but showing a true passion for your skill means treating ever aspect of the job with utmost importance. Even the parts “no one will ever see”. Take the time to determine what you consider “clean code”. If you have tools that you use to achieve this, I’d love to see them in the comments.
Post image via designandtechnologydepartment @ Flickr