by w8rbt · 9y ago · 0 comments
I personally really like Java and I've used a ton of languages over the years. Not a perfect design but it's hard to think of any big downsides. The syntax is annoying at times but once you learn to use the IDE to poop out boilerplate it's not an issue
Java is a compiled language.
in my mind: interpreted = why would you ever use a language like this? VM = fast, safe, but going to use a lot of memory machine code = fastest, low level HW access, usually unsafe
Forcing all objects to be heap allocated which makes things like Optional introduce even more memory indirection because thrashing your cache is totally fine
No primitives in generics which therefore means no primitives in containers
Which then leads to the fun of autoboxing so that way your bools can be true, false, or null!
This whole setup helped me develop surprisingly large number of useful tools and apps which proved successful enough that snippets of my code and pattern are copied in proper 'enterprise class' projects at our company.
.NET core is still very immature, we had to back out every time we tried to use it in production. Maybe in a few years it will be good.
Java on the other hand has support for many IDE's, package managers, web servers, JVM's, OS's. You can swap out pretty much everything, no vendor lock in issues at all. The open source community is far stronger as well. So many times I wanted to use a cool database and found out there's no official C# client
- Everything Java does, C# does as good or better. In general for everything in Java you could easily find a better way to do it.
- Java has lots of warts, many to have the language be backwards-compatible. (switch-case, enums, UTF-16 encoding, generics, null, difference between objects and basic types,...)
- Java is tied to old technologies. There are no standard JSON libraries, however even XSLT is included in java se.
- You need to use Java with an IDE. Eclipse is horrible to use (even scrolling lags here) and IntelliJ costs money.
Still java is a mature and solid language. There is just nothing to hype about it.
- Every language has switch-case and enums? I don't get what you're trying to say there.
- Generics are fine?
- Every language supports null on objects?
- Nearly every language treats null and primitive types differently for performance reasons
- Java has three popular JSON parsers and they're all faster than .NET's builtin serialization. To get similar performance you need to use Newtonsoft which isn't builtin to C# either :).
- You don't need an IDE, it's just stupid to develop without one because they're so helpful. Nothing is stopping you from running javac on the command line.
You can't do a LOT of things java can do in C# because third party library support pales in comparison. A lot of databases and open source software don't have c# clients. If you're dealing with big data or ML you'll find almost nothing in C# land.
I feel like you haven't used Java in a long time. Things are much better than Java 6 days
- Java has the same horrible switch case with the error prone break as C. If you want exhaustive matching on enums you will end up with a useless default case. If you ever worked with a programming language with pattern matching you will feel the pain.
- This might be a bit opinionated but I think enums are not enough. Sum types/tagged unions/variant types/disjoint unions/whatever you like to call them are pretty useful.
- Generics in Java are highly limited. Part of that is because generics were added as an afterthought and are implemented using type erasure. Both functional programming languages like Haskell or imperative programming languages like C++ or Rust offer more powerful generics that can sometimes help abstract things more elegant.
- The problem is that all objects are nullable by default and you cannot specify that e.g. parameters or results are never null. This leads to boilerplate null checking and missing handling of null cases. Everybody that touched java probably saw quite some amounts of NullPointerExceptions. Kotlin for instance offers types that by default cannot be null, with TypeScript this exists if you turn on an option of the compiler.
- You can offer pretty much everything you offer for objects also for primitive types. In fact, this is what Project Valhalla tries with value types and specialisation.
- My comment on IDEs was more about the need to use an IDE being bigger with Java than for instance C, while eclipse is often annoying. I am using eclipse daily currently because I work on some Java code for my Master's thesis.
Really, why ?
I can't imagine working without an ide for any language. Back in the dark days I did html/javascript in notepad.
As others have said the open source community for Java is still leaps ahead of C#. It's not often you find a library which doesn't have a Java connector/implementation. For C# on the other hand you tend to be much more limited in your options.
I guess this used to be a lot due to the platform dependence of C# (and probably still is). Hopefully .Net Core can help with that, but it's not ready for prime time yet IMO.
It's really true. It's so refreshing switching from Java to C#. I mean, they're both statically-typed-OOP-garbage-collected-bullshit-enterprise languages, but if you're gonna go with one of those, C# is far more pleasant than Java.
Yes it is better than a lot of things, but it is also a super low standard. It get things done if you are ready to deal with all its problem... But it is still the child of its history, and its shows.
The security issues were mostly in Java applets. The language itself is pretty damn secure. I can't remember the last time I saw a web exploitable issue in the JVM.
There's still a lot of innovation going on in the Java community you just don't hear about it.
And i was not comparing Java to C# or Python here, but that is probably due to my personal background, which is more with OCaml, Erlang, C, Rust and co.