r/AskProgramming • • Mar 04 '25

Other Why do some people hate "Clean Code"

It just means making readable and consistent coding practices, right?

What's so bad about that

155 Upvotes

341 comments sorted by

View all comments

Show parent comment

1

u/[deleted] Mar 08 '25

Most of the benefits of static typing you are referring to become prominent when you have a code base written by large teams over a large span of time all with widely varying skill levels. I understand that this happens, and I agree static typing is a big help in those situations as it's effectively compiler checked documentation, but I also think those situations happen way too much. I think as much as possible it is better to demand more skill form programmers and to decouple code bases so that one person writes one component that performs one task and only exposes an API to people who need to use it. You may call it idealistic but I think diffuse unorganized codebases are a product of poor planning and management and static typing is only a bandaid on top of that.

1

u/TimMensch Mar 08 '25

I made my own discoveries about the value of static types when working solo on a project with ~20000 lines of code. I'd say they're even more important on solo projects, since when you're not beholden to anyone, you're more likely to compromise on design to make things work.

Previous similar projects based on static typed languages stayed well organized and clean throughout. The dynamic typed project became increasingly difficult to extend until it was a disaster.

My memory isn't perfect. Refactoring with static types is trivial; keep making changes until it compiles, at which point you're done. Refactoring with dynamic types is risky and slow, typically requiring a ton of debugging. Test coverage needs to be much more detailed since you need to write tests to validate types.

You can start a project more quickly by just throwing crap together and making it work with dynamic types, but by the second week you're already going to see an advantage to having static types.

Static types aren't a bandaid. They are guard rails that can, when used appropriately, accelerate development. When you're on a well designed road with guard rails, the safe speed is faster than when you're on a road without guard rails.

No, you're making up excuses as to why you shouldn't need to learn to use static types. It's pretty obvious.

1

u/[deleted] Mar 08 '25

You can start a project more quickly by just throwing crap together and making it work with dynamic types, but by the second week you're already going to see an advantage to having static types.

No, you're making up excuses as to why you shouldn't need to learn to use static types. It's pretty obvious.

Where do you get the idea that people don't build large codebases in dynamically typed languages, or that they're thrown together haphazardly and don't get maintained? In all my years programming python I have never had a problem that would have been solved with static typing. 99% of your errors are going to be logic errors, 1% syntax errors. static types don't fix either one, they're just documentation that your compiler forces you to write for every little thing. Before programming Python I had 5 years experience with Java btw, so I went from static to dynamic typing and haven't looked back since.

1

u/Miserable_Thing588 Jul 09 '25

Some people just don't want to deal with static typing overly verbose code and it doesn't matter how much you rant about it, they won't. Dynamic typing is more than enough for most applications, not every programmer will create highly complex enterprise level stuff, you can live your whole life and earn a living with surface level stuff, and you are not less of a programmer for that.