Hacker News new | ask | show | jobs
by famousactress 5434 days ago
I don't think this is a valid analogy. The language/tools/support/ability-to-hire-developers are all a fluid ever-changing thing. Hammers aren't. Take this post.. people are excited about updates. I'm just saying the updates are kind of too little too late for me.
1 comments

Well, people want different things. I just want the hammer.

New language features are all fun, but unless they actually result in faster execution, or allow you to do things you could not do before, they're only use is to make some developers happy, which I don't think is particularly important.

It looks like there's some real solid good APIs here though which is great to see.

At first thought I imagined it'd just be useless pandering to developers like "You can now do closures or first class functions" or something equally useless.

Come on, let's get honest. The ecosystem matters. A lot. The community, and level of interest and delight in using the language matters.. Yes, even to you. It determines what third party tools are available, how easy it is to hire developers, and what machines the platform actually runs on. Your argument suggests you'd be just as happy and productive developing today in Pascal.

"You can now do closures or first class functions" or something equally useless.

Flamebait, but I'll take it. I think the dust-up over the possibility of this being added to Java really seemed to contribute to the decline and apparent disinterest of a lot of folks (I'd really be interested in Bob Lee's opinions here, since he was someone who's ideas I was particularly aligned with at the time and has since gone pretty quiet).. That said, lack of first class functions in Java isn't a trifle. It's why Java isn't all that much fun to program in compared to more expressive languages... and a bigger problem is that more than any other language I'm familiar with Java suffers from the problem of not being able to see enough ideas in a given amount of source code. I'm explaining that terribly, but I just mean that Java code is at least 60% scaffolding that isn't material to the author's intent.

Closures, or first class functions done nicely would be a big step in alleviating that issue, IMHO.

> and a bigger problem is that more than any other language I'm familiar with Java suffers from the problem of not being able to see enough ideas in a given amount of source code.

This is not an issue with Java. It's an issue with the programmer. How are you going to cope with assembly language listings? Blame assembly language?

> New language features are all fun, but unless they actually result in faster execution, or allow you to do things you could not do before, they're only use is to make some developers happy, which I don't think is particularly important.

I think you don't appreciate how some language features can help you reduce the size and complexity of your code. Those are the kind of features that are sorely lacking in Java, and that means huge, bloated code bases.

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.

> Those are the kind of features that are sorely lacking in Java, and that means huge, bloated code bases.

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.

Disclaimer: I'm an outlier. I rarely use 3rd party libs, rarely write with anyone else, etc.

> And if you can't read code well, go practice some more.

Actually, let's not. To paraphrase a minor celebrity of programming, life is too long to be good at reading every variation of boilerplate. Java is essentially hostile to small functions and parametrization, as having any semblance of inner or anonymous functions will require you to define a class at least, or an interface somewhere else, scattering your code unnecessarily, and you'll probably just end up repeating the code because it's just not worth the effort to do it. Don't believe me? Why do you always have to .open() and .close() your any port-like thing manually? That's a solved problem, you know?

> To paraphrase a minor celebrity of programming, life is too long to be good at reading every variation of boilerplate.

Learning to read code is just like learning to read English. You can guess most of the words meaning once you know some of them. Personally, I think being able to read code is the best skill you can have as a programmer. Just as a good musician is able to listen to music properly. (I mean 'listen' as in analyze, understand, notate and copy).

The other point IMHO is that scattering your code with anonymous functions points to bad design and is as bad as scattering "GOTO" everywhere in BASIC code. It leads to spaghetti code which is an unmaintainable mess.

> Learning to read code is just like learning to read English. You can guess most of the words meaning once you know some of them. Personally, I think being able to read code is the best skill you can have as a programmer. Just as a good musician is able to listen to music properly. (I mean 'listen' as in analyze, understand, notate and copy).

Yes, that's very true, but it's also a red herring. Not all code is worth to read, nor is it worth to write. Certainly not either the copy+pasted mess that would result of not using first-class functions, or all the _noise_ introduced by their half assed expression using classes.

> The other point IMHO is that scattering your code with anonymous functions points to bad design and is as bad as scattering "GOTO" everywhere in BASIC code. It leads to spaghetti code which is an unmaintainable mess.

Spaghetti? Really? As in flow of control? You _really_ don't know what you are talking about. Sure, it does enable some trickery, like Continuation Passing Style, but if you are arguing that such a technique is a 'con' for the existence of what amounts to just both functions and lexical scope, you are grasping straws.

On the other hand, you have simple abstractions that are enabled by first-class functions, like map or the folds, and you won't have to hear of silliness like the 'Command Pattern' or the 'Strategy Pattern' to work around the restrictions that make them necessary. And the subsequent explosion in code, to be found later shoved in other classes and packages. They make dispatch tables easy, they give you a simple way to make asynchronous code, they allow wrappers for guarded code, they...

Do yourself a favour and take a good look to the first two chapters of SICP (http://mitpress.mit.edu/sicp/), most of their charm is displayed there.

@felipemnoa: Downvotes are presumably for snarky 'You must suck and reading/writing code then' comments. Isn't a positive contribution to the discussion.

Also, 'making the difference' and 'being totally irrelevant' are two very different things. Programming languages matter. I'd be surprised if Mr. Spolsky disagrees.

I think it is. If people haven't learnt yet that the single most important skill you need as a programmer is being able to read any code, in any language, and take a good guess at what it does, be able to hold abstract programming concepts in your head, and match them up to random code listings you have never seen before....

Before you can write code, you need to know how to read it.

I'm sure no one is disagreeing with the importance of knowing how to read code. I'm just saying that Java makes it harder than it needs to be. If your argument is that that's a good thing, then where does that argument end?

(Probably with Perl, I guess...)

...sorry Perl guys. Couldn't resist.

I recently had the great displeasure of working on a 20,000 odd line class. You cannot keep 20,000 lines in your head, it's an extreme challenge.

Each method only had tiny differences but spotting them, as pivo's original comment argues, is a total nightmare.

Refactoring brought it in at 1,500 lines. Now you can glance at any method and see the actual difference to the default that they do.

Are you seriously suggesting there's little difference between a programming language that encourages 20,000 line behemoths filled with dross compared to a concise 1,500 line program. That there's not a massive mental overhead to reading through what is essentially a book compared to a short essay?

As that's what's being discussed, but you don't seem to get it.

There's reading code, and there's reading pointless code.

There are many real-world, practical examples of code that is a huge clanking mess of boilerplate in Java but yet just a few lines in a more expressive language like Ruby, Python, or C#.
>>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.

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

At first thought I imagined it'd just be useless pandering to developers like "You can now do closures or first class functions" or something equally useless.

Congratulations, you've found your Blub. (Mine is Python; I'm still not clear on what monads would do for me in practice).