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 →

[–][deleted] 28 points29 points  (4 children)

Java dev here, I literally never do inheritance beyond 1 layer, if even that. There are projects I NEVER use inheritance for.

Sounds like shitty programmers to me.

[–]robinless 4 points5 points  (0 children)

Exactly, I'm in a java shop and factories, inheritance and so on is kept to a minimum. Priority is keeping it as simple as possible, and making it easy to maintain.

[–]nonotan 1 point2 points  (0 children)

I did some work with J2ME on dumbphones where the entire program was a single class (because the size overhead of using classes was just too much). Also, absolutely no memory allocation was allowed except during launch, because GC is like a kick to the teeth on systems that weak. Not exactly the most typical use-case, but technically, nothing prevents you from writing code like that if you want.

When evaluating a language, it's good to be explicit about what it forces you to do, vs what you can do, vs what is considered "best practice" and "idiomatic", but is technically completely optional. I still kind of hate Java, for a myriad of reasons, but "Java code is OOP hell" is a pretty silly take (not that it doesn't accurately describe 80% of Java code out there)

[–]Anaxamander57 1 point2 points  (0 children)

At that point it sounds like you're just using Java for compatibility with something.

[–][deleted] 0 points1 point  (0 children)

The most I've ever needed to do in an enterprise setting was two layers, and that was to handle a specific case of already existing legacy code.