Remix.run Logo
embedding-shape 4 days ago

> where each line is extracted into its own method

Never heard of "that style of programming" before, and I certainly know that Uncle Bob never adviced people to break down their programs so each line has it's own method/function. Are you perhaps mixing this with someone else?

eterm 4 days ago | parent | next [-]

This is from page 37 of Clean Code:

  > Even a switch statement with only two cases is larger than I'd like a single block or function to be.
His advice that follows, to leverage polymorphism to avoid switch statements isn't bad per-se, but his reasoning, that 6 lines is too long, was a reflection of his desire to get every function as short as possible.

In his own words, ( page 34 ):

> [functions] should be small. They should be smaller than that. That is not an assertion I can justify.

He then advocates for functions to be 2-3 lines each.

embedding-shape 4 days ago | parent | next [-]

> to leverage polymorphism to avoid switch statements [...] was a reflection of his desire to get every function as short as possible.

That's both true, but long way away from "every line should have it's own method", but I guess parent exaggerated for effect and I misunderstood them, I took it literally when I shouldn't.

eterm 4 days ago | parent [-]

I've edited my comment to add more context to that quote. He absolutely advocated for the most minimal of function lengths, beyond what is reasonable.

zephen 3 days ago | parent | prev [-]

He has expressed admiration for lisp, and he comes from a time before IDEs. These may color his desired level of complexity.

troupo 4 days ago | parent | prev [-]

> I certainly know that Uncle Bob never adviced people to break down their programs so each line has it's own method/function

There's a literal link to a literal Uncle Bob post by the literal Uncle Bob from which the code has been taken verbatim.