
Please stop saying Java sucks - Baustin213
http://blog.smartbear.com/programming/please-stop-staying-java-sucks/
======
nobleach
As a language, Java is just that, a very capable language. The JVM is full of
great engineering, and when properly tuned, is a very powerful compile target.

Where things start to suck is what seems to surround Java. Years and years of
XML configs, Maven and Ant processes. Devs whom haven't been allowed to read
about new advances.... I was at a Java user group about a year ago when Venkat
Subramaniam came to speak about functional programming. This was right around
the time when DHH made his assertion about unit testing. Venkat made a joke
like, "and as we learned this week, we no longer need to test our code". No
one got the joke. A room full of at least 200 developers and no one got it...
because they probably spend most of their time in a cubicle thinking that
these new-fangled technologies will die someday, and we can all go back to
writing crap like we did in 1999. (Other fun assertions from that user group
had to do with JSON being horrible and XML being a far better format for web
communication)

It highlighted the problem for me. While Twitter engineers are doing really
cool things with Java, many are mired in these huge monolithic apps that take
hours to build and even longer to deploy. And much of this stuff is stored in
SVN... with no unit tests. It's the culture. They look at front-end developers
with disdain... with their GitHub accounts and Vim/Tmux setups. Java doesn't
suck. The culture that has grown around it does.

~~~
davelnewton
Java _isn 't_ capable, however, of high levels of abstraction without various
surrounding crufts, however. _That_ is why it sucks. It's not simply a matter
of "more lines", it's the additional cognitive overhead reading those lines
demands, and the tooling required to make it suck less.

~~~
bcg1
Did you just call jython, jruby, groovy, and all of the other dynamic JVM
languages cruft?

Or maybe you don't consider them high levels of abstraction... if that's the
case might as well not consider inheritance, interfaces, dynamic proxies,
classloaders, and annotations while we're at it.

~~~
davelnewton
No, I didn't: none of those are Java. They're Jython, JRuby, Groovy, and the
other JVM languages.

We're discussing Java-the-language. Not the JVM. And without various
surrounding crufts you don't have an expressive, dynamic, malleable language
with high levels of abstraction.

Lambdas _help_ , but do not _solve_ , Java's impoverished model of
abstraction.

~~~
bcg1
All of the things I listed are part of the Java language and standard library.

