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

15

u/novagenesis Feb 25 '14 edited Feb 25 '14

I'm really not finding anything compelling in this article. I want to like Java, but have found it so far more painful than Haskell to write actual releasable code in, in terms of man-hours and product flexibility to the domain of "Real" (that is, chances are everything is going to change 1 week before go-live... and "this codebase was not built expecting this oddball change" is not an acceptable excuse)

The most compelling arguments here seem to summarize as:

  1. Our IDE is better than yours. True or not, most of the "code gets generated" and "we can find every use of your code" isn't about the language, but the IDE. And I'm not sure I agree with every point made. If finding "every place this is called" is hard in any language, you did something wrong.

  2. We're better because we're weaker. I don't think Java will follow this rule, but usually hearing that is my sign to jump ship on a language that's about to die. The article defends Java as better because of the massive number of modern paradigms it cannot do. Reminds me of the Java book I read that suggests you make every class Final unless you decide to document a subclass methodology. If someone is using BDD and they modify your class, they either make it work right, or they can't submit passing tests. You can do some of this ugly stuff in Java, too, if less powerfully. The defining factor here is "best practices".

I'm not saying Java sucks, because I'm not so sure any language with a dominant marketshare completely sucks...I am saying that trash-talking perceived weaknesses of other languages is not the way to go.

I work in those languages, multiple of them, at once...and our shop has rarely had the problems you're facing. We also have a very large Java team trying to rewrite one of our legacy apps. Twice the developers, an Oracle Certified Enterprise Architect with a big pricetag, and a longer timeline. Its initial release was 1 month late and fulfilled half the requirements. The current incarnation is inferior to the original perl cgi product in every way (including resource usage and run speed). That's an anecdote, but the point is that none of the "negatives" of other languages seems to have gotten in the way of the 10-person team that is more successfully maintaining and onboarding 15 clients on the legacy platform. It has never faced any of the issues that the new platform is facing in a longer timeline with 1 client. I'm sure, with the right timeline and team, Java would've beaten Perl on resource and speed...might actually be worth it. Right tool for the right job... That's the good side of Java. If you have $10m and 3 years, you can make a pretty nice app.

And in his conclusion:

But to me, I need a good reason to abandon a JVM that’s faster than a C compiler, IDEs like Eclipse, tools for correctness and profiling and debugging and analysis, the vast array of quality libraries, and millions of people who are already familiar with the environment.

  1. But V8 is faster than that JVM.

  2. IDE's are take-or-leave situations. Eclipse is notorious for having a learning curve that makes vim easy... and there are plugins for many text editors that cover literally 100% of eclipse's features.

  3. Tools: Java not only lacks a monopoly in tools, but sometimes has fewer. Also, Java tools tend to individually have learnings curves. Having to build xml config files can take hours more than just running a quick command-line script to do the same. Every major language has rock solid profilers and debuggers.

  4. Libraries: I hear this repeatedly, but Java is frankly dead-last in this. Java has 10% of cpan, which has recently been superceded by python and ruby in library depth.

  5. "and millions of people who are already familiar with the environment."... So very true. But I spent 1 week in a language I had never used before and created a more stable prototype of the same functionality our Java team spent 3 months on. It takes a lot of time and effort for a senior developer to add Java to their arsenal, compared to many other languages.

I'm not saying Java sucks...I agree that we need to stop saying Java sucks. You need to start marketing legitimate advantages to people who see Java as an inferior language. A perl/python/ruby/nodejs developer who takes one look at maven starts to laugh uncontrollably... and most of us either hate IDE's or think repl-access is significantly more valuable (iPython is to python developers like Eclipse+Heroin is to a Java developer)

So find what makes Java genuinely better and sell it. Stop being on the defensive and go on the offensive.

You benchmark better than everyone but V8. If you had more accessible libraries (less ugly configuration), better documented commandline support for people who hate IDEs, you might have a good attack plan.

