Re:Don't write clean code, write CRISP code
by laerus on Tuesday April 18, 2023 @06:55AM
(#35612296)
DRY only paired with the rule of three (or more)
[ Parent
| on HN ]
Re:Don't write clean code, write CRISP code
by carlmr on Tuesday April 18, 2023 @07:07AM
(#35612393)
That, or the code block is sufficiently big and similar.
I remember a ex-colleague of mine who copied a 1000 line function, changed a parameter, and didn't see anything wrong with it.
Re:Don't write clean code, write CRISP code
by leidenfrost on Tuesday April 18, 2023 @07:25AM
(#35612513)
Why do you have a 1000 line function in the first place? Sounds like an entire class of methods in a single structure.
Re:Don't write clean code, write CRISP code
by tcfhgj on Tuesday April 18, 2023 @08:40AM
(#35613207)
The function contained 300 lines which he copied and pasted twice, because DRY and extracting Tonto a function is dumb /s
Re:Don't write clean code, write CRISP code
by carlmr on Tuesday April 18, 2023 @08:51AM
(#35613319)
Created by the same person. But the way he doubled his LoC contribution in this PR you could imagine why.
Re:Don't write clean code, write CRISP code
by sodapopcan on Tuesday April 18, 2023 @10:45AM
(#35614701)
I had a coworker who did similar. It was essentially the entire frontend for an order application (back in the jQuery days), a few thousand lines. That was all copy/pasted, changed to deal with the case of when there are no orders (which only ever happens once since this was an in-house system) and those massive chunks were wrapped in an if/else.
Re:Don't write clean code, write CRISP code
by bcrosby95 on Tuesday April 18, 2023 @11:18AM
(#35615131)
I recently had a junior copy paste a 20 line code block rather than add an extra 'or' to the if statement.
Hey, rule of 3 ;)
Anyways, guidelines are just guidelines, regardless of what you come up with you can break it.
Re:Don't write clean code, write CRISP code
by erik_seaberg on Tuesday April 18, 2023 @03:09PM
(#35618545)
I’m not swayed by this rule of three. The experience I have is the reason I reach for a hammer immediately, instead of first trying three rocks to demonstrate that’s a bad idea.