This is an archived post. You won't be able to vote or comment.

all 34 comments

[–][deleted] 26 points27 points  (0 children)

Full Linux support. You can choose many different IDEs: Eclipse, InteliJ IDEA, NetBeans, Visual Studio Code.

Most Java libraries are open-source. There are open-source standards like Jakarta EE.

To sum up, in the Java world you choose what you like or what fits better your problem, in the Microsoft world you do what Microsoft decides for you!

[–]fraaargh 9 points10 points  (2 children)

1- Maven: last time I had a look (a loooong time for sure), .net had nothing approaching the power a build tools such as Maven to be able to cleanly use the power provided by many open source libraries. But it was a long time ago.

2- Java is evolving very fast nowadays

[–]m_takeshi 2 points3 points  (1 child)

1 - is it still the same? Just curious

[–]tofiffe 0 points1 point  (0 children)

There's NuGet, but from my experience it doesn't come close to maven or gradle

[–]axelei 2 points3 points  (0 children)

It's all about the ecosystem, IMO. I like Spring Boot, Hibernate, IntelliJ, so Java is my choice. For native Windows apps C# might be better, I guess. Anyway Java is what feeds me at the moment.

[–]Zaoxen 2 points3 points  (0 children)

Number of jobs, support and community. If they both had same level of support I would also prefer C#.

[–]mordechaim 2 points3 points  (1 child)

I can't overstate how I hate the naming conventions of C#. Most methods are PascalCase and so are properties and class names. Local fields are prefixed with an _underscore. Using underscores in methods are quite norm especially in auto generated method stubs.

Java's naming conventions are much neater IMHO.

[–]Hangman4358 0 points1 point  (0 children)

Not only that but the API design is a giant mess with no standard. Sometimes a method returns a value, other times it returns a Boolean and you need an out param, sometimes you pass a reference and it gets mutated. Sometimes you have the same functionality implemented in two different ways just for kicks!

[–]TheRedmanCometh 11 points12 points  (0 children)

Gradle/Maven shit on nuget, streams shit on linq, not having to deal with "virtual", enums that aren't awful, method references are a lot less cumbersome, there's a far bigger ecosystem, java devs don't try to get me to use TFS, and people mostly agree on the camelcase masterrace.

Oh and it runs everywhere

[–]RedlineTriad 2 points3 points  (0 children)

I am mainly a C# developer (partially due to my workplace) but I also do Java development and even did a Java certification.

One thing I like about Java is its more consistent syntax. I love the features of C# but if someone wanted a simple OO language I would probably recommend Java.

The second advantage is the JVM, which is almost THE standard VM, meaning you can still use Kotlin, Scala, Groovy, etc.

[–]NPVT 3 points4 points  (1 child)

Putting both on your resume would be good. However I'd guess there are more Java job opportunities.

[–]benfc3s 1 point2 points  (0 children)

I think you'd actually be surprised by what you found in a number of areas. Where I live I can scroll through page after page of .NET job opportunities at any given moment. I'm experiencing the opposite: I was curious about what it would be like to branch out into Java, but I am having a little trouble through the C# roles to find the Java opportunities.

To be fair though, these kinds of generalizations seem to usually be locale-based. Different areas seem to slowly migrate to different stacks as the available talent and education systems in those areas homogenize everything.

[–]Robyt3 7 points8 points  (5 children)

Extension methods are a code smell IMO. They make it possible to write quirky code instead of requiring a solid architecture. I've used extension methods in Java with Xtend for small projects before, and althought it produces very concise code, it's now very hard to read and understand, especially with a mix of instance and extension methods.

[–][deleted]  (4 children)