[http://docs.oracle.com/javase/7/docs/api/java/lang/reflect/P...](http://docs.oracle.com/javase/7/docs/api/java/lang/reflect/Proxy.html)

[http://docs.oracle.com/javase/7/docs/api/java/lang/ClassLoad...](http://docs.oracle.com/javase/7/docs/api/java/lang/ClassLoader.html)

[http://docs.oracle.com/javase/7/docs/api/java/lang/annotatio...](http://docs.oracle.com/javase/7/docs/api/java/lang/annotation/Annotation.html)

etc

~~~
davelnewton
I never said it didn't have those things; I'm not sure why you're still
talking about them.

I said Java has an impoverished model of abstraction, and without external
tools (byte-code manipulation, libraries, etc) it still doesn't.

Then you brought up not-Java, which I also didn't talk about. You brought
those up because those _do_ have better models of abstraction than Java does,
which effectively concedes my point.

------
Someone1234
Java is fine. It did lag a little behind there for a few years, but the last
two Java releases have really pulled things together.

I will say C# is still my preferred language just for quality of life reasons,
and I also feel like Java has been largely relegated to either web-backend or
enterprise desktops. There is no practical way to deliver a Java application
to an consumer now, Java Applets are "dead" and running Java on the desktop is
a pain. Minecraft is likely the only reason any non-business user has Java
still installed.

But saying Java is "only" good for web-backend stuff is kind of like saying a
car is "only" good for driving. That's where the majority of new development
currently happens and it has a very bright future. Java on Tomcat delivers
that experience just fine (although C# w/MVC is still my poison, again for
quality of life stuff).

~~~
copperx
Could you explain the "quality of life" bit? Are you saying that if you
programmed in Java life would be hellish?

~~~
Someone1234
This article summarises the differences: [https://msdn.microsoft.com/en-
us/library/ms836794.aspx](https://msdn.microsoft.com/en-
us/library/ms836794.aspx)

Although it is a little out of date in some areas (for both languages).

C# has been stealing from F# for several versions now, so we get all kinds of
nice shorthand for accomplishing sometimes complex operations.

------
killface
Meh, I like Java. Like, I actually enjoy programming in it. Some key reasons:

1\. IDEs are not a crutch. They're a useful tool. Anyone who talks about
expressiveness or efficiency in Ruby but discounts IDE help is a hypocrite.
You learn the tools you have. Refactoring large methods, extracting
interfaces, mass renaming with guaranteed safety -- those things actually
matter when you learn to use them.

2\. Ant is dead. Hibernate is dying. Spring XML config is largely dead. Much
like the perf argument, most of the bad impressions people have of it are
based on years-old issues.

3\. Tools like Spring Boot and Dropwizard have made it so a Java REST service
is smaller than a RoR one.

4\. Gem upgrades can be backwards incompatible, so once your app is of a
certain size, your framework support becomes very rigid and brittle.

5\. Twitter left Ruby because of perf issues. _drops mic_

6\. Active Record ~= Hibernate. Hibernate can be configured with annotations,
so leave the XML out of this. You still have n+1 and over-selection of fields
by default.

7\. Global interpreter lock. 'Nuff said.

8\. The actual argument used by DHH wrt performance was, 'Ruby is fast enough'
\-- if the Java community tried that, it would be an endless mocking parade.

I could go on, but won't. I don't care if others leave Java, just means more
work for me. Hell, replacing shitty rails apps and replacing them with
reasonable java apps is a good consulting business :)

~~~
otterley
> Twitter left Ruby because of perf issues.

That's not completely true. Some parts of the stack were written in Scala,
etc., but to my knowledge, much of the front end is still Ruby.

------
crazy_geek
Hear, hear! Is Java the right tool for everything? No, but for large code
bases, it is miles easier to dive into a codebase, and the tooling is so much
better than anything else I've seen that's not Visual Studio (as much as I'm
not a MS fan, VS is really nice).

Is Java perfect? No, but it gets a whole lot of things not-wrong. More
reasons: [https://drew.thecsillags.com/Why-
Java/](https://drew.thecsillags.com/Why-Java/)

------
serge2k
> AutoCAD is going to be big, Quickbooks is going to be big, FireFox is going
> to be big

1\. you probably aren't writing those. 2\. Even if you are, you probably
aren't writing them in Java.

The problem is the reason why you have to write so many lines in Java.
Annoying checked exceptions, lack of expressiveness, boilerplate.

Strong type checking? great. prevents whole swaths of errors.

> Move code around, change signatures, add a function to an interface, and I
> know nothing is broken. Python can’t.

True, now how painful is it without the IDE?

> It’s true that in Java you tend to have lots of filler code

right and that sucks. The reason that few lines of code is nice isn't just the
chances of bugs occuring. It's also nice because it means that I can pack in
logic into a smaller, more readable, space. All that other stuff in java
doesn't really do much of anything, it is just there (mandatory javadoc on a
method called boolean isFooFrobulated(Foo foo), yay so useful!). It means I
have to write it, have to maintain it, have to read through it when looking
for a bug.

Consider how many java haters actually like C#. It just adds in better tooling
to reduce the amount of stupid boilerplate code you have to write. It adds a
nice layer of sugar on top that makes things far more pleasant.

~~~
altcognito
> 1\. you probably aren't writing those. 2. Even if you are, you probably
> aren't writing them in Java.

You probably also don't have teams as big as Autodesk or Quicken, therefore
you'd better have a language that helps prevent breakages. Java is a good
match for that.

> True, now how painful is it without the IDE?

Why would you do that? Because you like working without good tools? Text
editing is but a very tiny aspect of software development.

------
matt_s
Funny how people get riled up over stuff like this. The article is from 6
years ago and you still hear the same comments like "the _____ sucks but the
____ is fine" (ecosystem|language,types|jvm etc.)

The only way to have a healthy debate about a language is to have context: if
you are building an integration between a custom app with a RDBMS that has to
send data to an ERP system in XML, and there are specs with interfacing the
ERP in Java, C#, C++ are you going to argue that Haskell or Lisp is better?

If you have to put a simple web application together quickly as a working
prototype are you going to choose Ruby/Rails, Perl, Java/JSP, etc.? It
probably doesn't matter technically but does matter when it comes to the
experience of the people building it.

Just debating languages against each other in some sort of "cage match" is
sort of ridiculous.

------
JackMorgan
I think when I've heard people saying Java sucks, they mean its type system
allows defects that the type system of F# or Scala can prevent. Those reasons
given for Java being better than Python or Ruby are also why F# is better than
Java.

~~~
SamReidHughes
It's a lot more than that. For example, it's really annoying to define new
types in Java.

~~~
AnimalMuppet
Could you be more specific? _How_ is it really annoying to define new types in
Java?

~~~
SamReidHughes
You have to manually define its constructor, manually provide getters if you
want the value to be immutable, put each class in a separate file (or
namespaced inside another class), and if your type has finitely many
alternatives you have to set up the whole visitor pattern thing. Compare that
with C#'s properties and readonly, Scala's case classes, Swift's enum types.

~~~
bcg1
Making immutable structures in Java truly does suck... this is the most valid
complaint that I've heard in a long time about the language.

It would be extremely easy to implement properties as syntactic sugar in the
language or via built-in annotations without changing the class file spec at
all.

------
jrmenon
Disclaimer: I come from C++ and PHP world, but in the last few years, have
been working in Java after a long gap.

So here are the pros and cons of Java I see (not comprehensive but somethings
that I tend to care about):

Pros:

1) The strongly typed features does help in finding potential bugs during
compile time.

2) The Generics and Container frameworks seems fairly sane when compared to
the complexity of C++ templates.

