Live data from Hacker News

Please stop saying Java sucks

blog.smartbear.com

21–30 of 38 posts

Re: Please stop saying Java sucks

#21
post #8

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 abo…

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.

That is exactly the singular reason I don't pay attention to DHH's brain farts. I guess you got me.

Re: Please stop saying Java sucks

#22
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.

Re: Please stop saying Java sucks

#23
post #18

> 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 signat…

> 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.

Re: Please stop saying Java sucks

#24
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 :)

Re: Please stop saying Java sucks

#25

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. H…

> 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.

Re: Please stop saying Java sucks

#28
post #8

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 abo…

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.

>Java isn't capable, however, of high levels of abstraction without various surrounding crufts, however.

Well, Go is even worse in this regard, and yet people jump all over it.

Re: Please stop saying Java sucks

#29
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...

Re: Please stop saying Java sucks

#30
post #10

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…

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

Off the top of my head:

* A half-decent type system

* No half-baked primitive / object distinction

* The `as` operator

* Various operators related to null

* Ability to distinguish if something is nullable or not, and to have nullable and non-null references

* The `checked` keyword

* Operator overloading

* Properties

* Syntactic sugar w.r.t. getters and setters

* out & ref parameters

* struct support

* unsigned values

All of these things are major pain points in Java. Some of them can be overcome by running external tools, some of the time. Hopefully.

Post reply on HN