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.

--

--

--

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

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Ruby Red

How To Setup your Validator Node (Matic Staking Testnet) Option“1”

Cups Compensation - Epiko Regal Cups Reset till March

It’s 2017 — Are Your Queries Still Vulnerable to SQL Injection?

HEALTHCARE INDUSTRY: SMART IOT SOLUTION​ FOR SENIORS

How to Run Python Functions in Parallel Using Ray API

Installing Ruby on Rails 6.1 on Ubuntu

DevPoint Labs UT Review

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

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

More from Medium

Quick look at Trunk-based development

What is the SOLID principle?

Don’t Just Write a Code —  Write a Clean Code

Do you perform reviews?