Love and Hate For Java 8 434
snydeq writes "Java 8 brings exciting developments, but as with any new technology, you can count on the good, the bad, and the headaches, writes Andrew C. Oliver. 'Java 8 is trying to "innovate," according to the Microsoft meaning of the word. This means stealing a lot of things that have typically been handled by other frameworks and languages, then incorporating them into the language or runtime (aka standardization). Ahead of the next release, the Java community is talking about Project Lambda, streams, functional interfaces, and all sorts of other goodies. So let's dive into what's great — and what we can hate.'"
Re:I'm disappointed (Score:4, Interesting)
I think the bigger reason they probably didn't do it is that Erlang only lets you assign a variable once, so there are no concurrency issues with read/write of variables. One of the neat side effects of this is that a service/method which takes a lambda argument can be parallelized behind the scenes without changing the meaning of the code execution.
Another thing that puzzles me is that Java lambdas seem to be based on the idea of overriding a method of a class. That seems to me to be a critically limiting way of implementing them vs. function prototypes/templates, as there is no way to specify multiple lambdas being passed to the evaluator.
Re:Gawd (Score:0, Interesting)
http://www.paulgraham.com/avg.html
Re:Gawd (Score:5, Interesting)
Which kinda makes me wonder why language designers bother with these updated versions out side some fetishistic desire to make their language of choice more complicated. Though I guess it does help separate out the 'elite and in the know' from the 'newbies and outsiders'.... though I think C++ really takes the cake in that regard.
Re:Gawd (Score:3, Interesting)
Java is a brogrammer language. It's for people that find writing real programs, in real languages, too hard.
Well consider this your lucky day! With Java 8 you can now write JavaScript to run inside of Java! Sayeth TFA:
Netscape created a piece of software called LiveScript to allow for scripting on its Web servers. It decided to port it to its browser and needed a fancier name, so it licensed the Java trademark from Sun and called it JavaScript -- which would long promote the confusion that JavaScript had very much to do with Java. However, after the apAOLcalypse, some members of the 12 colonies of Netscape were not done and sought to continue Netscape's plan of rewriting their browser in Java. In order to do so, it needed to create an implementation of JavaScript in Java. Netscape called the project Rhino; as with turducken, ours is not to question but to enjoy.
So just in case the seemingly unquashable confusion between Java and JavaScript wasn't bad enough, it's about to get worse. But I guess you can't blame Oracle -- they heard you like to use JavaScript and Java, so now you can JavaScript with your Java while you Java with your JavaScript. Or something. Plus throw in some Node.js bullshit for good buzzword coverage.
While there are many places that it can be useful to run JavaScript from within Java....
This is just plain bad.
Re:Seems familar... (Score:5, Interesting)
More than reacting to C#, they seem to be reacting to other JVM languages that are just more attractive for any shop with experienced people.
The JVM is often used to write large amounts of business crud: Take a parameter, query a database, process a list. Make a service call, transform the result into a slightly different list, merge the results with a different service, then return. You could write that kind of computation in a functional way using Groovy or Scala in half the number of statements. And if there's one rule for programming productivity is that the less statements you need to write, the faster the job can be written, and the less bugs you get.
When the people using your virtual machine start migrating to other languages you do not control, you are at risk of having the people building the language just porting the language away to a different one, and poof, Java becomes obsolete. Therefore, Oracle just has to improve Java.
Re:Gawd (Score:5, Interesting)
Re:Gawd (Score:4, Interesting)
I don't think there's much in Java the language that encourages over-engineering; it's more in the community that surrounds Java. It's in the tutorials, and books, and code examples and discussion groups . It's in the frameworks and libraries.
Indeed. The C++ world used to be like that. The sort of people who read the treat the design patterns pook not as a useful guide and taxonomy but as a way of life. They used to do the same stuff in C++ with massive class heirachies. I think they tend not to be very good programmers and they migrated en-masse to Java since it has fewer pitfalls. The C++ community has changed considerably since then and the modern style is very different.
I don't think that really says anything about the C++ language or the Java language. As a dyed-in-the-wool C++ programmer, going over to Java, I was firstly not at all surprised by the legendary overengineering, but was surprised that there seemed to be nothing in the language making people write overengineered code.
Don't get me wrong. It's not my favourite language: I find it a little dull and a little verbose, but it does not seem to be bad.
It is my understanding that since many of those programmers left perl for other languages perl has been remade as "Modern Perl" which is largely the same core language, just with a different and libraries, and is quite readable.
Much the same thing is happening in C++. The community (myself included) went mad with excessive template metaprogramming shortly after the mad with design patterns crowd left. It all seems to be calming down and the modern "Stroustrup style" (as it's known and given the name given to it is probably not all that new) of basically doing the sensible thing seems to be slowly taking over.