3) Concurrency features are nicely standardized now - Executor framework,
concurrent container frameworks and so on.

4) In short, 'stock java' (without all the heavy-weight frameworks) seem nice
comfortable and sane to work with.

Cons:

1) Fairly large and legacy XML-driven frameworks like Spring and Hibernate is
a huge time-sink to figure out all their intricacies, not to mention very hard
to debug things esp. when some 'business logic' resides in these mysterious
XML incantations.

2) While not really a Java problem, but due to these humongous frameworks,
there is a tendency to build giant war files with code and configs all bundled
together. Need to make a config change? Check it in some xml file, and then
build to deploy wars/jars. It takes some work to separate code from configs,
and convincing traditional Java engineers to move away from this model - i.e.
check configs separately, deploy them independently, restart servers etc..
without any need to build and deploy process.

3) Legacy app-server based architectures where there is apache in the front
with IPC overheads to a Java app-server.

The way I get around some of the cons is to convince the engineers to
sparingly use the frameworks (just enough to get some basic routing rules to
map urls to controller entry points in the MVC setups), use more lightweight
servers like Jetty (directly listening on socket ports), esp. when it is just
handling some API requests, and sticking with JSON as the payload format.

It is been a challenge but I have had success in using Java in very limited
ways, and decoupling it from serving web (jsp) pages and so on.

------
TheLoneWolfling
The biggest problem I have with Java is that it is handhold-y in _ineffective_
ways.

It doesn't have automatic getters and setters, because they obscure the code
that runs. Except that in practice _everything_ ends up with getters and
setters precisely because it means it can obscure the code that runs - namely,
so you can add behavior without having to change the public interface. Which
means in practice it's just more boilerplate and more opportunity for typos.

Ditto with operator overloading, interfaces, default arguments, multiple
inheritance, dynamic types...

------
cryptos
I have the feeling that the "Java sucks" outcries are not so loud anymore.
Java improved significantly over the last few years, the frameworks are better
and more lightweight these days (compare Java EE 7 with J2EE ...). And Java
has probably the best tooling available. Plus there are some migration stories
of companies moving away from Ruby, Python or other scripting languages.

So, all in all Java is a fine technology and you can use the solid foundation
with more convenient and concise languages like Scala and Kotlin.

------
peterashford
The reality is that if Java was a useless language, it wouldn't be the most
used programming language in the world. It's not the right tool for every task
but more people in the world find it the right tool for their job than any
other language. There's a reason for that and it's not that a now defunct
company funded its development decades ago.

------
deedubaya
Java sucks.

But seriously, every language has its pros and cons. Java is a powerful, fast
language, but verbose and often wielded like a hammer IMHO.

~~~
davelnewton
I'm curious how you mean "powerful" here.

------
skuunk1
Aren't Android apps written in Java?

~~~
lgas
Yes. Why?

~~~
skuunk1
I am wondering then why people think Java is only good for old school
enterprise apps (according to the comments).

