Thursday, August 12, 2021

Clean Code Struggles

This weeks blog club focused on a piece by Dan Abramov on trying to write clean code. I'll start by saying all of his blog posts are really good such as his recent one on npm audit.

The "cleaner code" that he shows in this piece definitely looks better but there were "software team rules" that he broke when merging the changes to master.

Here are my favourite quotes:

Firstly, I didn’t talk to the person who wrote it. I rewrote the code and checked it in without their input.

A healthy engineering team is constantly building trust

My code traded the ability to change requirements for reduced duplication

The first two points are easy to see how the changes were a mistake. I 100% agree on this.

The third point is the one that I don't understand as much. I guess I look at it as something like a go file with all the logic explicitly defined in that file verses having lots of different modules doing things. I prefer less abstraction and more explicit definitions.