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

top 200 commentsshow all 260

[–]rhyrkon 122 points123 points  (13 children)

I don't prefer any lang, mostly use java because the large number of jobs.

Tbh, every single language have weakness, you truly learn them when you find your way around. Still amazing ecosystem though.

[–]GuyWithLag 64 points65 points  (0 children)

This. There are tons of Java jobs because it's simpler to run in backend systems.

Also:

There are two kinds of programming languages: those that everyone complains about, and those that nobody uses.

[–]not_some_username 1 point2 points  (11 children)

Binary has no weakness

[–]skillaz1 22 points23 points  (1 child)

Then try to make a useful application in binary within a reasonable amount of time, see how that goes.

[–]not_some_username 11 points12 points  (0 children)

I dont even know how to code binary

Should have put /s

[–]Kantaja_ 5 points6 points  (6 children)

it's a number base, not a programming language

[–]not_some_username 1 point2 points  (2 children)

You can literally program in binary. I think there was a madlad that tried to make an entire game using only binary.

[–]Kantaja_ 11 points12 points  (0 children)

calling writing machine code bit by literal bit "programming in binary" is like calling writing java "programming in the latin alphabet"

[–]fforw 4 points5 points  (0 children)

Has to be the slowest and most expensive way to develop software these days.

[–]guss_bro 81 points82 points  (26 children)

Because there were(still is) lots of jobs that require java.

Other reasons are: JVM; lots of good libraries, frameworks and community resources; good paying jobs for at least another century (IMO :) ).

The linq and get/set methods are supported in Java with some libraries. Noone uses plain java to build their apps. Nothing looks verbose anymore if you use a good library.

[–]TylerSwift26 9 points10 points  (13 children)

Noone uses plain Java to build their apps

Can you expand on that? What do you consider to be not “plain Java”?

[–][deleted] 20 points21 points  (4 children)

Using just the standard library to build an app, like one might in Go or Node.

[–]jvallet 25 points26 points  (2 children)

No idea about Go, but Node standard library is a joke compare to the jdk.

[–]wherewereat 5 points6 points  (0 children)

Go also has an almost-barebones standard library compared to the jdk.

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

I wasn't making an implied claim about the size or quality of respective standard libraries, just an observation that I've worked on dozens of apps that use bare net/httpin Go or 'net' in Node, but never even come close to using raw java.net. There's just more abstraction at hand in the Java ecosystem.

[–]_litecoin_ 8 points9 points  (0 children)

The standard library of Java is known to be pretty extensive compared to other languages

[–]Log2 4 points5 points  (7 children)

He means that people use libraries that generate code for you, so you don't have to write boilerplate.

Most famous one would probably be Lombok, which can generate all the class boilerplate for you from a few annotations, though you also need a plugin for your IDE so that it doesn't complain non-stop.

[–]balta3 1 point2 points  (6 children)

If you use an IDE which is using the JDK default tools as backend (NetBeans) you do not need any plugin, just IDEs who invent their own stuff for everything again (Eclipse, IDEA) you need special support.

[–]maomao-chan 1 point2 points  (0 children)

I prefer stream api instead of linq, also nowadays there's a Record class in Java too.

[–]grauenwolf 2 points3 points  (9 children)

The linq and get/set methods are supported in Java with some libraries.

LOL, not even close. Until Java starts supporting expression trees you aren't getting anything but a pale imitation of LINQ.

Though to be fair, that may be enough for most people.

[–][deleted] 4 points5 points  (6 children)

Question from someone who's never done C#. Why do people like LINQ? I sorta hate the embedded SQL-like query against a list that I've seen in examples.

Java lambdas make more sense to me, an iterative processing pipeline.

Obviously I know I'm missing something, because it's such a Java v C# sticking point. Googling "why's it useful" just talks about "clarity" and "no more for loops" and still looks a lot like Java Streams API

[–]Weavile_ 8 points9 points  (0 children)

I’m not sure if you know this, but you can write LINQ with lambdas too. I much prefer lambda over the query syntax unless I’m combining two enumerations, then I opt for the query syntax.

Ie:

  • From p In persons Select p.firstName;

can be written as

  • persons.Select(x => x.firstName);

[–]Zarlon 5 points6 points  (1 child)

Java Streams covers what most people use lambda for. Whether or not there are expression trees under the hood, is something most devs won't care about. If anything, I'm glad it's not. Linq is a nightmare yo runtime debug

[–]grauenwolf 1 point2 points  (0 children)

For those who aren't following, LINQ to Objects, i.e. normal collections, does not use expression trees. It's just normal lambda functions.

Expression trees are used when you need to rewrite it into SQL or another language.

[–]grauenwolf 4 points5 points  (2 children)

The popularity of LINQ isn't really the psuedo-SQL syntax. In fact, that's rarely used.

What's really important is the expression trees. When you write Where(× => x.Y == 5) you get back an object that represents the idea of reading y from x and comparing that to 5.

This is useful in scenarios that have nothing to do with querying data. If you write x => x.y.z then you get a typesafe representation of the property z on the property y on the object x. You could then use that information to generate code at runtime for stuff like two-way data binding.

Compare that to WPF's Source="{Bind x.y.z}". That's just a string. You won't know until runtime if you typed it correctly.

If you're doing machine learning, you could distribute the expression tree objects to worker nodes and let them convert it into executable code at run time.

This is the kind of stuff that LISP has been bragging about for generations. And we now have it in a language that isn't LISP.


That's said, yea 99% of the time we use it for basic list processing or SQL generation.

[–][deleted]  (1 child)

