4 ms·
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 examp
by dietrichepp 4y ago
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 a verb.
What a proclamation! We could connect this to correctness and understandability. But the book does not. You could say that it is harder to understand a class named “SomethingManager” because “manager” is vague, and more specific words are usually preferred. Instead, the book presents a rule, without explanation or example. Kind of like the Strunk & White book on style, and if you like Strunk & White, then we disagree on at least two books.
That’s my general complaint about the book. Too many proclamations, too much doctrine, not enough explanation or foundation.
- cush 4y agoThere'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
- dietrichepp 4y agoI think you may have missed the context for why I brought it up in the first place.
- cush 4y agoI 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.
- eurasiantiger 4y agoLet’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?
- cnorthwood 4y agoImageDownloadPreparer?
- eurasiantiger 4y agoImageDownloadManager also communicates with the frontend about its state, so it’s not a completely preparatory process.
- carschno 4y agoI think I would go with a class called Image, which provides a method called download().
- eurasiantiger 4y agoThis class is now over 4000 lines long.
- ahartmetz 4y agoImageDownloadDispatcher, 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, ...
- eurasiantiger 4y agoAll 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?
- bloat 4y agoThere's whole pages of explanation about understandability in the Meaningful Names chapter preceding that distilled rule. Specifically it explains about making meaningful distinctions by avoiding vague words like Data or Manager or Info.
- kcartlidge 4y ago> 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!
- dietrichepp 4y agoStrunk & White is really bad, try Style: Lessons in Clarity and Grace as an alternative.
- kcartlidge 4y ago> 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.