Live data from Hacker News

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

qntm.org

211–216 of 216 posts

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

#211
post #210

Earlier quoted context omitted.

> And, code performance is, as you say, part of test performance. If the tests take too long, perhaps the code needs to be improved. Yes. I mentioned this is in the last section. When test-performance is alright, typically you don't need to optimize code anymore. For me, optimizations in the "code performance" category are for example trading off a generalist API for a more complicated tweaked version that reaches in…

> What are these suites testing? One is testing all permutations of actions on some observability thingy: does everyone get the updates they requested in the correct order, basically, but suppose you have 3 "clients" that can connect and disconnect at arbitrary moments, and we're testing a single insert-like operation on the initial empty data, there are already dozens of combinations. Another one is some operation o…

Interesting, thank you.

> This code is in JS because it has to run in the browser, so it is not super fast.

Try profiling heap allocations in Chrome Debugger. In my experience especially array-allocation can slow down JS-code a lot.

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

#212
I wouldn't recommend it either, it is a very simplistic view of coding with some bad advice intermingled. Obviously reality is much more complex than any book could describe and there is benefit to think about bad examples as well as good ones.

Though it is an ill-defined term clean (clear, readable, reasonable, understandable) code is important in the sense that accidental complexity should be minimized and encapsulated and necessary complexity should be understandable.

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

#213

Earlier quoted context omitted.

A compiler should do this for you. Unless it outputs source code, it can't.

From what I got the context he more or less implied a compiler due to the language used (C++). I know that's now how C++ started but nowadays I think you can assume that when people discuss ways to program C++ it is by using a compiler rather than a code generator.

It looks to me like there's some confusion here; Carmack is talking about inlining for purposes of source code management; compilers inline for purposes of performance optimiziation. The two seem to be getting conflated in this thread.

So GP points out that, no, unless your compiler is outputting source code (therefore changing what you see as a programmer), having it inline the function does not accomplish the goal at all.

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

#214
post #71
post #59

Yeah. This fits with my reading of it as well. Periodic chunks of "yep, makes sense" scattered through a really disturbing miasma of questionable stuff and incredibly tightly bound methods sharing gigantic balls of state that must be called in an order, but with nothing that hints at or enforces that order. It adds up to a really horrific result pretty frequently. I'm not sure how it got its status at the beginning,…

I once stated a few of the author's criticisms in a forum, one of which was the 3 line function, only to get a reply from Martin himself, saying that he hadn't written that. Unfortunately for him, everybody reads it in the book, and his apostles repeat it, and it's part of his success.

[deleted]

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

#215

Earlier quoted context omitted.

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…

> Why? How strong would their [0] arguments be?

I imagine the strength of their arguments would be approximately related to the strength of said arguments merits / demerits. You don't have to present an unyielding argument if your goal is to educate your reader and help them to reach an informed position.

He's saying he expected more, coming from a different background with a culture of rigor.

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

#216

Meh, I don't get the hate for Clean Code, or other books like this. Should you take everything it says as gospel? No. Did reading it in the beginning of my career make me a better developer? Yes. Its the same as with every other practice. Do I practice TDD? No. Did trying it out for some time learn me things I still apply to code I write 10 years later? Yes.

Don’t you think the example code quoted looks really bad? If the code is that bad, why should the advice be trusted?

Is the advice to be trusted though, or merely considered?
Post reply on HN