Live data from Hacker News

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

qntm.org

191–200 of 216 posts

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

#191
post #77

Earlier quoted context omitted.

It can definitely be confusing to hear "clean" when communicating in a professional setting. That said, in the book he covers correctness and understandability in nearly every paragraph. It's all the book is about really. It's called "clean" because it's concise and a catchy book title.

If you say the book “covers correctness and understandability in nearly every paragraph” then I’m convinced we must be talking about different books. For example, the book presents a rule for class names: > Classes and objects should have noun or noun phrase names like Customer, WikiPage, Account, and AddressParser. Avoid words like Manager, Processor, Data, or Info in the name of a class. A class name should not be…

There's an entire chapter on naming things, with tons of examples. Why would a class be anything but a noun or noun phrase? It's not a hot take

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

#192
post #8

A common theme not only in software but other industries: Beware of people selling you advice. They are the ones who will breed dogmatic illogical cargo-cults of people whose only rebuttal when questioned is some variant of "because someone who sold me this book that claims it'll make my code better said so", and that can't be a good thing in general. but we assume that Martin doesn't literally mean that every functi…

Have you worked with 5000 line functions? Just trying to set breakpoints in them at meaningful points is a nightmare. Give me 1000 5-line functions any day - providing of course they have sensible names (and ideally don't cause unexpected side-effects etc., though when a function is 5-lines long, that's fairly easy to spot; in a 5000-line function, fuhgeddaboudit. My personal guideline is "it should fit on a screen"…

Agree, but picking those 1000 sensible names is usually also very hard, and when people get it wrong and use bad names, sometimes it's worse than nothing.

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

#193
post #191

Earlier quoted context omitted.

If you say the book “covers correctness and understandability in nearly every paragraph” then I’m convinced we must be talking about different books. For example, the book presents a rule for class names: > Classes and objects should have noun or noun phrase names like Customer, WikiPage, Account, and AddressParser. Avoid words like Manager, Processor, Data, or Info in the name of a class. A class name should not be…

There's an entire chapter on naming things, with tons of examples. Why would a class be anything but a noun or noun phrase? It's not a hot take

I think you may have missed the context for why I brought it up in the first place.

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

#194

Earlier quoted context omitted.

If you say the book “covers correctness and understandability in nearly every paragraph” then I’m convinced we must be talking about different books. For example, the book presents a rule for class names: > Classes and objects should have noun or noun phrase names like Customer, WikiPage, Account, and AddressParser. Avoid words like Manager, Processor, Data, or Info in the name of a class. A class name should not be…

> and if you like Strunk & White, then we disagree on at least two books I'd be happy to shred Clean Code , but keep your hands off my Strunk and White !

Strunk & White is really bad, try Style: Lessons in Clarity and Grace as an alternative.

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

#196

Earlier quoted context omitted.

Let’s say my site has a download image feature that embeds per-user digital licenses into downloaded images at download time. This might take some processing so there is a queue and an abstraction representing the downloaded file. There are also several endpoints serving different types of image files. What shall I call the unit of code orchestrating these download processes, if not ImageDownloadManager?

ImageDownloadDispatcher, ImageDownloadScheduler, Image DownloadQueueManager... basically, the fix for "FooManager" names is to ask which aspect(s) of Foo the manager manages. Lifetime, storage, execution order (and according to which criteria), resource limits, uniqueness, exclusive access, efficient search, ...

All of those hint of functionality that is not present here. The code is just managing image downloads, not dispatching them, scheduling them, or even touching the queue (which is handled on a higher level).

ImageDownloadManager manages image downloads. Why use a name that makes less sense?

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

#197

Earlier quoted context omitted.

Let’s say my site has a download image feature that embeds per-user digital licenses into downloaded images at download time. This might take some processing so there is a queue and an abstraction representing the downloaded file. There are also several endpoints serving different types of image files. What shall I call the unit of code orchestrating these download processes, if not ImageDownloadManager?

I think I would go with a class called Image, which provides a method called download().

This class is now over 4000 lines long.

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

#198

Earlier quoted context omitted.

> and if you like Strunk & White, then we disagree on at least two books I'd be happy to shred Clean Code , but keep your hands off my Strunk and White !

Strunk & White is really bad, try Style: Lessons in Clarity and Grace as an alternative.

> Strunk & White is really bad

I disagree. Also, tastes vary and it fits mine. Thanks for recommending Style, though - it's very good and I fully get that it may be preferred by other writers. It also serves a slightly different purpose to Strunk & White, so the two can co-exist on the same writer's bookshelf.

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

#199
post #191

Earlier quoted context omitted.

There's an entire chapter on naming things, with tons of examples. Why would a class be anything but a noun or noun phrase? It's not a hot take

I think you may have missed the context for why I brought it up in the first place.

I didn't. Ironically, you (or the juniors you're referring to in your original comment) missed the context in the book. You said he presents it as a rule, without explanation or example, but you happened to cherry pick the one paragraph from the 13 pages of Meaningful Names that didn't have an explanation or example.

You're right, the problem is vagueness, and that context is already set a few pages prior. It would be redundant to repeat the same reasoning.

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

#200

Earlier quoted context omitted.

Let’s say my site has a download image feature that embeds per-user digital licenses into downloaded images at download time. This might take some processing so there is a queue and an abstraction representing the downloaded file. There are also several endpoints serving different types of image files. What shall I call the unit of code orchestrating these download processes, if not ImageDownloadManager?

ImageDownloadPreparer?

ImageDownloadManager also communicates with the frontend about its state, so it’s not a completely preparatory process.
Post reply on HN