Hacker News new | ask | show | jobs
by felipemnoa 5434 days ago
>>No, it doesn't. If you can't write concise Java, you're doing something wrong. And if you can't read code well, go practice some more.

Don't know why you are getting down voted. Even Joel Spolsky says that what really makes the difference is the programmer, not the language. If you suck in Java you will probably suck in other languages.

2 comments

Then why did he wrote his own language for his product? Oh right, because languages do matter.

Sure, what makes one a great programmer is language independent, but that doesn't mean you can have the same code quality in every language. There's a reason why professionals in every field buy top quality tools and not cheap disposable crap.

>>There's a reason why professionals in every field buy top quality tools and not cheap disposable crap.

Agree But Java is not cheap disposable crap. At this point it is more a matter of taste. You don't like Java fine, but other people are able to be just as productive as you using Java and probably more depending on the programmer itself. At the end of the day it is the programmer that makes the difference.

I would strongly contest the assertion that there is someone of equivalent programming aptitude and experience who will be as productive in Java as I would be in Scala or Clojure or C#.

Boilerplate kills. It kills again when you have to go back and try to re-read code slathered in it.

I know why he gets downvoted: There's a lot of kids on hacker news that only use ruby and/or javascript and they really don't want to hear about them being bad at something. hell they wrote a WEB APPLICATION. Now ain't that something.
That's just foolish. I write Java daily for a very large web company, and I downvoted him. Because his claim is nonsensical. I downvoted you too, because your claim is trollish and wrong.

I have been writing Java since I was 13. I am 23 now. I have been paid for code written in C#, Java, JavaScript, PHP, F#, and Python. My personal projects are written in Scala, C#, C++, and JavaScript. I emphatically do not use Ruby for personal or professional projects (unless forced, with regards to the latter). From this reasonably broad body of experience, I am quite certain that I would be vastly more productive if the language wasn't consistently getting in my way. As it is, I have an unhealthy number of vim macros to deal with all the boilerplate that Java foists upon a developer. It is insufficiently expressive without them, and once those macros are applied the resultant boilerplate code (method objects, for example) greatly decrease readability and increase potential failures, due to more difficulty in conceptualizing and reviewing the code.

His posts also belie a lack of perspective. He doesn't "write with anyone else," yet I would venture to guess that the primary use case of Java, today, is in environments with more than one developer. He doesn't "use 3rd party libs", which suggests a lack of familiarity with his own ecosystem of tools, let alone those that provide these features that others (including myself) have indicated are part of what makes Java unpleasant to use. (Seriously--if you're not using Apache Commons at the very least, there is a credible argument that you're probably reinventing wheels and Doing It Wrong.) And he has a critical lack of perspective about what are generally considered basic programming constructs: if you think closures and first-class functions exist to "make some developers happy," you are ignorant of why they exist in the first place. Do you think that now-very-standard tools like map, fold, etc. would be generally adopted if the only way to use them was Java-boilerplate code-vomit?

.

pivo said it nicely upthread: "I'm tired of visually parsing 20 lines of a Java method and filtering out all the boilerplate iteration junk just to find the one or two lines that actually do something. Often this kind of thing can be reduced to a few simple, relevant lines when you have closures, for example." And he is right. Because this is what Java makes you do. In 2011, it has been surpassed in terms of flexibility, expressiveness, and utility by other JVM languages that allow you to pull in Java objects and work with them, but write your code in a way that is much more pleasant.

.

But no--clearly we're all kids, writing Ruby and JavaScript. Except that this kid almost certainly writes more, better Java than you do, and still finds it a regular source of frustration simply because it isn't good enough.

Perhaps you should be less upset when people demonstrate that you are lacking in perspective about your favorite toys.

As it is, I have an unhealthy number of vim macros to deal with all the boilerplate that Java foists upon a developer.