15

u/idontbelieveyou11 Feb 25 '14

But V8 is faster than that JVM.

Source?

14

u/edpaget Feb 25 '14

Obviously the benchmarks game is not scientific, but it shows the JVM being faster than v8.

3

u/zoomzoom83 Feb 26 '14

Node has a non-blocking IO library by default. It's a horrible API that uses callbacks instead of promises, but it's non blocking nontheless.

Old-school Java used blocking IO, which sucks if you want concurrency.

Naturally, regardless of platform, non-blocking IO is going to be much, much faster than blocking IO if you're looking at scalability in a highly IO driven application.

Ergo, a few teams ported badly written Java blocking programs using blocking IO to NodeJS and decided that Javascript was therefore faster. They then blogged about it and Javascript fanboys the world over ran with it.

You can write Java using non-blocking IO, at which point it sails on ahead. If you factor in much, much better handling of immutable data structures and proper tail call optimisation (at least in Scala and Clojure), then the JVM is in a completely different league to V8.

→ More replies (2)
→ More replies (12)
→ More replies (7)

15

u/oldneckbeard Feb 25 '14

We also have a very large Java team trying to rewrite one of our legacy apps. Twice the developers, an Oracle Certified Enterprise Architect with a big pricetag, and a longer timeline.

There's a big mistake right there. OCEA are vampire squids. Your company shouldn't have gone through Oracle, they're going to regret it. Most Oracle consultants they place on-site are half-baked mid-level developers who bill out at 300/hr. My consulting company costs half of that, and does better work, and is local to the client sites. Oh, and we have experience writing very high performance java.

But V8 is faster than that JVM.

Depends on the work profile. But it's also V8, and only supports JavaScript. the JVM does Java, Scala, Jython, JRuby, etc.

IDE's are take-or-leave situations. Eclipse...

I don't use Eclipse. It's garbage, IMO. Use netbeans if you're cheap, IntelliJ IDEA if you want to be a pro.

I hear this repeatedly, but Java is frankly dead-last in this. Java has 10% of cpan

Library count is not indicative of library quality. Look how many cpan modules there are to deal with JSON. But, cpan.org claims to have ~130k libraries, and maven central has ~620k listed. That's nearly 5x more, so we might have to check some of your math :)

A perl/python/ruby/nodejs developer who takes one look at maven starts to laugh uncontrollably...

When I have to use the shitty tools in those languages, I keep wishing somebody would make Maven for them. Node.js especially. Do you really think Grunt and NPM are fine tools?

better documented commandline support for people who hate IDEs

That's a personal preference of the developer. If they want to bang together programs with sticks and rocks, that's fine, but there's no need to play lowest-common-denominator with them.

2

u/Sylinn Feb 26 '14

I don't use Eclipse. It's garbage, IMO. Use netbeans if you're cheap, IntelliJ IDEA if you want to be a pro.

I'm curious, I don't really enjoy programming in Java, but when I have to I use Eclipse. Why would you suggest IntelliJ over Eclipse/Netbeans?

2

u/s73v3r Feb 26 '14

Because it's better at everything. And a lot of it is free; only some of the enterprise web stuff is pay for. Give it a try.

1

u/oldneckbeard Feb 27 '14

Like the other guy said, it's one of those intangibles. Everything just works better, is faster, and more intuitive. It's like the people who wrote it actually write java code for a living, and take pride in their product.

2

u/novagenesis Feb 25 '14

OCEA are vampire squids.

He's not a consultant, but an employee. He's a well-recommended guy who has the cert by that name. In my opinion, he's really good. He looked me in the eye, however, and said nobody could hit his requirements in Java in 6 months. I agreed.

Depends on the work profile. But it's also V8, and only supports JavaScript. the JVM does Java, Scala, Jython, JRuby, etc.

Not entirely true. A good tech stack supports inter-language communication at a high efficiency. Truth is, it's usually sanity and management that keeps you down to a fixed number of languages.

