DEV Community

Discussion on: Are There Actually Companies out There That Write Good Code?

Collapse
 
cescquintero profile image
Francisco Quintero πŸ‡¨πŸ‡΄ • Edited

Such great article πŸ‘πŸ½, Erik.

You know what? I used to believe that I could find awesome code, creme de la creme code in OSS projects. Until one day I read an article explaining a topic for Ruby on Rails apps and the author pointed out a "bad example" in the GitLab codebase.

In disbelieve, I went to the GitLab repo to find πŸ˜†the file and the lines. They were real. Worst of all, there were many more, in all the place!

In that moment I really thought about all those posts saying "don't do this or that because it's all wrong" and then seeing those very examples in the source code of such company, well, it taught me bad code is everywhere and we should live with that.

I think if we look closely to DEV sources we would find so called "bad code"

Collapse
 
daedtech profile image
Erik Dietrich

Thanks for the kind words!

And yeah, bad code is everywhere. Some of it is because we all have a natural impulse to categorize "I didn't write it and don't immediately understand it" as bad. But I used to audit codebases for a living, and it really just stems from the fact that we're all fallible humans, making decisions in the moment with imperfect information. All codebases rot and have weird stuff in them.

Collapse
 
kwstannard profile image
Kelly Stannard

One thing I find helpful is to write out every possible thing I could have an issue with in a code review and then pick the most important comments and drop the rest. You start realizing what is actually bad and what is just a different style.

Thread Thread
 
daedtech profile image
Erik Dietrich

That is such a GREAT strategy.

Years ago, I used to write more on my blog about how to conduct code reviews without demoralizing people. If memory serves, I once wrote a satirical post called something like "How to Use a Code Review to Execute Someone's Soul." IIRC, that popped on Reddit/Hacker News.

Anyway, for a decade, my message regarding code reviews has always been what you're saying here. "You're going to find dozens, or even hundreds, of things that you'd do differently. Jot them all down, prioritize them, and then share 5, max. Anymore than that, and you just demoralize people. Leave the rest in the codebase -- we can fix code later, but we can't fix demoralized teammates later."