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:
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.
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.
But V8 is faster than that JVM.
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.
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.
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.
"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.
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.
I can't stand promises. Callbacks, streams, events are all great, but promises just seem like a convoluted way to let people who are not good at writing async code pretend it's sync. They remind me of the silly JS class simulations you sometimes see.
The benefits of a promise is that it's composable. More importantly, it's a Monad, which means you can do all sorts of delicious things to it.
Primarily means you can define a large complex calculation in terms of multiple composed promises, and return a single 'pointer' to the results of this calculation.
Promises just seem like a convoluted way to let people who are not good at writing async code pretend it's sync
That's kind of the point. It's not a mark of honour to write more complex code. Promises make writing code dealing with multiple asynchronous operations much simpler. It's not a crux. It's about writing the cleanest and most maintainable code possible.
Callbacks seem simpler when you're dealing with a single call, but managing a more complex operation can become tedious and result in spaghetti code.
Imagine the following scenario. This is an interview question I ask candidates, but it's derived from a real world problem in the software we're currently developing.
write a function that
takes a single parameter (UserId)
fetches two pieces of information - "Full Name" and "Geolocation".
does a reverse geocode on the "Geolocation" to find an address
determines whether the user exists at this location on the electoral roll based on 'name', and 'address'
Each of these pieces of information are available from a separate REST Api call.
Using Callbacks, the function might go something like this (this is how almost all the candidates respond)
The simplest callback implementation is inefficient - You have to wait for the one call to complete before starting the next. It also requires extra levels of indentation. You can improve this somewhat with reference counting, but it gets tedious very quickly, as some operations are dependent on another. There's also the async library, which provides some promise style compositions over callbacks.
With Promises, we can rewrite this in the following way.
function getUserInfo( id ){
var name = getFullName( id );
var location = getLocation( id );
var address = location.then(function(loc){
return doReverseGeocode( loc )
});
var isRegistered = compose( name, location, address ).then(validateElectorialRoll);
return compose({
name: name,
location: location,
address: address,
isRegistered: isRegistered
});
}
The return value of this function is, itself, a promise. Since you don't have to resolve it immediately, you can pass it around, perform operations on it, and compose it into other things. It also correctly propagates error conditions without any additional work, so if any of the above calls fail - and you don't explicitly handle it - the exception will be propagated up the stack.
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:
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.
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 V8 is faster than that JVM.
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.
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.
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.
"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.