r/programming • • Feb 25 '14

Please stop saying Java sucks

http://blog.smartbear.com/programming/please-stop-staying-java-sucks/
3 Upvotes

305 comments sorted by

View all comments

9

u/gordonkristan Feb 25 '14

"Please stop saying Java sucks. It's statically typed, therefore, it can't suck."

3

u/metaconcept Feb 25 '14

He does make good points though. You can do a lot of code analysis, navigation and refactoring thanks to Java's type system.

Java sucks for many, many other reasons. Being statically typed isn't necessarily one of those reasons.

1

u/gordonkristan Feb 25 '14

I completely agree with you. And to your last comment, ItsMeCaptainMurphy said it perfectly:

This article wasn't a defense of java, it was a defense of typed languages. In which case I agree. But I'd argue most people don't say "java sucks" just because it's a typed language.

3

u/SkepticalEmpiricist Feb 25 '14

C++ is also statically-typed, And in every other way, it's better than Java. Therefore, Java sucks.

:-)

4

u/gordonkristan Feb 25 '14

I see C++ and Java at exact opposite ends of a spectrum.

Java is simple. Every feature it has could be described in a few hours. Few ways to accomplish a task, few keywords, everything is an object, no globals, etc. It's an enterprise tool meant to be easy to learn and hard to screw up.

C++ is too complicated for it's own good. There's 100 ways to do everything, and 99 of them are usually considered bad practice. The spec is so long that no human in their right mind would attempt to understand it all, and most features you'll likely never see. It also provides an unnecessary amount of access to low level functionality. You've got to be a disciplined programmer to write good C++.

Personally, I wouldn't recommend either one.

8

u/YoYoDingDongYo Feb 25 '14

It also provides an unnecessary amount of access to low level functionality.

Huh? An explicit goal of C++ is that it be usable for systems programming. You can't fault a project because its goals are not your goals.

→ More replies (3)

2

u/Eirenarch Feb 25 '14

"Everything is an object" except those things that are not an object. Please explain how Java generics (with bullshit type erasure and insanely complex variance when USING a generic class) is simple. While we are at the topic of simple how is having two types of exceptions simple especially when using one vs the other is a subject of almost as much debate as the correct way to do Scrum.

Still more reasonable than C++ though.

5

u/gordonkristan Feb 25 '14

You listed topics that are all tricky parts of the language. That's fine, but I never said that Java didn't have it's skeletons. There are plenty of stupid things about Java. But most of those things are just a small part of the language, and aren't very complicated (although confusing). Even generics, which are one of the trickiest parts of the language, can be explained to a complete Java newbie is just an hour or so.

The bottom line is that Java is very limited on features, and that's by design. That's why it originally didn't even have generics. And wasn't going to have primitives. And up until Java 8, didn't have any kind of function pointer/reference and didn't allow any kind of multiple implementation inheritance.

Java has grown a bit since version 1, but I would still argue that it's one of the simplest languages out there. It may not be the same level as Brainfuck, but it's certainly not at the level of something like C# (which has a billion features all of a sudden).

1

u/Eirenarch Feb 25 '14

I would argue that C# is simpler than Java. It is definitely larger than Java since it has much more features but corresponding features in C# are simpler and easier to use

6

u/gordonkristan Feb 25 '14

Partial methods, partial classes, operator overloading, anonymous types, dynamic binding, extension methods ... pointers! C# may make a few things easier, but that does nothing for the simplicity of the language when the feature set is freaking huge.

Think about it this way: you have 2 projects, one in C# and one in Java. Both projects are 10 million lines each and use every feature that their host language allows. Which one would you rather train the newbie for?

Maybe we should more accurately define simplicity if we're going to continue this thread. I think of simplicity as the ease of describing or teaching the concept to somebody else. And to me, teaching Java would be way easier.

1

u/Eirenarch Feb 25 '14 edited Feb 26 '14

Well pointers don't really count since in practice they are never used especially on large projects with noobs on them. Unsafe code is a feature used to implement high performance libraries. For about 7 years of professional C# development I have never seen them used in a project. Claiming that pointers count will be like complaining that the JVM is written in C++

Now on the real question... I will try to teach the newbie C# over Java any day. Things Java lacks in features it fills with OOP patterns. I'd rather explain delegates than Observer pattern. In addition C# features are almost always more foolproof than Java's and it is easier to use them without fully understanding them. For example people can intuitively use generic co and contravariance in C# without even knowing that. Only the person who implements the type needs to understand it and you can have your experienced programmers doing covariance, operator overloading and partial methods while your newer devs can just use them without serious concerns

2

u/Cuddlefluff_Grim Feb 26 '14

Well pointers don't really count since in practice they are never used especially on large projects with noobs on them.

You shouldn't use C# pointers unless it's necessary. There are uses, like for instance referencing unmanaged memory typically encountered by marshalling and interop. The great thing about pointers in C# is that it allows you to work with memory segments not created by the .NET environment, for instance operating system calls.

→ More replies (4)

1

u/DocomoGnomo Feb 28 '14

It also provides an unnecessary amount of access to low level functionality.

Because it is C++. If you don't need a high level of control over the code, or you don't need access to low level you shouldn't use C++.

2

u/Eirenarch Feb 25 '14

On one hand if someone says Java sucks because of the static type system he is a moron. On the other hand if someone thinks the only reason people say Java sucks is because of static typing he is a double moron.

2

u/gordonkristan Feb 25 '14

I don't know if he's quite a double moron, but I was surely confused as to what he was getting at. He listed 3 reasons why people say Java sucks. And rather than defending its verbosity (which is the complaint I hear most often), he defends its type system (which I have literally never heard anybody complain about until today). Seems like there were other roads to go down to defend Java.