Craftsmanship is Refactoring

  1. Don’t Repeat Yourself. Be on the lookout for repeated phrases. Repetition is a major hideout for bugs. You should only need to edit one piece to make a complete change in the code. Having to edit multiple areas will cause confusion. Something will be overlooked. If you have to make multiple edits for a single change, it’s a good sign you need a new abstraction. This can be tricky. There are myriad ways in which code can be unintentionally repeated.
  2. Make the code expressive. Name everything well. Make it very clear what your methods do. Define methods just below their first use so that others don’t have to hunt through the code. Make it so that there are no surprises or confusion about what your code does. Expressive code is easy to understand. Good names will tell you how to improve their code’s quality.
  3. Make the code simple. Without repeating yourself, without glomming your code into an impenetrable sphere of mystery, and without losing the expressiveness of your names, make the code as simple as possible. The less your code resembles a Rube Goldberg machine, the better. Write less. Every bug ever written was written.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ian Carroll

Ian Carroll

15 Followers

Software Crafter at 8th Light Consultancy, Organizer for Fullstack LA meetup, Eagle Scout, Theatre Person, Taoist Philosopher among other passions.