I hate to bring up the editor wars thang, but knowing a lot of very skilled people in the Java world, I will say this: it's rare for a "best in class" Java developer to use anything but a full fledged Java IDE (not unheard of, but rare). If you're not using one of these (IntelliJ, Eclipse, or Netbeans, in my personal order of preference), you're really missing out on almost everything good that Java has to offer over other languages, as far as boilerplate-simplifying, integration, and bug-hunting. IMO, unless you're using a good Java IDE and have used it long enough to know it well, you are not actually coding Java, you're coding some shitty worst-of-all-worlds version of Java, and it's no surprise that you hate it. I don't know how I could possibly code Java and remain sane without the ten-times-a-minute ctrl-space auto-complete/lookup routine (along with all the other time saving macros and shortcuts that a good IDE will give you)...

FWIW, I say this as a die-hard emacs user (bite me, vim :) ) that uses it for damn near every "I have to edit some text" task that he comes across, so this is not an issue of me not understanding what a good text editor is capable of. Ruby, JS, PHP, Clojure, Python, and the like are in emacs territory for me, but when it comes to Java, the tools really do counteract many of the language's failures (and let's be honest, the number one offender is the lack of closures, with the annoyingly explicit static typing coming a close second), and I'll be honest, I miss the IDE features when I code dynamic languages - it sucks to have to resort to textual searches instead of actually walking the parse tree, even if it can get you 80% of the way there most of the time.

Honestly, I've always personally thought that AS3 had a lot of potential, as a mostly-statically-typed-but-dynamic-if-you-need-it version of Javascript, but even there the IDEs aren't quite up to the Java standard (mostly due to apathy, as far as I can tell, there's nothing about the language that would make any of the features common to Java IDEs any more difficult to implement in AS3 ones), so the benefits of the default static typing are somewhat muted...

Sorry, I should have been more specific--I use Eclim to bring gvim inside the Eclipse environment, or I use Netbeans with a set of macros that parallel my vim ones. I find the built-in "boilerplate simplification" nonsense to be a patch over the fact that Java itself is no better than mediocre, and should not be considered a valid defense of Java as a tool.

And the reason? Because even with all these tools that have grown up around Java to address its shortcomings, it completely sucks. Absolutely sucks. Miserable to write and--more importantly--miserable to read. Meanwhile, I can comfortably write idiomatic Scala in Netbeans (the Eclipse plugin is shaky) with the editor's only help being Intellisense, idiomatic Scala that another programmer can read easily without trouble, because the language is geared toward actually being descriptive rather than covered in boilerplate.

And Scala is not a dynamically typed language, but shows that a static language can actually act very similarly to one. And you still get all those features that you miss. It's sort of what you're talking about re: AS3, but it's here now and works.

.

I wasn't joking earlier when I said that the best Java "tool" is a Scala compiler. It's not perfect (hello, long compile times), but I can do anything that I do in Java faster and with more readable and therefore reliable code in Scala. The reverse is not true, because to get around Java's inherent lack of expressivity you are forced to create new points of failure for yourself.

That's not good. It's not necessary. But it's defended to the death by people who--not you, but some of the other posters on this thread--really do truly think in Blub and don't understand why these things are bad.

> I have been writing Java since I was 13. I am 23 now. I have been paid for code written in C#, Java, JavaScript, PHP, F#, and Python.

Woah! You're 23? I bow down to your knowledge and wisdom ;) (I started programming before you were born).

> I am quite certain that I would be vastly more productive if the language wasn't consistently getting in my way

Again, then you're doing something seriously wrong. If you're spending more than 25% of your time typing out code, you're doing something very very wrong.

If your bottleneck is the language, there's something seriously fucked up with the way you program. As a programmer you should be primarily using your brain, to solve problems. Then you take a few minutes to splurge that all out by pressing some keys on a computer.

Yes, you started writing Blub before I was born. Good for you. It's very unfortunate that you haven't progressed past that point.

That you have openly admitted that you do not understand the productivity and code quality benefits of closures, etc. is so very much not my problem. Massive switch statements and needless object subclassing to get around Java's inefficiencies--be my guest. Enjoy your spaghetti.

I have demonstrated, to my own satisfaction and really that's all I give a damn about, that I am considerably more productive using Scala (you do know what Scala is, right?) on the JVM, consuming Java libraries, than I am Java. The language is a roadblock, regardless of how your 90's sensibilities feel about the issue.

(Seriously, whoever decided a function object pattern was a suitable alternative to a delegate or closure should be barred from programming, ever again.)

That's great that you've discovered you're less productive in Java than Scala. Hopefully you can improve that deficiency in your programming at some point.
You are basically saying that people cannot write good code in Java. You are generalizing and that makes you sound like and troll even though I know that is not your intention. You can write good or bad code in Java. I personally have never really had an issue with Java so I don't really understand the hate.

Yes, there are sucky frameworks out there but you do know that you don't have to use them? Either I'm writing really simple code that Java never gets in the way, Java is not really a problem, or I'm a super programmer. I don't think I writing simple code, I don't think I'm a super programming, so it has to be that Java is not really a problem for me. And I write similar code in Objective-C, C++/C, JavaScript and even had to write a lot of code in VBA. Had even to write code in PL-SQL several years ago.

Every language has its own nuances, you just find the best way to work with them, ignore the junk, and adapt. Which is why I really don't get where all this hate is coming from. You never hear this for C++ and it can also be a pain in the ass but you do hear it for Java.

Is almost like it is cool to hate on Java.

You know, I was thinking the same about Java. That's when I posted this question. http://news.ycombinator.com/item?id=2094274 ; It got front page, and one (that's 1) pointer to good Java code.

