Reasons to be excited about Java in 2013
jaxenter.com
jaxenter.com
After 17 years of Java the language many Java devs. have built up skills around the JVM and java class libraries. Many of us are now looking for a more modern language which lets us leverage our existing knowledge. Scala + friends are pretty hard to ignore these days.
The JVM also has a very rich open source ecosystem. If your language-of-choice runs on the JVM, very likely you can leverage any Java-based library right out of the box.
However, you can have compiler generate lower version bytecode for you. If you have a Java 8 compiler but want Java 1.4 bytecode - no problem, just ask compiler to target 1.4. It will warn you if you use any >1.4 features. Maybe it will even let you use lambdas (maybe not, I'm not sure).
Java is very backwards compatible. That's why it progresses so slowly perhaps.
However, you can use Java 6 compiler to compile Java 6 code to JVM 1.4 bytecode. That's what you are talking about.
I don't think there's any theoretical reason for the bytecode or the bytecode assembler language to need to change. Just like there's no reason lisp and c can't both be compiled to IA32 bytecode, even though lisp has lambdas and c does not.
Rather the issue is going to be at the compilation stage, where support for anonymous methods will need to be added. From my limited knowledge of compilers two ways it could be done are:
* just give the lambda methods a namespace that is unique from the namespace programmers have access to (eg a variable with a space or a tab in its name). Now lambdas will be handled like regular named methods, but the namespace for them will be invisible to the programmer, and the compiler will be modified to have two method namespaces/an expanded namespace for functions.
* Make all methods lambdas and then bind method variables to the lambda methods similar to how atomic/primitive (eg integer, float, chars) and other non-atomic/reference (objects, arrays) variables are bound to their anonymous objects. This is similar to how anonymous objects are handled. An anonymous object is what's returned by constructors, which are then bound to some variable. In this case the compiler needs to support methods that aren't bound to a variable.
That said, it's entirely possible that making changes to the bytecode and the jvm will allow for faster running code, but those changes wouldn't be required out of some theoretical necessity for supporting lambdas.
I was actually thinking at this from a "language evolvability" p.o.v. : if, hypothetically, a language like Python would be bytecode compiled and the bytecode compatible v2 to v3, you could evolve the language syntax much faster without the worry for complicated "transitions": You could then use python 2 libraries in a python 3 program and so on...
I'm in the initial stages of a (not so serious) language design project - a language "designed for accelerated evolution of both syntax and semantics", and I was considering the hypothesis that a "bytecode" compiled language could evolve much faster than either an interpreted or compiled-to-machine-code one.
Though changes to the instruction set do not happen at every release there are normally changes to the class file format - so although generics were implemented by type erasure at Java 5 so did not need an instruction set change new signature information was added to the class file format to describe the type parameters, and annotations were introduced which required further class file format changes.
Think about the ffi annoyances with c->c++->other-lang, its so simple in jruby to use clojure libraries, or rhino for some other stuff, or vice-versa, or whatever.
And I'm not a java fanboy, but that fundamental aspect of the jvm as a platform is crazy cool.
If you're into functional programming the CLR is the runtime to beat.
Except it doesn't run on any useful platforms. Java makes the effort to be consistent and good on a wide variety of quality systems.
If there had been a true first party (i.e provided by MS .Net CLR) for other platforms it would probably have had massive traction.
Microsoft can't let go. They can't say "this code is now open and no strings attached". They can say "but not really". They can say "but don't touch anything". Microsoft can't open.
What they can do is okay for consumers. Consumers will download whatever software available and use that. Developers? Hell no. Developers don't trust openness that can be revoked. Because this means their product stops working.
But mono is not .Net. I mean, if you look at Java, there is a very strict process which a JVM implementation must undergo in order to be called Java (and still there are a dozen of such implementations). It means it behaves predictably and have every one of the required APIs. And most of development tools are written in Java.
On the other hand, with .Net we have Microsoft implementation on Windows - and we have everything else. .Net on Windows has a massive number of APIs (many of those system dependent), hatches into COM, can easily use native code and libraries. Most .Net tools only work on Windows and are written as a mixture of native code, bytecode and COM. And mono is a second class citisen forever. It will never have all those limitless APIs and will never have all the tooling. It is extremelly unlikely that developers (of proprietary, in-house, server software) who use OS X or Linux as their development environment will ever adopt it. Nobody likes to be second class. Programming is painful enough even without that.
Whether .NET is different from Mono is not what I argue. Mono brought a MS-inspired technology to Linux so they got under the MS hatred umbrella. There was and still is a purely knee-jerk / emotional reaction to whatever they bring to the table.
Anyway, Stallman is not a good example of vilifying anything. He's the strictest man in town. He is afraid of everything. Rightfully so. But he's not a representative sample of the community.
OTOH lots of people use and love OSS including very profit driven startups and Apple "fanboys". Being able to write C# using Visual Studio under OS X and deploy to Linux would be killer app for a lot of startups and of course whatever stack gets used by the popular startups will be lionised.
Not the mono runtime; the fact that there are two runtimes.
The official MS one, and the Mono one, and although they're kind of compatible, in that your C# can be compiled to run on either of them (mostly, sometimes, if you haven't done anything fancy, if you're not using MVC, if you're not using a UI layer that isn't portable, if the version of mono you're using from A is the same as from B ( >_> unity...) ), this is FAR away from the java JVM, where you can ship an application that just runs on all the platforms.
Don't get me wrong, you can do that with C# too... if you use Mono only, and flip off the official M$oft .Net runtime.
...but the mono runtime is behind the curve, always playing catchup to the 'official' runtime, supporting a subset of the features, and everywhere runs different versions of the mono runtime. It's a mess.
You've got to admit, the JVM is 100% superior in this regard.
To compare Mono to the MSFT CLR and call it rubbish by way of contrast to Java-land strikes me as hilarious. I'll choose .NET every time given that choice...
No, never.
You mean two different JVMs, from different vendors? Who uses those anymore?
Really? No one uses Linux? And you're talking about Java and JVMs? That just looks silly.
Only at the very limited level of "versions of the JVM before x have a bug that makes this package not work.
>Or dealt with software that only worked with one very specific version of the JRE that was exclusive from the equally specific JRE required by another bit of software?
No, never. I know one should never overestimate enterprise software vendors, but you'd have to try really hard to make something that crap.
Which is something a lot different than an a project actively developed and supported on multiple platforms by Microsoft.
Xamarin is OK, but it's tiny (in resources and reach) compared to Microsoft.
The idea works well for functional code (what pixel and vertex shaders basically are) but it doesn't really map well to more imperative GPGPU code.
Java getting lambdas is cool, I'd be excited if I still was a Java Developer... but it's like at least 3 years I'm using lambda functions everywhere else, almost all the other reasons sound like old news too... "Java now is 'cloud'!", really?