7 ms·
My problem with Java is that C# exists which does huge portions of the stuff Java excels at just… better. Before, .NET only ran on Windows which disqualified i
by jeroenhd 4y ago
My problem with Java is that C# exists which does huge portions of the stuff Java excels at just… better.
Before, .NET only ran on Windows which disqualified it from many serious applications server deployments. Today, this is no longer the case for everything but cross platform GUI libraries, and even those are an option if you're okay with not having Linux support.
It's more akin to the old car you had just before you bought your Corolla. It was also pretty decent, but it was starting to have issues.
The JVM ecosystem is quite expansive and it's capable of running many things that would be a pain to develop in house (or pay a third party developer for). However, Java isn't the only popular JVM language anymore and you're no longer forced to use Java to interact with its surrounding ecosystem.
The language and the ecosystem around it aren't going to go away for at least a decade, but I think it'll slowly move the way of COBOL and FORTRAN: perfectly good languages, with perfectly good situations they outperform their competitors in, practically exclusively used for niche use cases and legacy software systems.
- pron 4y ago> but I think it'll slowly move the way of COBOL and FORTRAN That could be true of any language that's achieved great popularity, but in 2022 Java is the language that dominates server-side development (by plurality, not majority), it is a technological leader in areas of compilation, garbage collection, and low-overhead in-production profiling, no other single language looks posed to seriously challenges Java's dominant position on the server (as PHP seemed for a while), and, at 27, it is more popular than COBOL was in its (rather short) heyday. But it is true that Java is among a select set of languages (alongside Python, JavaScript, and C) that have managed to achieve a level of success sufficient to become "a COBOL" or "a Fortran" someday.
- amanaplanacanal 4y agoAren't most of those benefits from the JVM rather than Java itself?
- pron 4y agoFirst of all, what most people call "the JVM" is really called Java. Java = libraries + VM + tools + language. Of the ~8 MLOC in the JDK, the Java language compiler and Javadoc make up around 200KLOC; the VM makes up about 1.5M. What is sometimes colloquially known as "the JVM" is really everything except the language, of which the actual JVM is pretty small. Second, while the JDK is pretty modular (e.g. you can use the runtime and tools but not the frontend compiler as "JVM languages" do), we design every feature by looking at the platform as a whole. E.g. the relatively new records feature is implemented in the language, libraries, and VM. That's why some newer Java platform languages have more baggage than the Java language, because their features are not harmonious with the direction of the libraries and VM (e.g. Kotlin's coroutines and data classes). Finally, it is true that back in the '90s, James Gosling set out Java's strategy to put most innovation in the runtime and keep the language very conservative (he called it "a wolf in sheep's clothing"), and we follow that strategy to this day, because it's turned out to be very successful. While there are lots of programmers who want more adventurous, feature-rich languages -- and many of them hang out here -- the vast majority of programmers don't. Many more people complain that the Java language is changing too quickly than changing too slowly. So it is thanks to the conservative language that the platform is so popular, which allows us to have the resources to innovate in the runtime. So while <10% of people using Java do so with another language (no single alternative language has gained more than 5% of the platform's ecosystem) -- and we're happy we can accommodate everyone -- the conservative language is a necessary component of making the runtime state-of-the-art. A combination of an innovative runtime and a conservative platform is what most people want, and that combination is the main benefit.
- mwcampbell 4y ago> no other single language looks posed to seriously challenges Java's dominant position on the server (as PHP seemed for a while) What do you think about JavaScript in this context? JavaScript seems at least as popular among today's full-stack web developers as PHP was 15-20 years ago. V8 might not be as optimal a runtime environment for servers as HotSpot, but that won't necessarily diminish the language's popularity.
- pron 4y agoJavaScript is very popular overall, possibly more than Java, and it is, without a doubt, the dominant client-side language, but its prospects on the server are currently not as rosy as they were five years ago. It's never materialised as a solid, responsible choice for big, important, server-side applications, and it's lost the coolness factor it had when Node was young. The market is much more fragmented than it was in, say, 2004, and so Java is not likely to regain its anomalous overwhelming dominance it had back then anytime soon, but no other language seems posed to do that, either.
- thankful69 4y agoC# is not a better Java by any means, Java has a more diverse and greater ecosystem, you have plenty of choice for tooling, IDEs, libraries, platforms, etc... With C# you are pretty much stuck with Microsoft which everyone knows what that means (.net core runs everywhere, but still attached to msft in many ways), if you are serious about the C# ecosystem, you need to use Windows, C# IDEs outside of visual studio are mediocre at best. If you like running a operating system that doesn't give a f** about your privacy and developing for that platform then sure. There is a reason why C# (even with Msft huge lobbying efforts, not only to the goverments but to dev communities) have been relegated to boring(and sometimes dying) industries which get huge discounts for using Azure. EDIT: typos
- solarkraft 4y agoI agree with most of your points, but also really dislike Visual Studio. Rider has very good compatibility (unless you care about the constant hangs and crashes and buggy, nonsensically laid out eye sore UI and dumb defaults and ...) and VSCode (the one with all the proprietary Microsoft stuff) is quite usable. What kind of blew me away was finding out that they support Jupyter notebooks now. The Visual Studio team seems to dislike dotnet supporting other platforms, but it's one of the most critical things for its survival. The more the VS team hates it, the more likely it's to be the right choice (probably a good rule of thumb for building IDEs too).
- cutler 4y agoMicrosoft's multi-platform play is only skin-deep. Witness the lag in features for Visual Studio for Mac which will not be getting .Net MAUI compatibility until a long time after the Windows version.
- solarkraft 4y agoVisual Studio for Mac is yet another branding fail. It's just Xamarin/Mono Studio and has very little to do with the VS code base.
- dijit 4y ago
- babypuncher 4y agoC# is like Java except your team can churn out new features 30% faster. At least that is my experience running the only .NET team at a company that primarily runs Java.
- bcrosby95 4y agoWhat stuff does C# objectively do better than Java?
- solarkraft 4y agoCan't really be objective here. You could also argument this makes it worse, but it gives you to take shortcuts for things Java would make very hard or cumbersome (unsafe code, properties).
- titzer 4y agoGenerics, LINQ, structs, delegates, to name just four.
- hhjinks 4y agoCan you explain why you think C# does those things better than Java? And what they correspond to in Java?
- titzer 4y agoSure. Reified generics, along the lines of C#[1], rather than Java, is the only sane design. Erasure of generics works fine in languages that have the "parametricity" property, where you cannot observe any characteristics of a polymorphic value. That doesn't hold as soon as you have casting. Java generics have a couple of unfixable problems. For one, you can have List<Foo> and List<Bar> both be passed to a place where Object is expected. But getting them back from that place and trying to recover what was known at creation time, would normally be done with a cast. But List<Foo> and List<Bar> are not runtime distinguishable from each other. Such a polymorphic cast in the code is just syntactic sugar; you'll get a compile-time warning, but no runtime check! E.g. You can get a naked List and cast it to a List<Bar> and then go ahead and try to use it like a List<Bar>. It will only fail when you get an actual non-Bar thing out of the list. It pointedly won't fail if you take your List<Bar> and pass it to other generic code that does more generic stuff with it. And it won't fail if the list is full of nulls, is empty, etc. In essence, it's completely dynamically typed at that point. The static generic types are lies. In reality, all generic Java code compiles down to non-generic code with runtime casts everywhere. That costs performance and means that you can screw up. Second, erasure also means that you cannot be polymorphic over primitive types in Java, as the VM doesn't support that in the bytecode. So you can't write really basic stuff like Vector<T>, array sorting code, and now, closures and lambdas, that manipulate primitives. All that has to be duplicated, once per primitive type, and for objects. Or you have to box stuff. So they added implicit boxing (autoboxing) so you don't have to type those characters. But they are there in the code. You're stuck with either duplicating for performance (hand-doing template specialization, if you will), or just creating an assload of garbage. [1] I say "along the lines of". I designed Virgil's generics system not knowing C#, but working from what I knew from ML. It ended up with a lot of the same choices, but I mapped ML's "unit" onto "void" and that works out nicely for zero-arg and/or zero-return functions. You can even have an Array<void> in Virgil! And none of it creates boxes or introduces unsafe casts.
- pwinnski 4y agoIt's hard to see how C# will ever find wide usage outside of the MS ecosystem. It's so intrinsically tried to MS.
- cutler 4y ago.Net 6 runs on Linux with, for example, PostgreSQL so how is that tied to M$?
- ahartmetz 4y agoMS still controls it in practice, and MS is still playing a complicated game with Linux, with goals that have nothing to do with "MS <3 Linux".
- cutler 4y agoYes, the scandalous SCO lawsuit and subsequent Linux patent racket make it impossible to believe M$'s Linux fud.
- hoffs 4y agoWhat
- cutler 4y agoGoogle "SCO lawsuit Microsoft". For years around the same time Microsft also extorted huge sums from Red Hat and Suse Linux for unproven patents which they claim Linux source code infringed. The two companies figured it would cost them less to pony-up rather than fight M$ in court.
- pwinnski 4y agoBy ownership? MS has chosen to let .NET run on platforms not owned by MS, but they are still controlling product direction.
- lenkite 4y ago> My problem with Java is that C# exists which does huge portions of the stuff Java excels at just… better. Might want to give some evidence of this. Also, C# has no plans of green threads. It went the async/await way which is a pain.
- al_mandi 4y agoNot to mention the slew of GCs that are available on the JVM which are second to none.
- akra 4y agoI don't feel its the biggest pain to be honest, at least not in the .NET world where the Async API is so persuasive. I don't think the paradigm would suit Java - the API changes to make it ubiquitous would make it take too long to add value. People seem to code with it (the Async workflow) just fine, and it's a decent model to write some async algorithms. For example firing a few in parallel, starting a task but leaving it running and awaiting it later, etc. The advantage for me is that there is some overhead with Async dispatch - the abstraction of coroutines, green threads, etc is cheap but isn't free and maybe seeing where it could prop up isn't always a bad thing. There is value in knowing that an operation could be async, at least in my time programming and it has a cost that you may not want to pay, defer, delegate to someone else, etc especially in hot loops (e.g. IO). As a single anecdote working in both languages in my current job in a cross platform environment when having to write Java it feels just that bit more painful, and just that bit harder to get the same performance for the class of apps I write. YMMV.
- deezleguy 4y agoThat may not be true according to David Fowler: https://twitter.com/davidfowl/status/1532880744732758018?s=20&t=JA1wlkSuecZQheT_DAhskw https://twitter.com/davidfowl/status/1532880744732758018?s=2...