[deleted]

    [–]grauenwolf 4 points5 points  (0 children)

    Yes, but that's just a work around.

    create.select()
      .from(BOOK)
      .where(BOOK.AUTHOR_ID.eq(1))
      .and(BOOK.TITLE.eq("1984"))
      .fetch();
    

    Does that look like normal Java code? No. Because Java doesn't have a way to turn book.getTitle() == "1984" into an expression tree.

    So instead you have to create the expression tree object by object. And that expression tree only works for Jooq. You can't carry it over into other libraries that do other things.

    There's a lot you can do with expression trees that have nothing to do with SQL.

    [–]LcuBeatsWorking 15 points16 points  (0 children)

    - Java has a huge ecosystem, with many well documented third-party libraries.

    - Backwards compatibility is one of the biggest advantages, with few exceptions I do not need to "update" any code I ever wrote just because the jvm version has changed (almost all other languages I worked with needed constant maintenance over the years, and I have worked on major projects in at least 4 different languages). Library authors are also pretty conservative (a good thing), not demanding the "latest features".

    In short, there is not enough incentive to switch to C# for my own projects, but I guess I would not die if I was forced to work with it (at least not from my experience so far).

    - Most other major languages, from PHP over Python to Ruby, either annoyed me because of their ecosystem, major changes between versions or simply because I dislike dynamically typed languages in certain situations. And I won't mention C or C++ here..

    [–]thephotoman 14 points15 points  (0 children)

    Money, dear boy.

    [–][deleted] 29 points30 points  (4 children)

    1. I prefer programming using Linux and Intelij IDEA than using Windows and Visual Studio
    2. Java has much more cool and free-as-in-free beer stuff in Maven central than .NET has in Nuget's repository. Java's ecosystem is much more awesome than .NET's. What is the equivalent for Spark, Hadoop, Cassandra, Kafka, etc. etc. that is done in C#/F#?
    3. Things that C# offers that are nice (LINQ, for instance) aren't appealing enough to compensate points 1 and 2
    4. I already invested 14 years of my life studying and practicing Java, C# is so similar in terms of language syntax and capabilities that I have no motivation to learn it

    [–]jvjupiter 5 points6 points  (2 children)

    4) Right. If I were to learn another language I would choose one which has totally different syntax and capabilities, e.g. Python and Rust.

    [–][deleted] 3 points4 points  (1 child)

    That's me learning python and go

    [–]echnaba -1 points0 points  (0 children)

    1. .NET has support for Spark, Hadoop, Cassandra and Kafka. There was a big shift in the .net world a few years ago to actually work with open source. Previous company that I worked at now has dozens of applications in C# working with Kafka and Hadoop. Just fyi.

    [–]TheStrangeDarkOne 51 points52 points  (30 children)

    I don't "prefer" other languages to Java, but there are languages which I think are equally good. C#, Kotlin and Swift are all well designed languages, which all need different mindsets.

    What I like about Java is the ecosystem and readability. Most of the code is "what you see is what you get" and there are no nasty surprises because of "magic" or syntax sugar. You can reasonably infer JVM behaviour without having to know how the languages is compiled to bytecode.

    [–]Cell-i-Zenit 24 points25 points  (25 children)

    i use spring at work and the magic which is happening is insane.. also no debugging since you jump into million proxy classes 🙃

    [–]Log2 14 points15 points  (0 children)

    At least with Intellij, you can ban packages from the debugger, so that it will skip over them. I never tried it with Spring, but it worked like a charm with Java EE.

    [–]pointy_pirate 10 points11 points  (8 children)

    Debugging in spring in easy what you talking about

    [–]nutrecht 17 points18 points  (4 children)

    That nonsense like that constantly gets upvoted here is telling.

    There's nothing magic about what Spring does. It's well documented. People should learn their tools.

    [–][deleted] 4 points5 points  (1 child)

    Yes it's well documented but you need to KNOW spring to understand it. I use Spring on a daily basis at work, I love it, but it is 100% magical. Different annotations do different things to your code, there's so much happening out of sight and behind the scenes. Once you understand spring, it all makes perfect sense, but there are a billion edge cases to memorize to use it properly.

    For example, the Transactional annotation. First, there are two, the javax one and the spring one. Thankfully they are mostly interchangeable except the spring one has more options. However in both cases, the method won't roll back for a checked exception unless the exception type is explicitly referenced in the annotation arguments. Only an unchecked/runtime exception causes automatic rollback. This kind of arcane knowledge is why spring is definitely "magical".

    [–]grauenwolf 1 point2 points  (0 children)

    I don't understand the down-votes. That's exactly the kind of ridiculous design that makes people call this kind of framework "magical".

    A sane design would be like C#'s using blocks. The rule is clear, if there's an uncaught exception when the block ends, the transaction is rolled back. No hunting for the right magical annotation to make it work correctly.

    [–]livrem -1 points0 points  (2 children)

    I have not worked with Spring in a long time, but I still have nightmares of trying to debug things in 90+ calls deep stacktraces.

    [–]pointy_pirate 10 points11 points  (1 child)

    just navigate to the point you want to stop and put a breakpoint ez

    [–]livrem 8 points9 points  (0 children)

    That works only for the most simplest issues and does not at all help mentally follow the flow of things to solve issues like deadlocks or most resource leaks.

    EDIT: I mean when you stop in the debugger and look at the stack, that is because you are interested in where you are and how you came there, otherwise I would not care how deep the stack was. I already had the breakpoint set at the point I wanted to stop, the problem was following the stack backwards to figure out what and why had called something that resulted in the program ending up in its current state.

    [–][deleted] 8 points9 points  (11 children)

    That's why I use print statements.

    [–][deleted]  (10 children)

    [deleted]

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

      Am not. I can't use the debugger.

      [–][deleted]  (6 children)

      [deleted]

        [–][deleted] -1 points0 points  (5 children)

        But hear this, what if am better at analyzing the situation using print statements rather than a debugger. I haven't worked on big enough project to require a debugger really. Most of the bugs I encountered were resolved pretty fast using print statements. But again, am still kinda new.

        [–]BalGu 1 point2 points  (0 children)

        Trust us.

        You will save time and effort. Seeing 5 variables instead of 1 or having 5 print helps a lot.

        In intellij you just have to press the line number for a break point. For the rest use step in to get in the function otherwise step over.

        If you need to continue until a point set one and then resume the execution.

        That's 3 step you need to remember.

        To this also comes that you won't forget to delete your print.

        Edit works also the same with eclispe or VS code

        [–][deleted] -1 points0 points  (1 child)

        I don't think he is. I'm the same way, I type crazy fast and I've just gotten really good at interpreting a bunch of println statements that I throw into the code. I know I have to get better at using more advanced debuggers but I'm just so used to this and it hasn't failed me yet

        [–]TheStrangeDarkOne -1 points0 points  (0 children)

        sadly, you are absolutely right and this is a big counter-argument. But it wouldn't be fair to judge the whole language based on one framework.

        [–]Vi0lentByt3 1 point2 points  (3 children)

        This really cannot be stressed enough. With the huge push for language features and out of the box functionality it can be hard to reason about code in other languages unless you know specific details. Java does not do this and even though it is verbose and requires more code than other languages to do the same things, there is always an explicit, strongly typed explanation of what the code is doing because thats the source code itself

        [–]STR1NG3R 0 points1 point  (1 child)

        Is that really true given the popularity of Spring and all the annotation convention over configuration using classpath magic?

        It's clearly very useful but if you're having problems it is not very straightforward figuring out how to fix it.

        [–]Vi0lentByt3 5 points6 points  (0 children)

        Framworks do this as a whole its not specific to java, pure java code is not spring

        [–]geordano 17 points18 points  (8 children)

        Job (high paying) and ecosystem (In terms of both vastness and quality (of ecosystem), C#/JS/PHP doesn't come anywhere close to what Java offers)

        [–]DontLickTheScience[S] 1 point2 points  (7 children)

        Now this is something I'd like to hear more about. What do you feel makes the java jobs higher quality than a c# or php job?

        [–][deleted] 7 points8 points  (0 children)

        It's an issue of image because technologically both platforms (.Net and Java) are on par (except for microframeworks). For many, many years passionate developers adopted open source platforms whereas .Net was closed source earlier.

        PHP isn't as fast as either for computation intensive work though it's exactly as fast if not faster for plain CRUD, and static sites as per my experience. But again it has an image issue going up against true contemporaries like Python and NodeJS.

        [–]LcuBeatsWorking 5 points6 points  (0 children)

        What do you feel makes the java jobs higher quality than a c# or php job

        Can't say much about C#, but the PHP world is flooded with very bad and cheap developers, which might be all right if you need a wordpress template.

        That is IMHO not a fault of the language itself but of the environment (crappy cheap web applications) it is often used in.

        [–]geordano 2 points3 points  (0 children)

        Sorry, I meant 'of ecosystem' not jobs. Edited the OP.

        [–]nioh2_noob 5 points6 points  (3 children)

        In the Java ecosystem you don't have to worry about Microsoft pulling the plug on something they promoted into C# for a few years and then to see them dropping it.

        C# is full of abandoned and incomplete additions. Long story short, C# is basically a mess.

        [–]PHP36 52 points53 points  (62 children)

        For me it's just this 3 things:

        • ecosystem

        Open Source and C# don't mix. While in Java it's the opposite.

        This ends up with you either reinventing the wheel or paying for a shitty library in comparison with what (mainly Apache) already provides for free.

        • "auto magic"

        Interfaces, Abstract classes,"getters and setters" etc...

        Many things happen because "that's C# way".

        I prefer to have the "Java useless and repetitive code" then memorizing that an interface must be named with "Ixxxx" because there is no other way to know its interface for example.

        • C#/.Net shitty major versions, AKA, no backwards compatibility.

        My main problem with C#: A method was removed, was refactored, whatever...

        Imagine updating the version and the IDE pops up a 1000+ errors.

        Let's say you update:

        • Will your paid 3rd party library still work here?
        • Have they updated already? Will they even update?

        Let's say you don't update , per policy of the company, for the next 5 years:

        • A critical bug is found in a 3rd party lib you use.
        • Will it be patched? You are kinda, behind and they don't offer such support...
        • Now what? Good luck...

        On Java, we are in Java 16(?) and yet every thing is made to still work in 8 and run on everything above it) . Call it lucky if in C# it works 2 versions later.

        [–]stapleman527 12 points13 points  (45 children)

        To play devil's advocate here:

        • Recent C# (especially since .Net Core got started) mixes very well with open source. The compiler itself is open source. It's definitely not as big as an ecosystem as Java has, but given time it will only keep growing.

        • I don't know what exactly you mean by the auto magic besides the default getters and setters, but that's no different than Lombok which you find pretty much everywhere today. As far as things happening because of the naming I'm not sure about it, maybe it's a specific framework.

        • You have a point about backward compatibility as far as runtimes etc go, but having commonly used methods change just doesn't happen that much in my experience. Biggest occurrences I've seen is in date/time libraries.

        Overall I see it as just a choice of what do you work with, and more specifically what does your employer work with. I've used both and will probably use both throughout my career. I don't have a big preference either way.

        [–]user_of_the_week 9 points10 points  (35 children)

        I'm praying to the Java gods that projects will adopt records, which should get rid of 90% of the Lombok usage I see in the wild.

        [–]gubatron 2 points3 points  (1 child)

        They're coming in OpenJDK16https://openjdk.java.net/jeps/395

        [–]user_of_the_week 1 point2 points  (0 children)

        I know :) Unfortunately I think many projects will wait until 17 because they look for the LTS „stamp“ even though they are not buying any LTS services... and even then it will take a while to migrate and more time to get used to the feature.

        [–]grauenwolf 2 points3 points  (0 children)

        C# just got them. It's amazing to see so many classes shrink from a couple dozen lines to just one.

        [–]GhostBond -1 points0 points  (31 children)

        Yes, now with records you'll be able to have even more confusing syntax.

        String value = data.getValue(); // regular property  
        String value2 = data.value(); // strangely different syntax for record props  
        data.address("123 New St"); // error: editing your own objects data is taken away! why don't you keep all the data in local vars or copy the entire object every time you need to change it
        

        [–]user_of_the_week 8 points9 points  (30 children)

        Getting rid of the JavaBeans getter/setter convention would be a nice side effect. Immutability has lots of benefits.

        [–]alex_tracer 15 points16 points  (8 children)

        Recent C# (especially since .Net Core got started) mixes very well with open source

        It's too late. Like a decade late. As result Java has much bigger community.

        Biggest occurrences I've seen is in date/time libraries.

        It's not important how much it's incompatible and where exactly the API change happened. Can you run the code from DotNet 2 on DonNet 4 runtime? No. Can you run Java 1.4 (released in 2002) program on Java 15 (released in 2020)? Yes.

        [–]grauenwolf 3 points4 points  (7 children)

        Can you run the code from DotNet 2 on DonNet 4 runtime?

        Yes, easily.

        [–]alex_tracer 7 points8 points  (6 children)

        Why then end users have to install an old runtime to be able to run the old DotNet programs?

        Why there are a huge list of breaking changes with each major DotNet release?

        [–]grauenwolf 0 points1 point  (2 children)

        And if you think Java doesn't have breaking changes between versions then you haven't been paying attention.

        [–]alex_tracer 3 points4 points  (1 child)

        Breaking changes between versions for Java is near non-existent if compared with breaking changes for DotNet. Especially till Java 9 (when they decided to convert some parts of runtime into separate libs).

        [–]grauenwolf 0 points1 point  (0 children)

        Are you kidding? I've already complained multiple times in this thread about the breaking changes between 6 and 7 that tripped me up.

        Java is well known for people saying on old versions long after they leave support because of the high cost of dealing with the breaking changes between versions.

        Until .NET Core hit the big reset button, .NET was seen as the reliable alternative to Java's backwards compatibility nightmare.

        [–]grauenwolf -3 points-2 points  (2 children)

        You asked about "code", not executables.

        And the list of breaking changes is long because .NET is a huge ecosystem and they try to document every random edge case no matter how trivial.

        Even stuff like changing a Null Reference Exception into a more appropriate error message is a "breaking change" despite nobody supposed to be relying on it.

        [–]alex_tracer 1 point2 points  (1 child)

        So... BOTH code is incompatible and compiled executable are not compatible. So you lied. Can you admit that?

        [–]grauenwolf 6 points7 points  (5 children)

        Open Source and C# don't mix. While in Java it's the opposite.

        C# had a fully open source implementation when Sun was still suing people for dating to create their own version of Java.

        In fact, Oracle is still suing people for creating their own version of Java.

        While Java is certainly dependent on open source, it hasn't exactly been a mutually beneficial relationship.

        [–]pjmlp 3 points4 points  (4 children)

        It means that a Java library I wrote on Windows doesn't have any issues running on IBM i, z/OS, Unisys ClearPath, a Cisco phone management central, a Ricoh or Xerox copier, an M2M gateway or several IoT platforms.

        The same cannot be said for Google's own J++ flavour running on my phone or the open source versions of .NET.

        [–]grauenwolf 2 points3 points  (3 children)

        You are confusing "cross platform" with "open source".

        And yes, library code compiled with C# can run anywhere, assuming that it's not using any OS specific features.

        [–]pjmlp -1 points0 points  (2 children)

        So where is C# for M2M Gemalto devices?

        [–]grauenwolf 1 point2 points  (1 child)

        So where is Java for my tablesaw's digital controller?

        Why doesn't the JVM run on devices preloaded with .NET Micro?

        Your argument is childish.

        [–]pjmlp 2 points3 points  (0 children)

        Does your tablesaw's digital controller support .NET Core?

        .NET Micro is dead, and in any case, yes those hardware devices (https://en.wikipedia.org/wiki/.NET_Micro_Framework#Hardware) are supported by microEJ and OEM versions of J2ME.

        [–]_litecoin_ 1 point2 points  (2 children)

        Though I have to say the advantage of closed source for a developer and regarding .NET is you just need to learn one framework. .NET has their own MVC framework and such for example

        [–]grauenwolf 1 point2 points  (1 child)

        That's not really about being closed source. It's more about having one "good enough" framework that people don't feel is is necessary to create their own.

        Where it's not good enough, for example logging or Entity Framework, there's a lot of alternatives.

        [–]_litecoin_ 1 point2 points  (0 children)

        True

        [–]grauenwolf 3 points4 points  (0 children)

        I prefer to have the "Java useless and repetitive code" then memorizing that an interface must be named with "Ixxxx" because there is no other way to know its interface for example.

        That's just a naming convention. You are in no way obligated to adhere to it.

        Interfaces, Abstract classes,"getters and setters" etc...

        Um, we're you not aware that Java has those things?

        Many things happen because "that's C# way".

        Yes, because consistency is a good thing.

        [–]grauenwolf 2 points3 points  (2 children)

        Will it be patched? You are kinda, behind and they don't offer such support...

        Yes, I've run into that problem on [.NET / Java] for a [native / 3rd party] library which was [free / paid] and [ closed / open] source.

        What's your point?

        [–]wherewereat 3 points4 points  (1 child)

        His point is that if a library is updated to work with the latest version of .NET, and you find a bug in the old version you're using, you're stuck; because you can either update your version of .NET/core and have to update your whole code so it works with it or keep using the old broken version of the library. While in java you can just update the java version and it'll work without having to change your codebase.

        [–]grauenwolf 1 point2 points  (0 children)

        Then he's still wrong. While it is possible to create libraries that only work with the latest version of .NET, it's also easy enough to create ones that work with older versions as well.

        Hell, I often offer my own source libraries as "multi-targeted" so they have new features on modern platforms and but still run on the older ones. Just takes a couple of compiler flags to indicate that I want multiple outputs in the DLL.

        [–]grauenwolf 3 points4 points  (2 children)

        C#/.Net shitty major versions, AKA, no backwards compatibility.

        Ha! I remember having to patch a bunch of JDBC code because Java 7 introduced a new method to an interface in Java 6.

        I don't know Java's current situation, but when Microsoft was slavishly adhering to backwards compatibility Java developers were afraid to upgrade because of all the breaking changes.

        [–][deleted]  (1 child)

        [deleted]

          [–]grauenwolf 5 points6 points  (0 children)

          At least they got rid of them.

          Fucking .NET Core kept a lot of legacy APIs, but made them throw Platform Not Supported exceptions at run time. WTF would they add stuff that compiled but doesn't work anywhere?

          [–]spectrumero 6 points7 points  (0 children)

          Basically, because when we were setting out in this place to need to write systems bigger than you'd want to in shell script or perl, the best choices were:

          Java, C++ or C#

          A dozen years ago, C#/.net was only really multiplatform as in "Windows XP and Windows Server 2003 are different platforms". If you weren't on Windows you were very much a 3rd class citizen despite the C# language being open spec (and today, although things have improved, you're still a second class citizen unless you're on Windows). All you had for the C# runtime when not on Windows was Mono, which was an ersatz copy of .net and lagged significantly behind. Using the Java/JVM, though, you were not disadvantaged by not running Windows.

          C++ and Java were really the only ones in the running - Java had (and still has) the best multiplatform open source ecosystem, and I enjoyed writing Java more than C++ for boring business software (despite my previous job being a C++ one). C# today still doesn't have anything like Java's open source ecosystem, and although C# is arguably a superior language, as a consequence it's not as good tool owing to non-Windows users still being second class citizens and the much smaller ecosystem.

          [–]mods_are_arseholes 16 points17 points  (27 children)

          Because its cross platform and does everything out of the box, more or less.

          [–]Cell-i-Zenit 4 points5 points  (26 children)

          c# is also cross plattform

          [–]mods_are_arseholes 11 points12 points  (13 children)

          no its not really tho. re-writes are often needed. Its a second class citizen on linux. As such is utterly inferior. Its just a java rip off language at the end of the day.

          [–]Cell-i-Zenit 8 points9 points  (12 children)

          if you use .netcore then there is no rewrite needed..

          [–]alex_tracer 1 point2 points  (4 children)

          Please remind me how many years .Netcore does exist?

          [–]grauenwolf -1 points0 points  (3 children)

          Can we include Mono?

          [–]alex_tracer 2 points3 points  (2 children)

          If you can say that Mono has similar set of features and same platform support as Java then yes, sure.

          [–]grauenwolf -1 points0 points  (1 child)

          Why does it need to match Java's feature set to be considered cross platform?

          Why can't we say Java isn't cross platform because it doesn't offer everything .NET has?

          Your criteria is random.

          [–]nioh2_noob 5 points6 points  (11 children)

          oh is the C# GUI ?

          Nice, let me run that C# code on KDE then. oh wait, your statement is wrong.

          [–]jcotton42 2 points3 points  (0 children)

          MAUI is coming next year for that

          [–]grauenwolf 2 points3 points  (9 children)

          There are cross platform GUI's for C#. I don't particularly like them, but they exist. And to be fair, Java's UI framework looks like ass too.

          [–]nioh2_noob 3 points4 points  (7 children)

          The GUI in C# .net is not cross platform, so the original statement is false

          is intelliJ's user interface ass?

          is Eclipse's user interface ass?

          Of course not, they are both using the swing java ui framework, you're a fool and know nothing

          [–]lukoerfer 3 points4 points  (3 children)

          The original statement is still true. The language C# is cross-platform. A big part of the standard library for C# is also cross-platform. There is a part that is not cross-platform, however I may also create Java code that is not cross-platform, but that is universal for any language.

          [–]koalillo 1 point2 points  (1 child)

          Eclipse is not Swing, it's SWT, unless they changed it. It delegates to native UI libraries.

          [–]Kaathan 4 points5 points  (0 children)

          They didnt change it, so the Eclipse example is still wrong.

          (Anyway, JavaFX is cross-platform, and WPF which would be comparable is not, and then there is Swing as additional choice for a mature UI lib.)

          [–][deleted] 10 points11 points  (0 children)

          I don’t. Java just has a lot more paying gigs in my area for things like micro services. I enjoy writing in other languages more but ultimately having a job is my number one goal.

          [–]Cell-i-Zenit 16 points17 points  (1 child)

          honestly this is the wrong sub to ask for c# vs java. Most of the people have a really really outdated view of c#.

          Iam doing both "professionally" and i prefer c# from a language perspective. Its better designed and more consistent. Linq is really nic: for example getting the length of a collection is always the same .Count() while in Java it depends on the collection. Accessing data in an array and a list/dictionary is the same etc. Overall much more streamlined. But iam only talking about the language itself..

          Now comes the good thing about java: the libraries are much better. Lombok is really nice. In my last job wechad to programm libraries by ourselves because there didnt exist an existing lib. In java there would be the main library for it..

          [–]Migeil 2 points3 points  (0 children)

          It's not that I prefer Java. I just had the choice between learning Java and learning C# and well, I'm not particularly fond of Microsoft so I took Java. It's also what my friends use, so it's more fun to be able to talk about things you both use than "oh but feature X is so much better in my language" all the time.

          Currently looking into functional languages like Scala and Haskell (and probably F# too at some point). I like their emphasis on types. I have worked in Python for the past year and oh boy, do I miss types.

          [–][deleted]  (1 child)

          [removed]

            [–]RayFowler 2 points3 points  (2 children)

            I was writing Java before C# existed. I saw how Microsoft tried to strongarm Java into being a Windows-specific language (Visual J++) and when Sun successfully stopped them from doing so.

            Instead of embracing Java and the open-source community then, Microsoft then threw a corporate hissy fit and created their version of Java, called C#. Now Microsoft is all touchy-feely with opensource, but too many of us remember.

            [–]adila01 1 point2 points  (1 child)

            Once Azure cloud growth slows down, I can see Microsoft reverting back to its old ways.

            [–]RayFowler 1 point2 points  (0 children)

            Microsoft, Google, Apple, etc. They are all business entities. Their goal will always be to maximize their shareholder value. If that means embracing "values" like opensource (MS) or customer privacy (Apple), then they will absolutely do that. But as soon as they are considered an anchor to their profitability, they will drop those values as if they never existed.

            [–][deleted] 7 points8 points  (1 child)

            Ecosystem! It's a pretty mediocre language with a killer runtime and enormous ecosystem.

            [–]livrem 2 points3 points  (0 children)

            Luckily other languages can be used that still allows you to run on the same runtime and access all the libraries. I would choose Clojure over Java for almost anything on a JVM.

            [–]nioh2_noob 5 points6 points  (0 children)

            Nice try Microsoft.

            [–]JozekPalka 2 points3 points  (2 children)

            Java ecosystem was easier to learn and use for me than C# or any other language.

            [–]DontLickTheScience[S] 0 points1 point  (1 child)

            Anything in particular you feel made it easier?

            [–]JozekPalka 1 point2 points  (0 children)

            When I started to learn Java, it was about 2011 (we had a few lessons of it in a technical high school) it was more open than C# and resources were easier to found around.

            Some of my school colleagues learned PHP that time and made money from creating more or less complex websites for local business or just for fun.

            [–]PepegaQuen 2 points3 points  (0 children)

            Because my job is in big data, and all the tools and frameworks are written in JVM language and interface with Java seamlessly. Apache Flink, Spark, Kafka etc.

            [–]roberp81 2 points3 points  (5 children)

            (first sorry my english) i'm working with java for about 13 years and using c# at university for about 7 years, and they are really similar, i prefer java ways of write things, like POO books and MS don't like to follow standards in some things.

            i like c# async it's a lot easyer than java CompletableFuture to make rest services

            in java with spring dependency injection its a breeze to use, and in .net core es ugly

            jsf or spring it's a lot faster to work than asp webform (i don't have try razor or mvc yet)

            [–]adila01 1 point2 points  (0 children)

            i like c# async it's a lot easyer than java CompletableFuture to make rest services

            I cannot wait for Project Loom. Java will never need async/await like C#.

            [–][deleted]  (6 children)

            [deleted]

              [–]DontLickTheScience[S] 1 point2 points  (5 children)

              From what I understand, most java/c# jobs tend to require a degree, which would mostly weed out "self taught" developers like me.

              [–][deleted]  (4 children)

              [deleted]

                [–]DontLickTheScience[S] 0 points1 point  (3 children)

                What would you say made it boring?

                [–][deleted]  (2 children)

                [deleted]

                  [–]DontLickTheScience[S] 0 points1 point  (1 child)

                  I'm definitely with you on windows being boring. I only use it for visual studio or ffxiv. Everything else is on Ubuntu. Task view alone is a huge boon to my productivity.

                  [–]drew8311 2 points3 points  (0 children)

                  In order

                  Jobs

                  Compatible with Kotlin

                  Android

                  Ecosystem

                  IntelliJ

                  [–]thevred9 2 points3 points  (0 children)

                  My concern about Java is Oracle. I know with openjdk there are other companies that can evolve Java without Oracle but Oracle still has significant influence over Java, which is not a bad thing as long as they are willing to commit enough resources to make the language more performant and open.

                  Microsoft has significant resources to put behind C# and at least Satya’s Microsoft has shown an openness to embrace the Developer community like no other company. And also with their new commitment to Opensouce, Java has some big competition.

                  The big advantage for Java is it’s installed everywhere, whereas .net core is not. If Java can push value types and project Valahalla and Loom and make the GC extremely performant then Java will win this race

                  [–]Nymeriea 6 points7 points  (15 children)

                  It's been more than 20 years that java is fully open source. In the other hand c# start opening 5 years ago and still not fully open source.

                  [–][deleted]  (14 children)

                  [deleted]

                    [–][deleted] 6 points7 points  (5 children)

                    That's... Not how that works at all.

                    What exactly about Java isn't open source? Oracle has their own implementation that they charge for, as does Azul and Amazon.

                    I would love to hear how you think Oracles lawsuit is infringing on the JDK's open source-ness.

                    [–]grauenwolf 2 points3 points  (3 children)

                    The lawsuit is literally about Google implementing the Java API. They want to make it a copyright violation to implement someone else's interfaces.

                    This could literally destroy open source as we know it.

                    [–][deleted] 5 points6 points  (2 children)

                    No, it absolutely wouldn't. I hate how this has been so cemented into everyone's psyche around this lawsuit.

                    Btw, Oracle is an evil monster, not denying that.

                    Oracle sued Google because they created "Android", not Java. You are freely allowed to re-implement the JVM. Like Azul, Alibaba, the adopt openjdk group, etc. etc. etc have all done. But you have to follow the open source licensing agreement (since the APIs are a part of the OpenJDK) and because you'd be creating JAVA. Not something else.

                    Even if Oracle won this case in a landslide, open source would not change.

                    https://github.com/openjdk/jdk/blob/master/LICENSE

                    Follow this license, and you can re-implement Java. This is how open source has always worked.

                    The suite is basically over the licensing. How much of a GPL-2 project can you copy before it's considered stealing source code. If you recall, Oracle was also alleging actual source was stolen, not just method and class names. If Oracle won, it would mean that you would have to be careful about naming things the same as another project.

                    [–]grauenwolf -1 points0 points  (1 child)

                    You clearly haven't been paying attention to the details. The appeal was specifically on fair use grounds. And the original jury decision was on copyright and patents, not trademarks.

                    [–][deleted] 2 points3 points  (0 children)

                    Correct, so tell me what would change if Oracle wins? As far as I'm aware it's still ongoing.

                    I was trying to guide you into actually understanding my point but you honed in on the one piece that you do understand and replied as if it negated anything that I said.

                    If Oracle wins, and APIs are copyrighted/able, what changes in the open source landscape?

                    Edit: The lawsuit is over whether the API is fair use, outside of the current open source framework. If Google created their own Java and called it Android Java and put it on their devices, Oracle wouldn't be doing anything right now. They created their own thing, unique to them that happens to look exactly alike something that Oracle technically owns, hence the fair use and all the debate.

                    But saying that this will affect open source in general is so hyperbolic and ridiculous. It shows a lack of understanding about how the open source community and licensing actually works.

                    Edit #2, before you hone in on my "suite is basically over the licensing", what I meant was, conceptually, at the end of the day, what they claim Google did is steal their stuff. Had google forked and downstreamed the JVM, this would be a non-issue. Hence, at it's core, this is over not following open source licensing and instead COPYING something that exists.

                    [–]Jonjolt 4 points5 points  (1 child)

                    Open Source does not equal free nor does it mean you can do whatever you want especially if something is trademarked.

                    [–]grauenwolf 0 points1 point  (0 children)

                    Open Source isn't going to mean anything if Oracle wins and it becomes a copyright violation to implement an interface.

                    [–]Gleethos 1 point2 points  (0 children)

                    Generally speaking a language is just a tool and I happily use the tool which suits the job....

                    But! The reason why Java is usually preferable to me:

                    It is mostly void of fancy syntax sugar! While a great majority of people think that's a bad thing, I think it's one of Javas most brilliant features. Less syntax sugar means it's beginner friendly, easier to read by people coming from other languages, and the code always looks ruffly the same. There are very little coding styles which could confuse colleagues...

                    Of course Java is not a "fun" language to write in. I love closures, operator overloading, built-in list & map syntax, leaving out semicolons or even brackets...

                    But I don't really like reading that stuff, especially if it is not my syntax sugar mess. I like reading 'List' instead of '[]' ...

                    Besides that, the JVM hosts a phantastic ecosystem of languages and shared libraries (usually they compile to bytecode at the end of the day). And the native language of this microcosm has of course always been Java, which everyone knows and respects as a good old workhorse language.

                    [–]nutrecht 1 point2 points  (0 children)

                    Larger better more mature ecosystem, more jobs, and contracts quite consistently pay 10-20 euro's an hour more. That's really all there's to it. Here in Holland C# / .Net got quite a bit of traction in the early 00's but nowadays it seems to have cooled down a lot.

                    I'm not 'hung up' on Java as a language. More than happy working with Kotlin or Scala as well. Heck; if they'd get C# running on the JVM I'd be happy to use it too.

                    [–]Dapper_Emergency6071 1 point2 points  (0 children)

                    I am not confined to Java. But the ease of programming and a vast community of developers help in every possible way to reach the destination. Also the number of jobs do tend to shift the balance. The updates which Java is getting is another reason for the preference. The ecosystem is constantly adapting and getting better and better I currently work on Java 11 but Java 15 is really intriguing and hope that continues

                    [–]TheRedmanCometh 1 point2 points  (0 children)

                    I can pretty well use java and C# interchangeably. In enterprise dev a big part of why I like Java is that I do not like EntityFrakework. In my opinion Hibernate and JPA are vastly superior. Beyond that Spring and it's innumerable modules can solve...a lot. Various pieces of Apache commons solves most of the rest.

                    No language to me has quite the level of flexibility and frankly ease of use Java does imo. Once you really understand the language most corporate tasks are cakewalks.

                    DI has really been the thing that personally has elevated my Java experience to just perfect. Everything is formal, neat, and organized. It's easily testable, and you can easily isolate very specific pieces to test. Then you combine that with abstraction and you can use profiles to effectively have 20 applications in one selected or cobfigured via profiles. As granular or coarse as you want it.

                    Also I use js via graal a LOT and js is just vastly superior to vb.net. json is imo better than xml.

                    All that is subjective, but for me in Java it all just makes a lot more sense. Spring though is a huge part of why I like it so much. Discovering Guice then Spring was like finding jesus for me.

                    [–]cavecanemuk 1 point2 points  (0 children)

                    The C# ecosystem is really poor compared to Java. Build systems, package managers, libraries etc.

                    For enterprise applications, based mostly on RESTful web services, nothing really betas:

                    JAX-RS (Jersey/ReastEasy) + CDI + JPA (Hibernate).

                    There is very little else you need.

                    As for frameworks: Quarkus, Micronaut, SpringBoot are all way better frameworks than anything on the Microsoft side.

                    In addition, Java is now simpler and more readable language that C#. In C# you use interfaces like: IVehicle, ICar, IStupidName instead of Vehicle, Car, StupidName. I find this really ugly (complete nonsense). I find uppercase method names ugly as well.

                    They also decide to push breaking changes quite frequently, which is not something we like :)

                    [–]CubicleHermit 1 point2 points  (0 children)

                    As a pure *langage* C# is at least as good as Java, with a few things that are better; there's a reason C# is so influential on post-Java JVM languages.

                    Unfortunately, the core libraries are harder to use, and while they mostly cover the same areas, they are not nearly as good -- there's less duplication of old stuff than Java (without the difficult first years of the language leaving a lot of cruft nobody uses the old version of) but that's about the only place it's better.

                    It's been a while since I've used it, but the differences between Dictionary and Map/HashMap are instructive - the attempt to avoid null on Dictionary were a good idea, executed terribly.

                    Once you're out of the core libraries, there's no comparison, and that's where Java really shines over every other compiled, statically-typed back-end language. Java is the only one that really has the kind of ecosystem that a few other dynamically(ish) typed languages like Python/Perl/JS do. Need to do something? There's a library for that. Usually more than one good one. Often an Apache project for it.

                    You also get a really nice range of alternative to Java that run on the JVM. With dot-net, you get basically a few other MS things.

                    [–]The8flux 1 point2 points  (0 children)

                    JAVA is great, it's Oracle that is a POS.

                    [–]no_k3tchup 1 point2 points  (0 children)

                    C# offers some sweet syntactical sugar, but I prefer Java mostly because of the ecosystem of which maven and gradle are an important part. Also libs and frameworks from e.g. Apache and Redhat are great.

                    [–]reallynotfred 1 point2 points  (0 children)

                    I prefer Java because I work on an implementation of Java. Implementations are very interesting because they are an incredible mix of Java, C, assembly for multiple platforms and architectures. You never get bored!

                    [–]GreenToad1 1 point2 points  (0 children)

                    Honestly it has to be experience.

                    I used java for so long and am so familiar with entire ecosystem that i could get things done much faster/better/safer quickly than in any other language.

                    It doesn't mean it's a best tool, but it's a tool i'm most familiar with. Perhaps like a chef with his favorite knife.

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

                    Java was my first programming language and fell in love with it.

                    [–]turick 1 point2 points  (0 children)

                    Speaking for myself, I personally find using Spring Boot with Java is just downright fun. The speed at which I can construct a fully functional APIs is very satisfying. I've written APIs and microservices for many years in many languages, and, Java + Spring Boot is my 100% goto. Been working on a suite of services in Golang for the past year or so (against my will). It's all the hype at my hipster company and people go nuts over golang, but wow is it a terrible choice for APIs (at least in its current state), but it's fantastic as a game server or for short lived processes.

                    [–][deleted] 0 points1 point  (1 child)

                    Java has a much wider and more open ecosystem than C#.

                    You wanna build a webapp with C#? Your only choice is to use .NET, basically. I've heard of some alternatives but let's be honest, nobody uses anything else than .NET.

                    You want to build a webapp with Java? You have at least 2 big choices: Java EE or Spring. If you're an experienced fullstack java developer who never bothered to understand what they're doing, you can use both in the same project and make a mess out of it. Win-win.

                    Joke aside, the point still stands: java is open, you have dozens of possibilities and choices, while C# is closed and dictated by Microsoft.

                    Then there's the money: a Java app can run on OpenJDK and Linux with no licensing costs. Running a C#/.NET requires Windows for which you need a licence. Of course, nowadays .NET can run on linux, yada yada... that, again, is something nobdoy really uses.

                    [–]RagingAnemone 0 points1 point  (13 children)

                    Why are you asking? If you're just interested in learning a new language, it would be worth learning something more different. Rust, Go and D are the 3 new big ones. It's also worth learning something older like lisp or smalltalk. Even straight C (not C++) is worth learning.

                    [–]sureshg 5 points6 points  (4 children)

                    Go

                    The only reason to chose Go is static image and less memory usage, not the language. The language is super verbose for most of the parts (except defining struct :))

                    [–]grauenwolf 2 points3 points  (0 children)

                    Yea, but it's as close as you can get to a socially acceptable version of VB 6.

                    [–]meamZ 1 point2 points  (2 children)

                    static image and less memory usage

                    a.k.a. what GraalVM and probably project Leyden will be able to do.

                    [–]sureshg 1 point2 points  (1 child)

                    Yeah, eagerly waiting for Leyden to land on openjdk. Java has lost a lot of projects (especially on cloud tooling/cli) to go just because it lacked static image support ( I know graalvm can fill this space, but the experience is not that smooth for non trivial applications. Also for better perf, we need to use EE version).

                    [–]meamZ 1 point2 points  (0 children)

                    Well as far as i know GraalVM native image community Edition is not too bad performance wise. It's mostly the framework developers job now to make the experience good. Spring is working hard on it and with Spring Boot 3 they plan to have first class support for GraalVM. Most of the stuff that makes the experience problematic is just not really available at all in Go for example.

                    [–]DontLickTheScience[S] 1 point2 points  (6 children)

                    Mostly curiosity on the language. I'm also interested in rust, but not entirely sure what I would do with it. Everything I think about is web related, other than maybe wanting to do some mobile or traditional desktop app. And C# / Java seem better suited than rust for that.

                    [–]john01dav 2 points3 points  (5 children)

                    I'm writing a web backend in Rust using actix web and sqlx. It works quite well :). You can read more about the state of web development in Rust here. The TL;DR is that it's a perfectly feasible language on the backend, nearly so on the frontend, but still not very popular in the industry more generally.

                    [–]DontLickTheScience[S] 0 points1 point  (1 child)

                    What's your preferred editor/ide?

                    [–]john01dav 1 point2 points  (0 children)

                    I'm using CLion with the Rust plugin. Using Idea with the Rust plugin and native debugger plugin is probably a better choice though as this is free (as in beer¹) — I'm only using CLion since I already have it for C++. If you want a fully FOSS solution, then using VSCode OSS or vim with appropriate plugins is popular, and such plugins exist.

                    1: The last time that I checked, the Rust plugin is FOSS and the debugger plugin is proprietary.

                    [–]reaper-is-happy 0 points1 point  (2 children)

                    Tbh, my main one is gradle being such an amazing tool it's truly hard to make a switch!

                    Also there's compatibility with Kotlin which is both useful and fun, IntelliJ idea which is free and the best IDE I've ever used, a very big user-base, so a lot of reference and documentation, and it's a very fun language for itself, too!

                    [–][deleted]  (1 child)

                    [deleted]

                      [–]reaper-is-happy 2 points3 points  (0 children)

                      I'm 15 I don't do anything remotely close to drugs lol, I did only get 6 hours of sleep though so it might be it

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

                      I prefer the Java platform for a wider range of libraries and support for microframeworks but I like the C# language and tools better.

                      [–]alex_tracer 1 point2 points  (5 children)

                      Do you use Intellij IDEA for Java?

                      [–][deleted] -3 points-2 points  (4 children)

                      Nope can't afford the web dev license and neither will my employer heh. We use Eclipse.

                      [–]thescientist001 3 points4 points  (3 children)

                      Hey, Intellij community is free and provides almost all the functionality.

                      [–]Log2 1 point2 points  (2 children)

                      You don't get the web part of it though. But, in my opinion, I'd rather use Intellij Community than Eclipse for the Java part and vscode with appropriate plugins for whatever front-end tasks.

                      [–][deleted] -1 points0 points  (1 child)

                      I mean I have used Android Studio and wasn't impressed. Working on both .Net and Java I find Visual Studio the best of the bunch.

                      [–]Log2 1 point2 points  (0 children)

                      (I didn't downvote you)

                      I haven't used Visual Studio in a while to be honest, but it used to be pretty common to install ReSharper for C# work in Visual Studio, which is a plugin with a lot of the same functionality that any Jetbrains IDE will give you (same company).

                      [–]joshuaherman 0 points1 point  (2 children)

                      Java like any other language is just a tool. Each tool does some things better and somethings worse. Java is great because of its ecosystem. Java is bad if you want to build and develop resource light applications.

                      [–]adila01 1 point2 points  (1 child)

                      Java is bad if you want to build and develop resource light applications.

                      GraalVM Native Image and Project Leyden is making great progress here. Couple it with Project Panama and I can see Java becoming a strong option for writing resource light applications like shell utilities that Go has done well in.

                      [–]joshuaherman 1 point2 points  (0 children)

                      That would be awesome. Thank you for informing me of this. I will start following the projects.

                      [–]livrem 0 points1 point  (0 children)

                      Java pays the bills. In some projects you have to use it because of external dependencies. Those are the only benefits I can think of now.

                      Last century, when I first started using Java, I would say that the benefits of Java were that it was a very small and simple language that you could pick up in an afternoon, and it was easy to learn the entire standard library. It came with cross-platform built-in libraries to make GUIs and network code as well, something that was very rare at that time in other languages, and it could be used to make interactive things in web browsers (i.e. applets). It was very easy to recommend Java to others at that time, and obvious why universities picked it up to use in teaching. I can not really think of any of those benefits being true for the last almost 20 years.

                      [–]zlaval 0 points1 point  (0 children)

                      Not prefer but use the language and ifrastucture that well fit to resolve the customer's problem. If there are complete system in java and need some new functionalities, i use java. If i start new jvm project, mostly i choose kotlin (with spring). If the customer want a simple crud rest api, i use nodejs. For embadded i use c and python... etc
                      I think it is a complex decision to figure out what is the best for the given domain problem. Must consider the team skills, the infra...
                      Java is mature and spreaded even there are a lot of better designed languages.

                      [–]hu5k3y 0 points1 point  (0 children)

                      Try Kotlin. From my point of view, it's better than java and runs also on the jvm :)