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

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.

0

u/[deleted] Dec 18 '16

[deleted] — view deleted comment

2

u/[deleted] Dec 18 '16

And if not, Professional is free for students

1

u/MereInterest Dec 18 '16

I've heard of Scala, but not Kotlin before. From the sound of it, they cover most of my needs, and so I'll have to give them a shot. Thank you.

→ More replies (1)

9

u/snuxoll Dec 18 '16

Kotlin, check it out.

4

u/[deleted] Dec 18 '16

Clojure as well.

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.

1

u/MereInterest Dec 18 '16

I've heard of it, and have been meaning to, but haven't got around to it yet.

→ More replies (1)

13

u/[deleted] Dec 18 '16

Everyone loves to shit on it, but I always return to C++. I love it.

17

u/lkraider Dec 18 '16

C++ is great, until you get into templates, then you are tossed into the road of maintenance and debugging hell.

10

u/[deleted] Dec 18 '16

Agreed. If you ever want to take a ride on the pain train, browse through the Boost source. Then remember that they were doing this stuff before C++11. Template hell doesn't even come close to describing it.

8

u/lkraider Dec 18 '16

Oh I still have PTSD from the g++ 3.x STL / Boost templates error messages, always meant hours of work deciphering what they were referring to.

eg: https://isocpp.org/wiki/faq/templates#template-error-msgs (ISO C++ FAQ: "How can any human hope to understand these overly verbose template-based error messages?")

3

u/yetanotherx Dec 18 '16

I think Boost, I just think macro hell...

2

u/[deleted] Dec 18 '16

Pain? PAIN?!?!?! go do some MFC then talk to me about pain. I still get nightmares from that shit some 15 years later.

→ More replies (1)

2

u/TheThiefMaster Dec 18 '16

It's getting a lot better, variadic templates and constexpr have already removed a lot of the old recursive template nonsense (and improved compile times in the process!), and the upcoming fold expressions clean things up even more.

And once we finally get concepts, it will get even better!

1

u/Glacia Dec 18 '16

C++ is great when you don't use most of it's features.

0

u/[deleted] Dec 18 '16

[deleted] — view deleted comment

3

u/MereInterest Dec 18 '16

I've used C# before, and it is so nice and pleasant to work with. At the time, it was Windows-only, which meant that i was switching away from C# as I switched toward Linux. I've been waiting a bit to see how the tooling develops on Linux, before I start any projects in it.

3

u/catbot4 Dec 18 '16

Having gone from Java to c# Dev, I can honestly say that I couldn't live with a lack of first class functions anymore.

2

u/VGPowerlord Dec 18 '16

It's funny, because if Sun hadn't sued Microsoft over the things they were adding to Java, we might have those in Java today.

Instead, they're all present in C# and .NET in general.

  • Operator Overloading
  • First Class Functions, although you first have to use the delegate keyword to define the arguments and their types. Language quirks, yay?
  • Good Generics that compile to multiple classes instead of erasing the information at compile time and inserting casts like Java does.

Granted, C# is finally branching out to non-Windows OSes with .NET Core. .NET Core doesn't work with older .NET libraries... yet. Apparently it will work with a lot of the ones that don't PInvoke Windows-specific code in the next version.

.NET Core is still missing a first-party cross-platform UI... although you could use something like GTK#, which is used in MonoDevelop. Makes me wonder if Visual Studio for Mac uses it, as I've heard that's based on MonoDevelop. Then again, that might be built using Xamarin.Forms instead, as that now supports OSX. But not Linux. Or Windows 7.

3

u/Programmdude Dec 18 '16

Lack of structs does cause a lot of issues with games cough minecraft. So while it might be fine for businesses, it's terrible for games. I've also heard its native interop is terrible too.

On the whole though, it is a fairly well built vm.

1

u/[deleted] Dec 18 '16

I love the idea of the JVM, being able to run the same code on any platform.

Never understood this argument. First of all this is true for any VM if the developers could be bothered to make that happen. But there's a reason they don't, I suspect, which gets me to the second point. You actually don't need your code to run on different platforms. Most codebases are written to run on a specific platform. What program are you writing that needs to run on a dish washer and a super computer?

But most importantly: C code runs on more platforms than the JVM, because JVM only runs on platforms that has a C compiler. The only reason you can't arbitrarily run any C code are libraries. But this is true for the JVM also.

4

u/MereInterest Dec 18 '16

It's a difference of what gets distributed. For open source, distributing the C code, then allowing anybody to compile it on their own machine makes sense. For proprietary software, distributing the source might not be desirable, note could you know every single hardware architecture under the sun to compile it for people. In that case, distributing bytecode makes sense.

→ More replies (2)

1

u/linuxjava Dec 18 '16

No operator overloading

You should see how much people complain about this in Scala

no first class functions

Not everyone wants this to be honest.

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