Live data from Hacker News

It's probably time to stop recommending Clean Code (2020)

qntm.org

171–180 of 216 posts

Re: It's probably time to stop recommending Clean Code (2020)

#171

Earlier quoted context omitted.

I'm still amused by claims that the book is dogmatic when these paragraphs are in the opening chapter: > Consider this book a description of the Object Mentor School of Clean Code. The techniques and teachings within are the way that we practice our art. We are willing to claim that if you follow these teachings, you will enjoy the benefits that we have enjoyed, and you will learn to write code that is clean and prof…

I didn't remember that in the introduction. But if that was the case the book should've included more counterexamples and a less imperative language.

Why? How strong would their [0] arguments be? Is it worth increasing the size of what was already (had to look this up) a 464 page text to include weak arguments about other people's views? Or, you know, people could actually read the giant disclaimer (it was more than those two paragraphs, I just copied them here) and then take it at face value, go learn other ideas about programming. Practice your own judgement.

No book, no philosophy, no technique, no programming language, no ChatGPT can ever remove the need for the programmer to think for themselves and determine their own approaches to programming and which approaches are appropriate for which programs.

[0] I keep using they and their, there were multiple authors for the book. Several chapters were written by people other than Martin.

Re: It's probably time to stop recommending Clean Code (2020)

#172

From my decade writing software professionally and my current job search, I really question the actual demand for clean code. That’s unfortunate because it’s my specialty and what gives me job satisfaction. I love fixing things. I actually enjoy working on a crappy codebase that has made the company money but is now too hard to maintain/extend and needs cleaning. Adding tests, refactoring, extracting functionality to…

I get the exact same joys from work. Taking an old but functional and profitable codebase and cleaning it up, bringing it up to conventions and standards, refactoring. At my current job, feature work is always a thing, but I make refactoring boards and get people on board with bringing in refactor tickets every sprint, etc.

So while not 100% of my job is refactoring, a large portion is. And sometimes I convince them it’s time to rewrite one entire section or another, so a couple of sprints at a time might be dedicated to just that.

I guess I’ve gotten lucky, probably a combination of that and being outspoken about what needs to be fixed.

Re: It's probably time to stop recommending Clean Code (2020)

#173

Earlier quoted context omitted.

I'm still amused by claims that the book is dogmatic when these paragraphs are in the opening chapter: > Consider this book a description of the Object Mentor School of Clean Code. The techniques and teachings within are the way that we practice our art. We are willing to claim that if you follow these teachings, you will enjoy the benefits that we have enjoyed, and you will learn to write code that is clean and prof…

If this verbiage is only in the introduction, it will not carry much weight. People, and especially IT people like rules, that you can indiscriminately apply.

If people claim to read a book and skip chapter 1, did they really read the book? I'd say no, they only read part of it. It's not the authors' fault that people skip a chapter that generally provides the context for reading the rest of the book. That's on them. Don't be foolish, learn the context of what you're reading before you read it. That is what should be encouraged.

Re: It's probably time to stop recommending Clean Code (2020)

#174

My experience is that I run into a lot of relatively junior programmers who are concerned about clean code. Is my code clean? How do I organize my code? How do I make it clean? Should we clean up this code? I almost never want to use the word “clean” when I’m talking about code. These days, when someone asks me to review code, and they start talking about “clean” code, I shift the discussion to two points—code should…

What is easy to understand code? What if you have three people in the same code base who write "easy to understand" code for them, but inconsistent with each other? Even if those three all understand each other while writing it, this will not continue as the team changes and people have to onboard. As such, it isn't sufficient to have a linting standard: great codebases should have a consistent mental model. "Clean"…

> I don't like all of it, but it gives one coherent top-to-bottom model.

Completely agree. Bob Martin “Clean” has some really good recommendations, and some subjective advices. Normally the dev team can use this mental model as baseline and agree on which of the subjective advice to follow.

I just had an issue related to this recently, one of the senior software engineer in my team was previously a university professor with no software engineering experience. Every code review is an endless discussion, as he don’t agree with most of Martin “clean” code. So his code not only has several bad smells, but it feels like a completely different dialect. It forced us to have really basic discussions about code practices, even when to use comments (the professor likes to comment almost every line of code).

Re: It's probably time to stop recommending Clean Code (2020)

#175

From my decade writing software professionally and my current job search, I really question the actual demand for clean code. That’s unfortunate because it’s my specialty and what gives me job satisfaction. I love fixing things. I actually enjoy working on a crappy codebase that has made the company money but is now too hard to maintain/extend and needs cleaning. Adding tests, refactoring, extracting functionality to…

