News for hackers. Stuff that matters.
Re:There’s No Such Thing as Clean Code by ajuc on Friday January 28, 2022 @03:56AM (#30112272)
I've seen this happening a lot:

- you have the same if-then-else in 3 places in code with 3 different effects

- you refactor it to polimorphism (Enum with a few overloaded methods works well in java)

- now one of these places need additional condition so you make it a little more complex

- year passes

- you have eldritch abomination of OOP instead of 3 if-then-elses with slightly different conditions because at no point someone was brave enough to refactor back into if-then-elses as the special cases piled up

Re:There’s No Such Thing as Clean Code by ziml77 on Friday January 28, 2022 @09:51AM (#30115287)
Exactly my experience with polymorphism. It starts out looking super clean but then the business requirements shift and each has its own edge cases that turn it into a giant mess, often ending up as a mix of both polymorphism and convoluted if statements.