Swizec Teller - a geek with a hatswizec.com

    Clean Code and speed coding

    Some weeks ago I finished reading Clean Code by Robert C. Martin, which is something I may have spoken about already, but I can't remember. Well it was an amazingly good read and it instantly changed a lot about the way I code and even the way I think about things. At first a lot of what was mentioned in Clean Code made the optimiser in me cringe and whince. Things like putting conditionals into a separate function and so on.

    But later I realised that hey, modern computers are fast enough, some wasteful practices like that aren't going to hurt too much and the saved time in development can only do good. See, the thing is that if, for example, you encapsulate conditionals in separate functions you don't only achieve greater code readability, you also get the ability to change an important part of algorithm behaviour (when to do something) by changing a single function and the change automatically propagates throughout your code.

    I believe that due to my new practices of writing code cleanly I have been able to develop Twitulater as much as I have in the past twelve days. It's reached version 0.3 of all things and is fast becoming useful. So far the version update cycle, starting from 0.1, has on average been 2.5 days and that, if you ask me, is quite astounding - especially taking into account this is the first time ever of me developing in Adobe AIR.

    The reason developing can be so quick once you acquire clean code practicess is mostly that, as Uncle Bob says, developers spend much more of their time reading code than they do writing it and when that code is super readable it takes much less time to read. Furthermore, due to many of his advice, the code is also much more searchable and better structured so it doesn't take as long to find what you're looking for - this especially applies to us text editor types who abhor IDE's.

    There is another reason that I believe is of even greater weight, now that I keep code clean I find that I can write large chunks of code, without testing, and have it working correctly the first time it's run. With Twitulater it's happened that I wrote a hundred lines of code, ran it, and it just worked, just like that.

    Now all that's left for me to do is acquire test driven development practices so I can cut my debugging time in half. Oh and if you didn't glean from the rest of this post: You want this book.

    Did you enjoy this article?

    Published on November 17th, 2008 in review

    Learned something new?
    Want to become an expert?

    Here's how it works 👇

    Leave your email and I'll send you thoughtfully written emails every week about React, JavaScript, and your career. Lessons learned over 20 years in the industry working with companies ranging from tiny startups to Fortune5 behemoths.

    Join Swizec's Newsletter

    And get thoughtful letters 💌 on mindsets, tactics, and technical skills for your career. Real lessons from building production software. No bullshit.

    "Man, love your simple writing! Yours is the only newsletter I open and only blog that I give a fuck to read & scroll till the end. And wow always take away lessons with me. Inspiring! And very relatable. 👌"

    ~ Ashish Kumar

    Join over 14,000 engineers just like you already improving their careers with my letters, workshops, courses, and talks. ✌️

    Have a burning question that you think I can answer? I don't have all of the answers, but I have some! Hit me up on twitter or book a 30min ama for in-depth help.

    Ready to Stop copy pasting D3 examples and create data visualizations of your own?  Learn how to build scalable dataviz components your whole team can understand with React for Data Visualization

    Curious about Serverless and the modern backend? Check out Serverless Handbook, modern backend for the frontend engineer.

    Ready to learn how it all fits together and build a modern webapp from scratch? Learn how to launch a webapp and make your first 💰 on the side with ServerlessReact.Dev

    Want to brush up on your modern JavaScript syntax? Check out my interactive cheatsheet: es6cheatsheet.com

    By the way, just in case no one has told you it yet today: I love and appreciate you for who you are ❤️

    Created bySwizecwith ❤️