> So what do you all think? Is clean code really actually valuable in the eyes of organizations or will they always take the quicker and dirtier option given the choice? Will I ever find work selling code cleaning (even to companies that ask for it) or should I “rebrand” on fast and cheap code at the expense of quality?

There's many sides to this.

Even Boeing doesn't value clean code (as shown by the 737 MAX disaster where 9$/h coders were hired in India). So you can imagine how much a local non-tech company values clean code.

There's also that a lot of these companies simply... couldn't recognize clean code even if they saw it! Since they aren't competitive with top players, the caliber of programmers they attract is nowhere near the level of engineers at real tech companies. Unless these companies "luck out" with an extremely high caliber hire, they won't really know there's a better way of doing things [0]. Think places where source control is still seen as too complicated or not needed.

[0] https://www.hanselman.com/blog/dark-matter-developers-the-un...

Re: It's probably time to stop recommending Clean Code (2020)

#176
post #68

Earlier quoted context omitted.

After some years I recently had to work on a very old PHP project with linear and untested code. Full of bugs, unmanaged corner cases, unnecessary code duplication, magic numbers...we didn't even try to understand the business logic or reverse it. I still think it's just low skilled devs vs professional ones. You can make similar mistakes with many, many languages, it seems to me that Java went out of fashion, consid…

As a counterpoint I'm working on an ex-PHP4 codebase, that's been "developed" (in the loosest possible meaning) by assorted people over 15 years. It's full of security vulnerabilities and the worst code I've seen in my career. I'm also working on a modern Symfony PHP codebase using popular 3rd party Symfony bundles. I've used Symfony for a decade but find the compiler passes and levels of abstractions (particularly w…

I upgraded a quite old java app from java 6 and spring 3 to java 8 and spring 4.30 in 4 hours without changing a single line of code.

I guess we both may have good anecdotal examples :)

Re: It's probably time to stop recommending Clean Code (2020)

#177
post #151

Earlier quoted context omitted.

One option is to work for a company where an important part of the product they make is code itself, e.g. an SDK. Another is to switch to a programming language that tends to attract quality-minded people, e.g Rust, Go, Haskell.

One is very different from the others. The one whose designer said “ They’re not capable of understanding a brilliant language“

Ha, well I’d agree with you on that, but even so I’ve seen Go mostly adopted by people who are capable and care.

Re: It's probably time to stop recommending Clean Code (2020)

#178

Earlier quoted context omitted.

The issue is, managers want these things, like a nice code base, but are unwilling to pay for it. Or more correctly you have to pay most of the cost of that Hodge podge of hacks. So while they can off load that cost to you, why would they make an effort to improve the situation?

So what do we do? Working this way drives me crazy, depressed, and unhappy; I don’t want to do it anymore. I don’t want to be part of the problem either by becoming one such manager so that others will have to pay the cost of my benefit. What’s left? Opt out, live on shoestring budget for the rest of your life, and hope it works out?

There are thousands of software engineering jobs out there, how many have you tried? A handful? Increase your sample size.

Re: It's probably time to stop recommending Clean Code (2020)

#179
post #168

Earlier quoted context omitted.

Code is a kind of language. It is entirely possible to tell if person speaks clearly, easy to understand, or not. You may even train an ML model on Wikipedia section "Simple English". The same applies to code. It is not 100% deterministic metric, but it is relatively easy to argue and have a consensus upon.

>It is entirely possible to tell if person speaks clearly, easy to understand, or not. Just thinking out loud here, but isn't correctness(grammar and spelling) the only thing we all(mostly) agree on? For example, someone well versed with old English literature may consider Shakespeare easy to understand, but I certainly wouldn't. I think "speaks clearly, easy to understand" are just as subjective as our notions of cl…

Someone really well versed will have an understanding of how old English sounds for layperson. Also, we are discussing a situation when everyone is more or less fluent in a given [programming] language, and the probable culprit is just flexing their recently gained obscure expressions or constructing overcomplex one-liners.

Re: It's probably time to stop recommending Clean Code (2020)

#180

Earlier quoted context omitted.

What is easy to understand code? What if you have three people in the same code base who write "easy to understand" code for them, but inconsistent with each other? Even if those three all understand each other while writing it, this will not continue as the team changes and people have to onboard. As such, it isn't sufficient to have a linting standard: great codebases should have a consistent mental model. "Clean"…

Code is a kind of language. It is entirely possible to tell if person speaks clearly, easy to understand, or not. You may even train an ML model on Wikipedia section "Simple English". The same applies to code. It is not 100% deterministic metric, but it is relatively easy to argue and have a consensus upon.

Are you in Bangalore, Mississippi, or Edinburgh? All three can talk with those in the same accent and dialect easily but are going to labor when talking with each other.

What happens when half of your code uses functional patterns and the other half imperative/OO?

Post reply on HN