News for hackers. Stuff that matters.
Re:It's probably time to stop recommending Clean Code (2020) by ebiester on Saturday February 18, 2023 @05:17AM (#34845691)
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, within the context of Bob Martin "Clean", is one consistent mental model. I don't like all of it, but it gives one coherent top-to-bottom model.

Re:It's probably time to stop recommending Clean Code (2020) by SergeAx on Saturday February 18, 2023 @07:10AM (#34846291)
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.

Re:It's probably time to stop recommending Clean Code (2020) by sshine on Saturday February 18, 2023 @07:30AM (#34846416)
> it is relatively easy to argue and have a consensus upon

If you’re a reasonable person, yes. But when you’re not, all kinds of crazy patterns evolve.

E.g. a boss saying “I’m perfectly ok with functions that take more than 100 arguments.” (Compiler does not even support this.) and code being copy-pasted dozens of times being perfectly readable, but is a sink-hole when you refactor.

Clean Code (Martin’s book, and the movement in general) is my weapon when stubborn colleagues will not listen to reason. Sometimes they will listen to authority.

Re:It's probably time to stop recommending Clean Code (2020) by wadd1e on Saturday February 18, 2023 @10:16AM (#34847481)
>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 clean/idiomatic/readable code.

Re:It's probably time to stop recommending Clean Code (2020) by SergeAx on Saturday February 18, 2023 @12:24PM (#34848770)
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) by ebiester on Saturday February 18, 2023 @12:49PM (#34849085)
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?

Re:It's probably time to stop recommending Clean Code (2020) by curiousguy on Saturday February 18, 2023 @11:30AM (#34848142)
> 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).