For whatever reason, whether it is merit or culture, Java programmers tend to write horrible code. I'm sure there's some nice Java code out there, that is not 20 times longer than it should be. But I have not yet seen evidence, even though I've been searching for it for a while.

You can certainly write good code in Java. Totally doable, never said it wasn't. But I'd agree with you that Java programmers tend to write horrible code.

I linked the essay by pg (which I'm sure our upset friends did not read) that suggests a decent reason why: I tend to find that in the Java world there's a lack of awareness of the proper (and I do mean proper) way of writing a lot of more advanced, more indirected code. (This is the "thinking in Blub" you see from pg or Joel Spolsky.) I have a hunch that this lack of higher-level awareness results in weird kluges and hacks that don't even really match the "canonical" design patterns and idioms of what you or I might call "good" Java.

I feel pretty confident in saying that people who are fully comfortable with a more expressive tool (C#, Scala, even dynamic languages like Python or JavaScript) will write better Java than someone who is inculcated into Java first and Java only. It's easy, if unpleasant, to move "down" the continuum that pg references--it's not so easy to move "up", especially when you don't see a reason to (as these posters clearly demonstrate that they do not).

>> You are basically saying that people cannot write good code in Java.

Wrong. I would not say that, because I do it. I am saying that it is vastly more difficult than it needs to be to write good code in Java because it is insufficiently expressive.

I will say that I am suspicious of the ability to write good code of people to whom Java is not a poor development choice, because I suspect brain damage, but a decent programmer can write fine Java. It just sucks to do it.

.

>> You are generalizing and that makes you sound like and troll even though I know that is not your intention.

I am doing no such thing. You are misunderstanding me, but it's pretty clear from the upvotes that you're the only one.

.

>> I personally have never really had an issue with Java so I don't really understand the hate.

It is likely because you think in Blub. Read pg's article regarding Blub, Beating the Averages:

http://www.paulgraham.com/avg.html

He makes the contention that Lisp is at the apex of the pyramid of software development tools. I disagree, for a number of reasons, but the contention of the article is correct at its core: once you have the perspective of a decent set of other tools, you realize that regardless of your tools of choice, Blub languages rank very low on the scale of expressivity--and thus, in power and ease-of-use. (And everyone should learn Lisp, anyway. Even if they don't write code in it. I think in Lisp when writing Java, and aside from Java's miserable boilerplate, my Lisp-in-Java is better than your average Java programmer's Java-in-Java.)

And I would submit that Java is one of the most Blub languages in common use. You have no basis for understanding why others would have an issue, because you are looking up the continuum without insight into what is above.

.

>> Yes, there are sucky frameworks out there but you do know that you don't have to use them?

Meaningless statement. At my current employer, we are forced to use a legacy servlet infrastructure, but my own Java (and Scala) code uses Play! and other frameworks and libraries that at least attempt, if not always successfully, to drag Java reluctantly into some semblance of modernity.

Writing Java still sucks.

.

>> Either I'm writing really simple code that Java never gets in the way, Java is not really a problem, or I'm a super programmer.

Or you are insufficiently experienced with better tools to be able to reliably determine whether it is done better elsewhere. One who does not know any better may be happy with Blub, but one who has used better is not. This seems eminently straightforward.

.

>> And I write similar code in Objective-C, C++/C, JavaScript and even had to write a lot of code in VBA.

I'm beginning to see your problem. With the exception of JavaScript, you do work in Blub. And I'd bet that you write Blub in JavaScript, too, instead of JavaScript in JavaScript.

.

>> Every language has its own nuances, you just find the best way to work with them, ignore the junk, and adapt. Which is why I really don't get where all this hate is coming from.

Nonsense and worse words. The best way to "adapt to Java" is to download a Scala compiler. Spend a few weeks using the JVM with something modern like Scala or Clojure and you will get where the antipathy towards Java comes from.

Java commits the ultimate sin a programming language can commit: it wastes my time. It is a language designed by committee that does nothing excellently. Its successors on its own platform do not commit the same sin and I am more productive for it--they are better for it.

.

>> You never hear this for C++ and it can also be a pain in the ass

This is blatantly untrue, in my own experience. I can rant on about C++ quite successfully and at great length, because C++ has its own share of problems. Where it differs is in much, much greater expressivity--that C++ is capable of supporting Boost is a perfect example of this expressivity. It is by no means perfect, but it is certainly a smaller problem than Java.

And unlike Java 7, C++0x actually fixes (most of--templated lambdas are unavailable for what I consider fairly stupid reasons) the problems that. Oracle decided to push anything useful out until Java 8, and I'm skeptical it'll actually keep the promise of "next year."

.

>> Is almost like it is cool to hate on Java.

You lack the breadth of experience to make this claim.

Well, lets agree to disagree. Maybe I am a dum*bass and too dumb to realize it. Ho well.. C'est la vie
"Agree to disagree" is a polite way of saying "you're wrong."

Are you incapable of substantiating your position?

> You lack the breadth of experience to make this claim.

Wake up. You're 23. You're a kid. You've just started programming and think you know everything. You don't.

I'm well aware that I don't know everything--but, with what little respect is due a troll like yourself, apparently I know more than you. :-) After all, I'm not the one saying "you don't need that" because I don't understand it; on the contrary--I am saying that these tools greatly empower a programmer to write better code. Because they do. You can certainly write "good" Java, but it will not be in the same ballpark as "good" Scala or "good" C# or "good" any-other-remotely-modern-language. The effort expended to write "good" Java is much greater, and as such it is a worse tool.

As for your ad hominem: I've been doing this at some level for ten years, thanks. I've been getting paid to do this stuff for about six. I didn't "just" start programming. I work in a fairly high-level, demanding environment with plenty of hard problems and a lot of code smell that can be directly attributed to poor Java expressivity.

That you can only fall back on "you're a kid" as a way to attack claims says much, much more about you than I.

You are describing to a T the sort of Blub programmer that is referred to in the Graham article I linked upthread, but I won't bother advising you to read it--you won't recognize yourself. Have a nice day. :)