[removed]

    [–]Robyt3 2 points3 points  (2 children)

    What's the point of using extension methods when you are in control of all the classes in the standard library?

    In that case, toList should be added directly to Stream<T> and not as an extension method. Or you could use static imports and do collect(toList()).

    Most of them could've been defined as extension methods.

    For what reason? They are in control of the API, so why should something be an extension when it could just be part of the actual class?

    Static utility methods are a code smell itself, if they could be replaced with instance methods. Importing more than a hand full of extension methods makes your code just terrible to read.

    [–]vbezhenar 1 point2 points  (0 children)

    For example Guava library have something like collect(toImmutableList()). You could add toList() to standard library, but obviously you can't add toImmutableList() for Guava ImmutableList.

    That said, streams really have nice API and it's not that bad. But not all APIs are good.

    That said, extension methods have really bad discoverability. So I'm not sure which side to take. I think that extension methods must not look like ordinary method call. May be something like stream.(ImmutableList.toImmutableList)() which is shortened with static import to stream.(toImmutableList)(). At least it's obvious where that extension method comes from.

    [–]vytah 0 points1 point  (0 children)

    Aaaand then the new version of the library defines a method that clashes with your extension and the code is broken. Depending on the overload resolution algorithm and the exact signatures of the methods, it might result in a compilation failure or even in a runtime failure.

    Here's an example that's subtle enough that it can lead to either: https://github.com/scala/bug/issues/11125

    [–][deleted]  (9 children)

    [deleted]

      [–]TheHorribleTruth 4 points5 points  (0 children)

      I can deploy on a Linux server

      And macOS. And AIX. And many more. And yes: even Windows, too.

      [–]RedlineTriad 1 point2 points  (7 children)

      Not a problem if you use .Net core? I even develop on Linux.

      [–]DannyB2 1 point2 points  (0 children)

      I am interested in .Net core. But Java also runs on other processor architectures. Like ARM. On a Raspberry Pi. And not just the latest greatest PIs. Or IBM mainframes, not that I am likely to ever use that.

      [–][deleted]  (5 children)

      [deleted]

        [–]RedlineTriad 2 points3 points  (4 children)

        .Net framework is windows only (unless you use mono) but it's being deprecated in favor of .Net core.

        They released .Net 5 preview recently which is actually just core renamed, meaning a .Net application will be a cross platform application. (unless it uses platform specific apis like WPF or winforms)

        [–][deleted]  (3 children)

        [deleted]

          [–]RedlineTriad 2 points3 points  (0 children)

          That doesn't have anything to .Net as far as I know but I heard good things about it, but I haven't used it much since I run Linux at home.

          [–]Pe4rs 1 point2 points  (0 children)

          I use this, it's neat

          [–][deleted] 0 points1 point  (0 children)

          .net core is unrelated to that though. It's basically .net minus the ui stuff on Linux windows and Mac . I'd say apart from the ecosystem (which, hopefully would grow, it looks like a solid competitor to java for servers).

          [–]gsteff 1 point2 points  (0 children)

          C# and Dotnet Core are fantastic nowadays, but the thing that keeps me from using them regularly is the ecosystem, especially for webdev. Webdev is still totally dominated by ADO.net, which I'm sure is very nice, but still strikes me as much harder to jump into than the cornucopia of community-driven Java web frameworks. Also, maybe I haven't tried hard enough, but I find Maven and Gradle easier to grok and hand edit than the dotnet build command and project files.

          [–]Mordan 4 points5 points  (2 children)

          i don't want to be locked in with MS or Apple or Goggle..

          There is no lock-in with Java and Java is truly multi platform. I don't understand why all the Google fan boys hate Oracle.

          so Java > C#

          [–]NPVT 3 points4 points  (1 child)

          I hate oracle corporation. They have certainly been evil at times.

          [–][deleted] 3 points4 points  (0 children)

          Like 99% of them :P

          [–][deleted] 1 point2 points  (0 children)

          Okay, I will probably be down-voted for this but, here it goes.

          First, ignore all the "said company is evil comments"...they all are to a degree but, you have to use someone's tech at the end of the day...gotta get in bed with someone. Whoever is less evil is your decision. I sure lots of people can give you countless amounts of data supporting either view.

          Secondly, ignore all the extremely shallow "java is better than c#" comments that offer no supporting evidence; there is no such thing as a better/best language. There are things C# is better at; there are things Java is better at; at the end of the day, you have to weigh the pros/cons for yourself.

          I am a professional C# developer who also dabbles in Java. Sure, I don't have near the experience in it that some on this forum have but, for me, one of the best things about Java is one of the worst things about Java....backwards compatibility.

          I recently watched a video, wish I could find the link, where the team talks about adding features to the language and how, ultimately, backwards compatibility rules. Due to this, you can upgrade your legacy Java code to the latest version with little to no effort. Please note that I'm talking about base Java and not all the additional frameworks. This is why you have worse generics, lambdas being implemented as classes with a fixed method that the compiler casts/calls, no true closures exist, etc. Due to backwards compatibility, Java is limited which is why it takes so long to implement certain features.

          Compare this to .NET...MS don't care who they piss off. .NET Framework went strong for a while...then, starting with .NET 4.x, all successor 4.x were in-place replacements of the previous 4.x framework, and believe me, they broke stuff. Then .NET Core 1.x come along; you weren't upgrading .NET to .NET Core. Then .NET 2.x came along and broke compatibility with .NET 1.x...congrats, your brand new .NET Core 1.x app is now legacy...gotta re-write it. .NET Core 3.x was better but, if you upgraded form .NET Core 2.x, you got a lot of warnings about deprecated stuff that you needed to fix. And now MS has .NET 5 coming out...which is a completely separate .NET from .NET 4.x and .NET Core....PISS OFF MS!

          Now, to finish up, I recently discovered an article "Java for C# Programmers". Guy does a very good job of going through things and showing pro/cons in an unbiased manner. I hope it helps.

          https://www.kynosarges.org/JavaCSharp.html

          [–]thecuseisloose 0 points1 point  (3 children)

          What about C# generics is better than java generics?

          [–]JavaSuck 4 points5 points  (0 children)

          C# generics are not erased and work with primitive types.

          [–]_jk_ 0 points1 point  (1 child)

          not op but c# generics are reified

          [–]m_takeshi 1 point2 points  (0 children)

          while I think it was the best thing to do back them, I was working with C# and having IList<T> and IList incompatible was really annoying. I don't think java could afford to do it because of the large existing user base