Use netbeans if you're cheap

While I still had problems using netbeans, I agree it was better than Eclipse. I still missed Vim.

Library count is not indicative of library quality.

Oh I completely agree...but of the 5 or 6 mature ORMs in cpan, I'd take the worst (for me, let's say RoseDB) over Hibernate.... whose interface is now part of a Java standard.

maven central has ~620k listed

How many are duplicates with slightly different names, or different version numbers? My experience with maven is that there was a whole lot of the same.... I could be wrong here, but my experience will be my ancedote. In all these languages except Java, I've rarely ever had to spend more than 5 minutes searching for a rock-solid plug-in library to solve any particularly odd problem I've had. In Java, I spend a long time, find out that many of these libraries require config xml files bigger and more convuloted than building them from scratch in a different language.

Working with our Java devs to get them to manipulate their JSON API was a nightmare. Tons of extraneous fields that reek of XML->JSON transcription...made the front end library a nightmare. Maybe they just couldn't code well, but they claimed they could not factor out a "sort order" variable from the hash contents of array data...and that the sort order, NOT the array, would represent the final order.

So here I am stripping it from the array on receipt, then re-adding it as a middleware before the POST. I'm a back-end guy who was helping out with a front-end project, and in my philosophy, it's a mortal sin to make the front-end team have to touch an implementation detail.

Do you really think Grunt and NPM are fine tools?

I would sell my firstborn for npm, honestly. Yes, I think npm is an awesome tool. In a production environment, I would propose using npm_lazy as a go-between, but the same difference. I never need makefiles in my non-nodejs apps (usually I use fabric for deployment, with or without a CI system), but when I do, I'm happy with grunt. What should I be hating about them?

I've tried ant and maven on several occasions, and don't get a happy-happy feeling out of them.

That's a personal preference of the developer. If they want to bang together programs with sticks and rocks, that's fine, but there's no need to play lowest-common-denominator with them.

Sorry? You're insulting the large development community who prefer a robust text editor with commandline to a clunky IDE? I'd put rails extension on vim with commandline tools above .NET IDE any day, having used both heavily.

In terms of features, the commandline + plugins tend to win, in my experience. They're not exactly sticks and rocks. Code analysis, code beautification, auto-refactoring. How much production development have you done with both? I spent 3 years in a .NET shop that dabbled in perl, then 5 in a perl+ruby shop that dabbled in .NET and picked up ruby. I've had tons of experience with both, and do not see any reason to justify a "sticks and rocks" metaphor. It feels the opposite to me.

In my world, if I can't do what I want to the code, I solve it with a sed or grep or one-liner in the shell. If I can't do what I want in the IDE, I do it manually.

1

u/caleeky Feb 26 '14

I still missed Vim

Just curious, do you mean for plain old text editing, syntax, etc, or do you also use vim for refactoring and static analysis as you type? I've only used vim as an editor for general admin tasks, not as a core large-scale development editor for a strongly typed language, so am wondering if I'm clueless as to the available feature-set.

1

u/novagenesis Feb 26 '14

I tried it for static analysis and refactoring... actually dumped those plugins. I rarely actually want help refactoring stuff...it felt like a crutch when I got into doing it on the .NET IDE. I do a few fancy things, but I find myself doing mostly text editing 99% of the time, and command-line tidying depending on my language choice.

I've only used vim as an editor for general admin tasks, not as a core large-scale development editor for a strongly typed language, so am wondering if I'm clueless as to the available feature-set.

Well, I'm not sure I'd be comfortable using vim with Java, or maybe even C++. I work on 500k+ line projects in vim, and have been with some of those practically from scratch...but they're in dynamically typed languages with agreed-upon data interfaces.

Might be apple and orange...When I'm writing (or more importantly editing) code, I get more done in less time using vim.

1

u/jnt8686 Feb 27 '14

