Remix.run Logo
eterm 4 days ago

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.