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.'"
I'm disappointed (Score:3)
I'm disappointed. I expected Lambda functions to be closer to Erlang's implementation, where you can access the variables of the enclosing function/method safely. But perhaps the examples in the article are just too simplistic to show such behaviour.
Re: (Score:2)
Re:I'm disappointed (Score:4, Funny)
They're still waiting for the application with the answers to start up.
Re:I'm disappointed (Score:5, Funny)
"Knock Knock..."
"Who's there?"
...
...
...
...
Java!!!
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: (Score:3)
Hmmm ... I'm not sure I'd call it a variable then. ;-)
Finally Fixing the Date stuff (Score:5, Informative)
Re: (Score:3)
How would your Decimal concept be any more powerful than Number?
The one thing I wish they'd have done with Number is added Precision and Scale to it's usage, which would be invaluable for things like financial and scientific calculations.
Re: (Score:2)
Sorry. I meant "BigDecimal".
Re:Finally Fixing the Date stuff (Score:4, Funny)
Re: (Score:3)
Re:Finally Fixing the Date stuff (Score:4, Insightful)
I'd hardly call it "difficult" to use, any more than it is to use the wrappers for the native types. Still, it would be *nice* if you could use "+" instead of "add()", but really that's just syntactic sugar.
Re:Finally Fixing the Date stuff (Score:5, Insightful)
I'd hardly call it "difficult" to use, any more than it is to use the wrappers for the native types. Still, it would be *nice* if you could use "+" instead of "add()", but really that's just syntactic sugar.
To some extent, anything beyond raw binary notation used by your processor is just some form or another of "syntactic sugar" transformed by some intermediate tool.
Re:Finally Fixing the Date stuff (Score:5, Insightful)
People like to dismiss syntactic sugar as unimportant but IMO it's the difference between code that is pleasant to read and write and code that is a PITA to read and write.
I wish some fork of java would happen and take off that adds back in the basic features sun left out. Stuff like properties*, user defined types without an implicit reference, unsigned numeric types, operator overloading, parameter pass by reference etc. Some of that is syntactic sugar, other parts not so much. Ideally these features would be done in a way that could somewhat work on existing VMs though some features would likely require VM enhancements to operate efficiently.
Unfortunately MS has already taken the name J++ :(
* No that javabeans shit doesn't count.
Re: (Score:3)
Re: (Score:2)
Interesting. I've always used "syntactic sugar" to mean language features that are fundamentally implemented in the front end. For example C++ lambdas are effectively syntactic sugar - it's a clean syntax that wraps an anonymous class declaration (with the lambda capture values being class members and the lambda body being an "operator()" method).
Another example is C++ reference parameters - under the cover most C++ compilers implement reference parameters as pointer to type parameters and the reference par
Re: (Score:2)
But what does that mean? Lots of stuff is implemented in the front end. Without knowing for sure, loops and conditionals are language features that are probably almost always lowered to gotos by the time it hits the back end. Classes are almost guaranteed to be syntactic sugar, even if they have virtual functions. Templates and macros are syntactic sugar.
Re: (Score:2)
There are lots of languages built on top of the JVM that can even use Java libraries which have totally different syntax. Clojure being a great example, and Scala another.
Re: (Score:3)
Unfortunately, it seems that JVM based languages are still limited by the lack of unsigned types. What a remarkably stupid decision to omit them.
Unsigned (Score:4, Informative)
I'm not sure how that connects to the GPs request. Anyway Gosling didn't include it because the behavior aren't defined in CPU independent ways.
32-unsigned 0 minus 32-unsigned 1 = ?
where ? is CPU dependent. Some you'll 0xFFFF other 0x8001 others 0xFFFE. That's precisely the sort of thing JAVA was designed to abstract away. And if you don't want unsigned to be doing raw CPU arithmetic on primitives then you can just use a library.
Re: (Score:3)
Carry Flag (Score:3)
And thinking of it (and correcting myself): Ada does for unsigned typed as well. Not for signed. There a RANGE_ERROR is raised. Strange but sometimes useful asymmetry.
But that does not invalidate my statement. All CPU I know of (there might be others, more exotic CPUs of course) set a carry and/or overflow flag on signed and unsigned roll-overs as well. One does not exclude the other here.
In 8 bit times those flags where extremely important to do 16 bit operation with only an 8 bit a
Re: (Score:3)
Take a look at any CPU architecture where the addition or subtraction isn't defined the same as the standard. The "addition" used by the C compiler is a short function. Similarly for subtraction... Just look at the assembler.
A lot of this conversation happened in the late 1980s during the X3J11 meetings in places like the discussion of limits.h as far as the standard. I'd say Plauger's book is a good source I don't know what's online.
Re: (Score:3)
Java has found some masterful ways of getting performance well above scripting engines for some things. They might have been able to pull it off with weird unsigned types. But ultimately the reason for C to have all these complex binary types is they encourage bit level thinking about programs. Java for safety reasons can't. I don't really see how a primitive unsigned type is useful for anything other than speed. Generally what people want unsigned for would be better to implement the way .NET does it
Re: (Score:3)
That makes no sense. How exactly is unsigned arithmetic not cross platform? It's the most basic arithmetic that any CPU can support!
If you mean that wrap-around isn't cross-platform, then it isn't for signed arithmetic, either. In fact signed is less portable because there are more possible binary representations of it compared to unsigned.
Re: (Score:3)
Re: Finally Fixing the Date stuff (Score:4, Insightful)
Clearly you have not yet had a chance to write code that does real maths with real mathematical types like vectors or matrices. This is wheree operator overloading really shines. You don't want to implement complex formulas with tons of explicit function calls. With overloaded operators you can basically transfer the formulas you calculated on paper into machine code almost exactly. Without them, it's a sad mess of nested function calls, long lines, superfluous temporary variables and almost inevitable mistakes in code that nobody wants to read.
Of course there are times when operator overloading is exactly the wrong thing to do. But if it is used the right way, it is an amazing feature.
Re: Finally Fixing the Date stuff (Score:4, Insightful)
As soon as you get beyond complex numbers you rapidly find out that there are not enough operators to overload for operator overloading to make much sense.
is "*" the dot or cross product or is it convolution or is it correlation or autocorrelation?
There are not enough operators to make it useful so you have to have method calls anyway. If you are calling methods then it is clearer to always call methods
Re:Finally Fixing the Date stuff (Score:4, Insightful)
Actually it isn't. The add() method belongs to the first parameter, whereas the native '+' implementation (used to) belong to neither and if you think about it really should be that way.
'+' is not a method or property of the first parameter. the correct interpretation of a+b is that this creates a unnamed virtual object number tuple with the method add.
Re: (Score:2)
Re: (Score:3)
I sense a fellow Prolog programmer here.
Re:Finally Fixing the Date stuff (Score:5, Insightful)
Academic types have rejected 95% of all real advances in programming languages for nearly 4 decades as "syntactic sugar" while they carry on with their abstract type theory which has had rather limited impact in the real world in the same time span.
Do yourself a favor and do away with the "syntactic sugar" crutch and try to judge a language proposal on it's own merits. Is it better to write 3+5 than 3.add(5) ?
The answer is obviously YES, so who the hell cares if it is syntactic sugar, syntactic salt or syntactic coconut sprinkles.
If it makes life better it should be adopted. End of story.
p.s. there are potential drawbacks with operator overloading, but "syntactic sugar" ain't one of them.
Re:Finally Fixing the Date stuff (Score:4, Insightful)
What bugs me about operator overloading is how tediously verbose it can get. For example, say you define operator functions for < and ==. You still have to do <=. Even when all the <= function is is: return this < that || this == that;, you still have to write it. It's so tempting to skip writing the code for an unused operator that many programmers do so. Languages are mostly unable to automatically fill in obvious code of that sort. C++ does have a default assignment operator function, but that's all. Too much chance of the obvious being wrong, so they opt not to do anything.
To make matters worse, the above implementation of <= is inefficient. Down at the machine level, the computer does not stupidly require 2 separate comparisons to test <=. It has instructions such as JLE. The above function will at the least result in the computer having to do JL; JE;. While JE may be executed only 50% of the time that JL is executed, depends entirely on the data and code, it's still a waste. Further, two branches takes more space in the CPU's branch prediction, and the extra instruction takes more space in cache, so JL; JE is not as good as 50% slower.
I find your gratuitous slur against "academic types" unwarranted and unfair. Academia has produced much innovation in programming. Do you forget the proof that Structured Programming is sufficient, and GOTOs are not necessary? All the work done on Turing machines, and universal computation? Automata Theory, with the classification of grammars into such categories as "context free"? BNF? Without that academia you sneer at, we couldn't be sure of all that. What of the entire concept of OOP? Where did that come from? And functional programming and LISP? It's easy for some hack to bang out a programming language built around what he feels are a few good ideas, drawn from perhaps years of experience. But without careful examination of the problems, insightful modeling that leads to good, pertinent questions which can be proven one way or another, we would just be flailing around even more than we already do. We might all still be trying to program in ALGOL. I put more trust in academia's ability to create a good programming language than I do a modern corporation with its dismissive attitude towards fundamental research.
Re: (Score:3)
All the examples you give predate the "nearly four decades" timespan that I wrote about in my post. With those you just have--inadvertently-- confirmed my point.
Academics made great contributions to programming languages until the "programming languages=type theory" and "usability improvements=syntactic sugar" mindsets crept in. I am far from the first person to observe this btw, e.g.:
http://matt-welsh.blogspot.ca/2013/04/the-other-side-of-academic-freedom.html?showComment=1366600358822#c5765593833050647322 [blogspot.ca]
Re:Answer not obvious (Score:4, Insightful)
no, all you "know" is that there is a method called "add" on the object named 3 that is being called with the parameter 5.
So the 'add' method could easily carve 3 and 5 on a tree. You have no way of knowing what it does just from the method name. The classic example is string::add(). Does "hello".add("world") produce "hello world" or does it only apply to "3".add("5") to produce "8"? You may criticise operator+ for this reason, but note that the add() method is just as bad.
So there is no difference between the operator+() method, and the add() method (except the name chosen, and the way its written by the developer).
Now we've established that there is no difference between the two, we can say that as normal humans are the ones that read and write code, the former, operator, mechanism is easier to read, write and understand, then it is the one that should be preferred.
Re: (Score:2)
Maybe the person asking the question (I didn't look) was in first or second year CS.
a += b.
In fact, even well-aware of how it actually behaves,
still seems to me like it should be closer to
than to
Re:Finally Fixing the Date stuff (Score:5, Informative)
New Java Date Time API for Java8: http://openjdk.java.net/jeps/150 [java.net]
AKA JSR 310
The old adage comes back and back (Score:5, Insightful)
The old adage is always applicable: Those that do not use LISP are condemned to reinvent it. Badly.
Re: (Score:2)
Except that no one ever said that. Santayana said that about history and Henry Spence paraphrased it with Unix, but no one said it about Lisp.
In fact all the modern functional languages are remarkable in how much they are not like Lisp, starting from Scheme which managed to maintain the horrible parens notation but did away with almost everything else (dynamic scoping, no state, no control structures, no defun, etc.) and moving on to Python, Haskell and Scala.
Re: (Score:2)
http://python-history.blogspot.com/2009/04/origins-of-pythons-functional-features.html [blogspot.com]
Re: (Score:3, Funny)
Re:The old adage comes back and back (Score:5, Funny)
Sure: reimplement it in Java.
That's called Clojure.
Even better, use it within J2EE so that it takes 45 seconds to start up.
They sped it up?
Re: (Score:3)
Re: (Score:2)
Every expression must be surrounded by three parenthesis, and followed by a semicolon. Also, when you reach 5 levels of depth, the last element of a list of parameters becomes the function, instead of the first.
Re: (Score:3)
The email you cite also contains (quoting a previous email?) what I've long considered the real secret of Java's success:
Java did not achieve acceptance based mainly on the
features it has (or does not have). It was accepted because
Sun expended a huge amount of effort (not to mention money)
promoting Java and the things built from it, and wisely
positioned it against the nightmare that is C++.
The Guy Steele wrote:
We were not out to win over the Lisp programmers; we were after the C++ programmers. We managed to drag a lot of them about halfway to Lisp.
Halfway to Lisp? Other than GC, there isn't much about Java that's Lisp like. Guy was rationalizing.
IMHO, without Java being pushed as an alternative to C/C++, I don't think we would have gotten the renaissance of dynamic languages we have today
I think Moore's law had a lot more to do with it than Java. Computers are now fast enough and have enough memory that you can afford to write many things in languages that are slow and memory intensive.
standardization != stealing (Score:3)
Since when is standardization stealing? Do you think the Redhat/JBoss devs that wrote Seam complained when they were asked to create the CDI spec? Or when Gavin King (creator of Hibernate) worked on JPA? Maybe in some bizarro world standardization actually happens as technologies mature. You can look at the expert list of any of the JSR and see who these *thieves* are.
Still 32GB barrier (Score:3, Informative)
Re: (Score:3, Funny)
Java 8 is still limited to 32-bit array indexes, meaning, e.g. that arrays of doubles are limited to 32GB. Java won't get true 64-bit support until Java 9 in 2016.
32GB should be enough for anybody.
Re:Still 32GB barrier (Score:4, Funny)
Why would you need an array longer than 2^32? Unless...wait, are you sequencing alien DNA????
Re:Still 32GB barrier (Score:4, Funny)
I'm sequencing alien DNA you insensitive clod.
Seems familar... (Score:4, Informative)
I remember when C# and .Net first came out, it was noted that it was just borrowing (some said stealing) from Java. When C# first came out, I didn't see it as becoming a leader in new language features, but it is clearly is, as Java 8 addresses a lot of things that been part of C# for a while.
Streams: Similar to IEnumerable and parts of LINQ (LINQ to Objects). Of course, IEnumerables are less strict on multiple enumeration (it may work). Being a bit more strict on this as Streams isn't a bad idea. Functional Interfaces; The article was light on details, but it seems to address the use cases that extension methods in C# addresses. Interesting that the body of the method appear in the interface. The ability for a class to override this default is a new idea, it will be interesting to see how this plays out. Not a bad way to go about this at all. Lambdas:Well, it's -> versus =>. I can't imagine the discussions that occurred over which one to choose.
I'm not sure about the JavaScript in Java feature. But, I've always said being able to execute Scheme in .Net would be useful to me, so this something that MS may have to address down the road.
For me, Java still needs some catching up in terms of parallel programming versus the Task Parallel Library (and the Dataflow Extensions). This is especially true with C# 5.0. Async and await are powerful language features. Personally, I'm still prefer C#. I like having first class generics, the full LINQ library (Expressions) and libraries like Reactive Extensions and Code Contracts (plus the static verifier) are nice features. But, all this in Java 8lis a step in the right direction. I just hope it isn't a case of too little, too late.
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: (Score:2)
Scheme in .NET (Score:3)
Stealing? (Score:3)
So if another framework or language has a certain feature Java isn't allowed to have them?
Really?
pointless (Score:3)
The basics still are wrong: generics still are slow and poorly implemented and Java still is bad for numerical apps.
What's the realistic alternative? (Score:3)
C# just isn't for political reasons. Financial institutions are very influential in programming languages becoming significant as they are the ones with deep pockets that hire huge amounts of -admittedly mediocre- programmers. So far all large to huge financial institutions I know bar Microsoft from entering their data centres.
So, what's the realistic alternative to Java that financial institutions will embrace?
Re: (Score:3)
Oracle is good at one thing: making Larry Elison money. Microsoft isn't sure what they're good at.
Comment removed (Score:5, Insightful)
Re:Gawd (Score:5, Funny)
Re:Gawd (Score:5, Insightful)
Re:Gawd (Score:5, Insightful)
I think one of the big problems is that programmers are very much biased towards thinking that what should be considered matters of preference are absolute right/wrongs, and most of the differences between major languages themselves are simply matters of taste or convenience. It's why you can get almost any software engineer to tear apart someone else's code, even if the code is written as well or better than anything they've written: there's pretty much always small differences that the engineer will find offensive even though there's no practical impact.
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:5, Funny)
May you spend 100 years in purgatory, writing AI programs in COBOL.
Re:Gawd (Score:5, Insightful)
I would almost agree, that any language is as good as any other. With a few exceptions, like "whitespace" which isn't meant to be a practical language anyway.
This is a false statement, they are not as good as the other. Each language is designed to be strong in certain areas while weak/ignoring other areas. As an example, C promotes code close to machine language while Java shields the programmer from manual memory management (GC). There are many such design issues that make a language a natural fit for certain applications while making other languages ill-fitted.
What really sets languages apart is the tooling that's built up around them.
While tools may be important, they are of a secondary importance.
Re:Gawd (Score:5, Funny)
Lisp may be an interesting language, but Lispers scare me. The glow in their eyes when they evangelize about the Mother of All Languages reminds me of Village of the Damned [imdb.com].
Re:Gawd (Score:4, Insightful)
Lisp is the perfect example of CastrTroy's point -- for a long time the interesting development tools were proprietary, expensive, and obscure.
That's not the real problem with Lisp, Smalltalk etc though.
The real problem is that you don't get to benefit from their strengths unless you live completely in their environment. Working with Lisp in a C* based world is like driving a car in the ocean.
Re:Gawd (Score:4, Informative)
A lot of medical devices are built using Java.
First Google result: http://www.oracle.com/us/technologies/embedded/embedded-java-for-healthcare-433550.pdf [oracle.com]
It's been used in medical devices since the late 90's, shortly after it was invented.
For those applications, Java is purpose built.
Re: (Score:3)
A lot of medical devices are built using Java.
First Google result: http://www.oracle.com/us/technologies/embedded/embedded-java-for-healthcare-433550.pdf [oracle.com]
It's been used in medical devices since the late 90's, shortly after it was invented.
For those applications, Java is purpose built.
This PDF is Oracle's "Markitecture" -- it's how they want things to work. They have not certified and indemnified their embedded JVM for use in life support systems. Don't expect them to. Don't expect a device manufacturer to bear the costs of certifying both the JVM and their application specific code, as a combination, for that use. IT's not going to happen.
Yes, my Java ring is in a box in my workroom... I do not wear it every day and do Green Lantern-ish stuff with it, like Sun was predicting would h
Re: (Score:3)
Re:Gawd (Score:5, Interesting)
Re:Gawd (Score:4, Insightful)
Well its a mixed bag really. It is a lot more verbose than other recent languages. The type system is inane. The main advantage is you have binary portability across platforms and a really huge standard API to use.
Re: (Score:3)
Still, the platform itself is enormously powerful and well supported in softwar
Re: (Score:2)
Re: (Score:2, Flamebait)
Re: (Score:3)
Re: (Score:2)
If you think that all programming languages are the same it is perhaps time you get out of your mom's basement and look at 60 years of efficiency studies which show much the opposite.
Re: (Score:2)
Do you have a cite for that? Serious question. I've never seen such a study and would be very interested.
Re: (Score:2)
Sure the classic discussion is in Mythical Man Month. Here (http://sequoia.cs.byu.edu/lab/files/pubs/Delorey2007a.pdf) is a paper from 2007 which has references to many of the classic discussion. And Brooks I believe cites the original FORTRAN vs. assembler tests.
Re: (Score:2)
Re: (Score:3)
That's sort of the point of the language. The ability to write once and not have to rewrite the entire thing because you're now on a different platform.
Your complaint is sort of like complaining about how hard assembly is and how they should figure out how to make it more easily read and do things for you.
Re: (Score:3)
Java was a GOOD language, because before we had C++.
One of my favorite definitions: "Java is like C++. But without the mace and knives."
Re:Gawd (Score:5, Insightful)
Newsflash: People write major systems in Java that work pretty well. People do mission critical, bet-the-company stuff in Java, and it works. *Your* mileage may vary, but it always does.
This doesn't mean it' the best choice for everything, because *nothing's* the best choice for everything
And it doesn't mean Java doesn't have serious flaws. There's something deeply ingrained in Java that encourages over-engineering. But every language has its pitfalls.
Re:Gawd (Score:5, Insightful)
And it doesn't mean Java doesn't have serious flaws. There's something deeply ingrained in Java that encourages over-engineering. But every language has its pitfalls.
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.
The reality is that a "language" is as much shaped by the community that grows up around it as by the actual language itself. Perl doesn't have to be particularly unreadable, but the culture that grew up around perl in the late 90's that was obsessed with cute hacks, fewest keystrokes, and self created obscurity created a state where anyone learning perl was immersed in that culture and came out writing a lot of unreadable stuff. 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.
Conversely python can be made quite diabolical (just through together chains of nested list comprehensions and single character variables for example), but because it grew up with a culture of "one obvious way to do it" and readability most code you'll see tends to eschew such things, and strive to read like pseudo-code. Again, there's not that much inherent in the language, it's the cultural conventions surrounding the language that enforce much of that.
Java fell in with the Enterprise crowd, and consequently found itself immersed in a culture obsessed with design patterns and over-engineering. Had things gone a little differently with, say, in browser applets somehow becoming the primary driving force for java (let's assume they ran better say) then I doubt java would be known for over-engineering.
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.
Re: (Score:3)
That's not over-engineering so much as a lack of decent functionality in the JDK. Having things just work right out the box is one of the things I miss the most after I switched to java.
Java is over-engineered in large part because it's used on large-scale projects where the quick-and-dirty approach doesn't hold up. From time to time, I've had to chastise people for attempting to use J2EE for stuff that doesn't deserve to be written in anything more complex than PHP.
Then again, Sun made some really wretched design decisions. They're (as Oracle) now about to institute the third attempt to get dates, times, and calendars made easily usable. Although part of what made the first attempt so bad
Re: Gawd (Score:5, Insightful)
I used to work on a Java transaction processing application at a major financial institution that handled more than 1,000,000 transactions a day that consolidated data from Unix, mainframe and Windows systems. The transactions came from batch and online, client-facing applications that had five nines uptime requirements.
I don't know, sounds major to me. And we had no more "major system problems" than any other app and less than most.
It's not to say that Java is the answer to everything because nothing is. But it is definitely capable of doing the heavy lifting.
Re: Gawd (Score:4, Informative)
So, 6,000,000 orders per second on a single Java thread on commodity hardware isn't good enough for you?
http://martinfowler.com/articles/lmax.html
Java does major heavy lifting, and is extremely fast, if you know what you're doing.
You can try to make minor parts of the program faster by calling C++ via JNI, but you risk harming performance in the long run, because then the JIT compiler can't inline or otherwise optimise that part of the code.
Of course, you can make any language slow if you mess up enough.
Benchmarks have been done and Java can often out-perform C (and C purists will point out that C++ has its own inefficiencies). The reason being that in addition to garbage collection, modern-day JVMs often "waste" time analysing code execution and re-optimizing dynamically, which is something that C cannot do.
A lot of things that are more efficient done small-scale become relatively less efficient when done large-scale. So much that the large-scale applications can actually benefit even further from processes that would be prohibitive on the small scale (such as on-the-fly re-optimization).
Even memory management can sometimes be more efficient when garbage-collected if the dynamic memory base is large enough and organized in the right way, replacing thousands of small memory transactions with one big one that reclaims whole blocks of memory at a swoop.
There's simply no one absolute answer. Only fools look for silver bullets or the One True Religion. But Java found its niche in high-performance, high-reliability backends and so it has received a lot of attention over the years towards making it handle that sort of stuff well.
Re: (Score:3)
As someone who mainly does C++, I have to whole-heartly agree with you. There is no silver bullet when it comes to the world of high performance transaction processing systems. 9/10 times, it is not the actual speed of the system that really dictates which language should be used, it is peripheral requirements that can make one language over another a better choice (i.e. does your development/support staff have more experience in one language over another so minimal training required). 15 years ago, I would
Re: (Score:3)
Benchmarks have been done and Java can often out-perform C
Cite? I've often seen that claim but don't recall many benchmarks. Maybe somebody found a ten line loop that a JIT optimizes the hell out of, but I'm very skeptical that Java can regularly outperform C.
Lies, Damn Lies, and Benchmarks, as they say. Actual mileage may vary. For short runs, the sheer overhead of setting up a JVM puts it out of the running. For server systems running more or less continuously, the startup time becomes negligible. Loop optimization is probably not one of the things that Java can optimize better than C. On the other hand, on a lot of systems, there's a significant difference in the amount of time that it takes a conditional branch instruction to take the branch versus going st
Re: (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: (Score:2)
Why are you all feeding the troll? Let the moderation work and ignore the asshole.
Re: (Score:2)
One new thing for JavaFX http://openjdk.java.net/projects/jdk8/features#153 [java.net]
It's pretty minor.
Re:Java? (Score:4, Insightful)
Oh boy!! If that's what you understand of java...
FYI, You are still using java every single day (as in websites using Java in server side, on phones, on smart cards, on home appliances, ...).
Re: (Score:3)
Re: (Score:2)
So...the language should never advance in areas where it is lacking?
Re: (Score:2)
He's stuck on an island where there's only one job, and if he doesn't work he doesn't eat. Also, he can't get the job back if he quits.
Re: (Score:2)
He also apparently has ADD.
Re: (Score:3, Insightful)
After years of saying java didn't need C# features they go and steal tons of them from C#! Whether it's properties, lambdas, function pointers or async/await, the Java community has always insisted that those features weren't necessary and that Java was no worse for omitting them. Now they go and steal them and put them into their products and everyone will declare them innovative new Java features. Last month it was Apple stealing the "Metro" UI from Windows Phone. Now this. Is Microsoft the ONLY company doing anything innovative anymore?
Right, lets pretend Microsoft invented all of those things.
Re:After years of saying java didn't need C# featu (Score:4, Informative)
Right, lets pretend Microsoft invented all of those things.
If you had been following the language discussions for (for instance) lambda-J you would realize that there is a LOT more to it than simply deciding that a language must have this or that feature.
Specifically, both Java and C# are statically typed languages (although in C# a variable can be statically typed to be dynamic, but I digress) with advanced multi-generation garbage collection, structured exception handling, generics etc. Any new concepts introduced into the language must respect the concepts already there. Designing new features for Java or C# requires significant amount of innovation to solve the interference problems and maintaining the "feel" of the language.
LINQ is a real accomplishment, one that I have not seen put together like that in any other language. Yes, list comprehensions existed before. Yes, expression trees (ASTs) have been used in LIST and several other languages before. Don't know about extension methods, but I'm sure that there must be some research language. Yes, type inference had been used before. Yes, inferred classes must have been used in some language before. Certainly lifted types are well-known in certain other languages. But putting the whole package together and make it fit seamlessly with (and complement) the existing features and at the same time keep it so simple and generic that the useful parts are actually library features, that is a real accomplishment.
Reactive Extensions is real research (primarily by Erik Meijer who has regrettably now left Microsoft to return to academia). Not least because it ties to beautiful in with LINQ. It is entirely new? No, as Erik himself would say, IEnumerable is just a monad. IMHO that does not take away from the accomplishment.
Async and await are *really* cool and have inspired Scala to create something similar.
No, Microsoft didn't invent "all of those things". But fitting them in with a curly-brace, statically typed language is real innovation.