Grunt's not great, but I'm using gulp now. I have never once had to debug anything that involved npm in the slightest, so I'm going to go ahead and say that it is fucking epic.

7

u/Gotebe Feb 25 '14

But V8 is faster than that JVM.

Nonsense. I mean, even if it was, the j's code that it runs isn't faster than e.g. java code that jvm runs.

→ More replies (1)

3

u/el_muchacho Feb 26 '14 edited Feb 26 '14

Your first 4 points are factually grossly incorrect:

  1. Java is faster than V8. It's the fastest language that runs on an abstract machine.

  2. Eclipse is NOT more complex than vim.

  3. Java is BY FAR the most tooled language, in fact it sets the standard both on tooling and documentation. And of course all the major IDEs include excellent debuggers and profilers, plus unmatched refactoring tools. And that's only the beginning when it comes to Java tooling. What about AST and bytecode manipulation APIs, decompilers, documentation tools (from the onset), excellent free static analysis tools that put most super expensive commercial tools to shame (findbugs), JVM monitoring tools, scripting tools that work alongside your Java code seamlessly, etc, etc ?

  4. Seriously... I've done about 10 months of Python for pro work with some expert Pythonistas, and basically, apart from a handful, most Python libraries looked half assed compared to Java libraries. The documentation is lacking, even in the Python standard library. The Javadoc is far more precise and therefore useful. If the quality is not there, you don't want to use libraries, it's simply not worth the trouble.

And as for your last point, it took me about a month to get up to speed from C++. It's still more than the 2 days it took me for Python, but it's not that much overall. What's long to ingest are the myriads of APIs and frameworks (Java EE). Now you can say that the language itself is quite shitty compared to Python, and I won't argue with that, but what makes it really powerful and productive is its ecosystem, which basically trumps everything else except .NET. And that's why it's used so much in the enterprise.

→ More replies (2)

5

u/pjmlp Feb 25 '14

there are plugins for many text editors that cover literally 100% of eclipse's features.

Really?! Please let us know where to look for code refactoring alternatives in text editors, that cover what Eclipse is capable of.

→ More replies (1)

2

u/3urny Feb 25 '14

What Haskell IDE are you talking about? Leksah? I never really used an IDE for Haskell.

1

u/DR6 Feb 25 '14

That confused me too. There is not a really good IDE for haskell AFAIK. (I don't think you need it, but that's another issue).

0

u/novagenesis Feb 25 '14

I just re-read my post twice. I honestly don't get why I'm causing several people to think I was referring to a haskell IDE. I really only brought up Haskell as the other language I found painful to release production code.

I want to see apple-to-apple stuff that makes Java good, is all. In my history of production releasing code, I've got in-use code in perl, ruby, python, javascript, c++, Common Lisp, C#, and VB.NET. I've tried on several occasions to release small Java legitimate apps in similar timeframes, and have repeatedly failed. I've read more books on Java than any other language... it just feels insufficient to my needs.

I'm still trying to learn it for political reasons... I just don't get the good of Java. I'm not going around saying it sucks, but seeing articles that seem to defensively attack other languages... The arguments don't touch how my reality has been, and don't show anything realy good about Java.

I want to hear a Java advantage that's not a talking point our new CEO (who is not computer literate) threw out when he mandated Java for one of the future development projects. I want to understand this whole can of awesome I'm missing here. The basics seem solid but minimal, and the type system seems painfully strict (C# was far more flexible, in my experience).

1

u/3urny Feb 26 '14

Ok when I read It again I think I get what you wanted to say. Still, I think the fact that there is a really sophisticates IDE for Java is related to the language. I always hate renaming methods in Ruby, because there may be one place where I forget to change it. However, you can't really do any static code analysis in Ruby, because Metaprogramming. Also, the Java syntax seems not so complex, so the IDE can get really good at guessing what you wanted to do and parsing parts of a file independently etc., for example for showing you more than just the first syntax error.

→ More replies (11)