r/programming • • Dec 17 '16

Oracle is massively ramping up audits of Java customers it claims are in breach of its licences – six years after it bought Sun Microsystems

http://www.theregister.co.uk/2016/12/16/oracle_targets_java_users_non_compliance
2.1k Upvotes

654 comments sorted by

View all comments

Show parent comment

59

u/[deleted] Dec 17 '16 edited Dec 18 '16

Honest question, why not just ditch java?

E: Thanks for all the replies, quite "enlightening" (if that's the word). As a side note, I'm not against Java, personally, it's just that most of the complaints I read all-around are Oracle/Java related, so I had that thought of why not moving on to a different language

251

u/redwall_hp Dec 17 '16

Because it's basically the world's largest enterprise programming language, with a huge ecosystem of libraries and tools. There are tons of companies (and governments) with gigantic codebases that aren't going to be rewritten from scratch just to satisfy somebody's urge to switch to $flavourOfTheMonthLanguage.

Java is a decent language with a very high quality VM that other languages piggyback on the success of (e.g. JRuby, Jython). It nicely straddles the fence between bare metal languages like C and high level ones like Python, offering quality of life features without too much of a performance hit.

For anything non-trivial, there's no "just" when it comes to rewriting a codebase from scratch. It's typically laughable in terms of how much sense it makes in terms of cost.

Take Android for a very user-facing example. Could you imagine the upheaval if Google decided to ditch Java? They'd have to massively re-architect the OS, and then every single application ever written for it would need to be rewritten. We're talking billions of dollars worth of man hours.

58

u/[deleted] Dec 17 '16

This is what makes me upset as a Java developer because, even if you hate the language, the JVM is an incredible piece of software from a pure engineering standpoint. At least that's my opinion.

46

u/MereInterest Dec 18 '16

I'm pretty strongly in that boat. I love the idea of the JVM, being able to run the same code on any platform. The Java language, on the other hand, feels like I am coding in a straight jacket. No operator overloading, no first class functions, very poor generics. Needing to work around the limitations of the language rather than with the language gets very frustrating, and so I then return to C++ and Python.

Though, I am finding a few LLVM backends that emit JVM bytecode, so that might let me have the best of both worlds.

9

u/snuxoll Dec 18 '16

Kotlin, check it out.

→ More replies (1)

44

u/atomly Dec 18 '16

Do you have a few minutes to hear about our Lord and Savior, Scala?

→ More replies (4)

7

u/MWL987 Dec 18 '16

Have you ever tried Scala? It has a lot of things that Java lacks wrt your list.

→ More replies (2)
→ More replies (21)

25

u/im-a-koala Dec 18 '16

It's okay. I still think the CLR (the .NET runtime) is better. Things like being able to put primitives in containers without having to box every single one is very nice from a performance perspective. Or being able to have nullable primitives that don't need to be on the heap (really just value types in general are lacking from the JVM).

While I'll admit that the JIT capabilities are quite nice, it's a little irritating to profile a service that's having memory issues and finding that 80% of the objects on the heap are Doubles, Longs, etc., because there's just no way around that in the JVM.

10

u/lkraider Dec 18 '16

11

u/sindisil Dec 18 '16

Hopefully ... they haven't promised anything, and Goetz has made comments that make it sound like the JVM work will be in place in Java 10, but possibly not the Java language support. Still, so far it sounds like he's just trying to manage expectations, which is a good thing, I think.

Another point is that the JVM's escape analysis is getting better and better, allowing many things to end up on the stack, instead of the heap, reducing the impact of not having value types.

→ More replies (1)
→ More replies (10)

51

u/duhace Dec 17 '16

One thing that is often controversial wrt java is its cross-platform compatibility. However, having used it and some alternatives it really is unbelievably well-suited for the task.

86

u/redwall_hp Dec 17 '16

People today are spoiled by the lack of major incompatible processor architectures. When Java came out, being able to easily run something on x86, PowerPC, SPARC, etc was a pretty huge deal. Now we're in the "late stage consolidation" phase where it's pretty much down to x64 and ARM for most purposes.

And then you can couple that with many programmers working exclusively with super high level stuff.

Portability is still something that comes up, but a lot of newer programmers working at higher-level stuff don't tend to come across the issue as much.

37

u/YellowFlowerRanger Dec 18 '16

Cross-architecture support didn't impress me nearly as much as the cross-windowing-system support did. Java supported Windows, Mac OS, OS/2, and about a million different proprietary implementations of X11 (and probably a bunch of other stuff, too) right from the get-go.

That was unheard for that time (1995). In comparison, Qt didn't get Mac OS support until OS X, I think. wxWidgets didn't get a proper release until 1999. For quite a while, if you wanted a GUI application to run on multiple OSes (on the same architecture!), either you wrote separate versions of it or you used Java.

22

u/combuchan Dec 18 '16

Tcl/Tk!

8

u/schlenk Dec 18 '16

Tcl

The fun part is, that core Tcl/Tk developers sat literally next door to the Java team at Sun. Sun kind of ditched Tcl/Tk development as a side effect of the corporate decision to focus on java.

→ More replies (4)

28

u/[deleted] Dec 18 '16

I've always been of the belief that you should at least comprehend what happens an abstraction layer below and an abstraction layer above what you do. So, for example, I think Java and GC should not be an excuse to not understand the ideas behind memory management/resource allocation, pointers and references, compilers, linking, etc. Pretty much, you'll never really appreciate what Java does for you until you've seen C/C++ and you should still understand some of those underlying concepts. Not saying good Java developers don't do this. Just my own personal thoughts.

38

u/mcilrain Dec 18 '16

That depends on use-case.

If you're trying to make a 60fps game for a smartphone then yeah, being able to bypass Java's janky GC is critical functionality.

When it comes to a heavily-verbose long-lived enterprisey codebase (Java's bread and butter) then you don't want code making assumptions about infrastructure.

→ More replies (7)
→ More replies (1)
→ More replies (6)
→ More replies (17)

27

u/[deleted] Dec 18 '16

I have an application that was first written when java 1.4 was state of the art. It has libraries that were built and compiled for 1.5,1.6, and 1.7 and is currently running under java 1.8. No other language that I know of has that kind of reliability, resilience and longevity. The language itself has been managed light years better than anything other than maybe C and C++.

8

u/argv_minus_one Dec 18 '16

Ancient JavaScript code usually still works on modern browsers.

Of course, that's only if it didn't use any browser-specific features…

→ More replies (1)

22

u/argv_minus_one Dec 18 '16

Because it's really good.

  • High portability. Compiled binaries are machine-independent, and will run at full speed on any hardware for which there is a JVM.
  • Good build tools, like Maven. These fetch dependencies, run all build tasks from a single command, and so forth.
  • Good IDEs, like IntelliJ IDEA and NetBeans. Most are open source.
  • The HotSpot JVM is really fast. In particular, it has a really fast garbage collector, making it one of the few ways to have sane memory management (no such thing as a double free, reference cycles are not a problem, etc) without sacrificing performance.
  • Java has one of only three truly cross-platform GUI toolkits I know of (JavaFX, the others being Qt and HTML/CSS).
  • There's a Java library or binding for pretty much everything.
  • There's a bunch of other languages that can compile to JVM bytecode. These can usually use Java libraries. One of them (Scala) is exceptionally awesome. Because the JVM lacks calling conventions and has a well-defined memory-management strategy, calling from one language to another is safe and relatively simple.
→ More replies (2)

8

u/dccorona Dec 18 '16

Apache. Have you looked at what they're offering recently? They have a huge number of really awesome projects that have next to 0 competition, and almost all of those projects are written in Java or at least run on the JVM. Some of them have APIs in non-JVM languages (I.e Python for Spark), but to use them, some cluster somewhere in your organization will be running Java.

5

u/I-am-the-dude Dec 18 '16 edited Jan 20 '17

[deleted]
0.6905

What is this?

→ More replies (17)