Re:It's probably time to stop recommending Clean Code (2020)
by CRConrad on Wednesday May 26, 2021 @02:28AM
(#27287100)
> ...many functions are insufficiently explained by [naming and set of arguments] alone unless you want four-word camelcase monstrosities for names.
Come now, is four words really all that "monstrously" much?
> The code of the function should be right-sized.
Feels like that should go for its name too.
> Size and complexity need to be balanced there- simpler and easier-to-follow is sometimes larger.
The longer the code, the longer the name?
Re:It's probably time to stop recommending Clean Code (2020)
by quantified on Wednesday May 26, 2021 @03:57AM
(#27287656)
Quite a bit of sentiment around against long names, I personally am fine with them up to about 30-35 chars or so, then they start to really intrude. Glad you’re not put off by choosing function over form!
Re:It's probably time to stop recommending Clean Code (2020)
by CRConrad on Wednesday May 26, 2021 @02:40PM
(#27294415)
Stretch it to 36, and that is four not-all-that short words, at 4× 9 = 36 letters. Form and function! :-)
So it gets monstrous only from five words upwards or so... But still, I think I may by sheer coincidence have come up with a heuristic (that I'm somewhat proud of): The more convoluted the logic = the longer the code needed to express it ==> the longer a name it "deserves".
Which is often unavoidable, many functions are insufficiently explained by those alone unless you want four-word camelcase monstrosities for names. The code of the function should be right-sized. Size and complexity need to be balanced there- simpler and easier-to-follow is sometimes larger. I work on compilers, query processors and compute engines, cognitive load from the subject domains are bad enough without making the code arbitrarily shaped.
[edit] oh yes, what jzoch says below. Locality helps with taming the network of complexity between functions and data.
[edit] oh no, here come the downvotes!