Code Accents
By Scott White
It should be impossible to know who wrote a piece of code
– a bunch of people I’ve heard over the years
Let’s unpack what this means and how this would play out if it were possible. If this is the case all developers, no matter their background or skill level should write exactly the same code. The junior dev would write perfectly functional code but get nit-picked to death for any deviation from the approved “style.” I’ve actually seen this in practice, and the more “senior” team members think that they’re doing the junior dev a favor by picking them apart. As a manager, I know that it’s actually often demoralizing and I tend to be far more accepting of code that works, but isn’t “the way I would write it.” If the code is really bad (something that doesn’t work or wouldn’t be maintainable), I always take it into a pairing session, but I still let the junior dev write the code the in a way they feel comfortable.
This strict standard would also cut the other way. An architect would need to write code that looks the same as an average engineer at the company. This means that there would be nothing to aspire to or improve beyond the average for engineers at or above average.
This scenario assumes the team pins on average, but the problems just get worse if it goes in either direction. Pinning on the lowest common denomiator means everyone is writing code the way an intern would write it. I’ve never seen this attempted, but I think overall quality would be very poor in this case. Pinning on a pricipal engineer would set the bar is so high that nearly everyone would struggle to get over it. I’ve seen this try to be enforced and if there’s any diversity in the team experience, way too much time is spent on hammering PRs that don’t meet the bar.
My experience is that standardizing code doesn’t make a huge difference in outcomes for anything that matters like feature delivery or maintainability. It seems unrealistic that the most senior architect on the team and the college intern would have the exact same code. And why should they?
Let’s actually look at some of the pros of conformity in your code base. When I started thinking about this I came to think that writing code could be compared to writing in natural languages. After all, we do call them programming “languages.”
There is a place where standard writing is enforced fairly strictly: in the newspaper. For the most part, when you read a newspaper, all the columns sound pretty much the same. They follow similar writing patterns and styles and even often adhere to simple sentence structure and vocabulary. I don’t know if it’s true, but I always heard that newspapers were all written for a 6th grade reading level. This make a lot of sense for their business so their content can be consumed daily and quickly by advanced readers while still being accessible to those with lower levels of literacy.
The style of newspaper writing is consistent, but the best columnists still stand out and talented reporters often have a devoted following. So even though they have standard practices, apparently they haven’t squashed out all individuality. I think that’s a good thing.
If we venture even farther, we can find writing of vastly different styles like literature or poetry. These are the syles we often value most, and for good reason. These are the places where new ideas are born and the seeds of inspiration are planted. But maybe the downside of these is that nearly always they have a single author. As coding is a team endeavour, maybe the lesson is we should be closer to the newspaper than the novel.
I know that early in my career I was inspired by reading “Programmig Perl” by Larry Wahl. That’s the first time I found out coding can be fun and full of personality. It’s actually something I try to still do, even though I’m now usually so pressed for coding time that I don’t have much space for creativity. I admit there’s a limit to the variety before it gets too hard to maintain with a large team. But I also don’t want to lose the diversity of thought that the individuals on my teams bring to the endeavour. After 25 years, I’m still learning, so if I forced everyone to just write code just like me, then that learning would stop.
The way I think about code uniformity is the same way I think about my diverse teammates. We all have different backgrounds and experiences and all bring something different to the table. Many of my teammates are from different countries and have different accents, and I don’t ever think they should all speak identically to me. I don’t think their code should be identical to mine either. I want them to have their own code accents because it’ll make us all more literate and we’ll all learn something new along the way. I encourage everyone to embrace your teammates’ code accents as well.