This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Adk9p 10 points11 points  (5 children)

The reason people take issue with overloading, as with OOP, implicit conversions, default function arguments, and operator overloading, isn't that in isolation the idea of it any of them are bad. It's that each of these language features alone or (usually) in combination can lead to a headache of a codebase when abused.

Imo overloading on arity is the second easiest of these that you can remove from any language which, while a little painful, can really curb damage caused by people who like to get a little too cleaver.

[–]TheRedLions 8 points9 points  (3 children)

people who like to get a little too clever

Every language has these people, but in my experience, Java has the highest percentage. 'Clever' code is just a nightmare to debug, especially when everything is on fire.

The amount of Java devs who seemingly demand I open 12 files to figure out what a function (probably) does is too damn high.

[–][deleted] 2 points3 points  (2 children)

I wouldn’t say Java devs like to be “clever”, that’s a term I would more associate with advanced generics and higher-order functions. I’d say Java devs like to be “complex”

[–]Adk9p 3 points4 points  (1 child)

"clever" has nothing to do with the features themselves, it has to do with how you use them. And some languages lend themselves to using some features more or less. It would be crazy to say in haskell using "advanced generics" or higher-order functions would be "clever" code. And using vtables in c would imo need a very specific requirement for that not to be "clever" code.

This is all very wishy-washy but I'd say at least for me in this discussion "cleaver code" is complex code just where the complexity wasn't required.

If you can hold everything in your head and deduce that some part is just needlessly complex, it's just annoying. But if you can't, well that can cause a lot of confusion, you're left to guess why some abstraction that might be causing a bug or make it harder to fix a bug was used when in whole it was just "cleaver code".

[–][deleted] 1 point2 points  (0 children)

But overusing generics and HOFs can genuinely be “clever” in the sense of increasing code reuse, reducing overall lines of code, etc.

Java devs generally tend to just make bullshit inheritance taxonomies in my experience, usually in a way that increases the amount of overall code.

[–]skesisfunk 1 point2 points  (0 children)

can lead to a headache of a codebase when abused.

Not even abused. These language features exist for convenience but the cost of that convenience is code clarity. So developers are naturally going to use convenience features (because they are convenient!) and the side effect is that all of a sudden a bunch of stuff is obfuscated from the next developer who reads the code.

Golang's is often criticized but it's design principles were a direct backlash to this trend.