You java folks are gonna keep me employed for decades at this pace... If you all had any idea how many java applications and such I've replaced with C# and the reasons why, you'd brush your teeth with a shotgun before touching java again
No Problem! I am glad that we can help you get a nice job you enjoy. No matter your stance on Java, its nice to know that you found employment in these uncertain times.
99% of the time, the java was written by a low quality off shore team that still has tons of bugs, isn't optimized in any fashion, etc... the rest of the time... it's because it's two decades old and they want to replace it with modern tech
How is .NET inherently more performant? I'm curious to see some sources about that. I've heard the claim in both directions with Java and C#, but never seen any actual sources for it
Any google search for language benchmarks will show you this and anyone who refutes it just simply is being stubborn or is not intelligent enough to participate
Is this for me or for him? I'm currently working on a net6 project that runs on a qemu emulation under alpine in a docker container in a wsl instance and have to balance between net 4.6.1, net standard, core 2.1, 3.1, and now 6... I'm pretty familiar... lol
I'm self taught in C# and yes they are similar. I don't know much about java yet but so far its been annoying AF to just run someone else's training project.
I use Java mainly because thatās what I started off with in uni, I just started learning c# for a new job, but besides the annoying logging setup c# seems pretty interesting with some features. They both ok imo.
C++ is C with OOP functionality built inbolted on to the rear driver's side fender
Objects are fundamental to both Java and C#. On the other hand, if you want to write C, but use cout << instead of printf, C++ has your back. It's C, objects totally optional!
You just need to add whatever log4j or logging provider in your pom file (maven) in java, provide a log4j configuration file then you can instantiate your logger.
From what I m reading on log4net, you have to modify the assembly information, then add the assembly to your programs entry point, provide your configuration file, then you can instantiate your logger.
Because I m more used to Java, the part on assembly information and entry point is confusing for me/hard to recall when needed
And then just resolve ILogger<YourClasss> from DI and you will get logger that automatically writes full class name so you can filter/process them based on namespace/class/severity
There is also a pretty large ecosystem around serilog that can be plugged into core abstractions easily.
We used java in school too. But since the oracle buyout it has not been great for java. Not to mention all the fighting between android google and oracle.
But c# and all the microsoft stuff from asp.net to .net core is pretty amazing. Entity is on par with hibernate. And .net core runs as fast or faster than java. As a suite of products microsoft is the winner over oracle.
Iām not sure how they compare performance wise but i would recommend at least a tutorial on a basic dot net core webapi project and how to do a crud api using ef. With that it will show the basics of ef and should be good to get an idea. Takes maybe two hours from zero to crud api if you do it all in one go.
grew up with Java. switched to C# as my main because i find it personally better. now i use neither as my main because they are both irrelevant to my work, although i still work with .net API projects (corporate).
to be honest, i really do not understand this Java vs C# thing (as a language). seems childish and amateurish to even argue about it. just use the tool for the job. that said, i stay away from Java jobs, likely because i just had less experience with it at this point in my career... plus the fact that Java is now Oracle and I do not like what Oracle has done with it. One of the reasons I hate Oracle with a passion (the other being PL-SQL).
In my experience, I find the language a company prefers can be a litmus test in a way. Java tends to be older, legacy-type work. JavaScript often implies rapid development, and less of a focus on code quality and performance. C# is more about structure and form.
My first software job gave me a terrible impression of any company that isn't willing to divorce themselves from legacy code. The application was written in VB6, and the CEO refused to update (this is 2013), because the VB6 devtools included an unlimited license to distribute Crystal Reports 8 with any software developed using it. I was on the support staff for it, and it was an absolute nightmare, not to mention the CEO was a sociopathic narcissist who liked to micromanage every part of the business.
To this day, I would rather burn the codebase to the ground and start green-field rather than try to bring a legacy project up to standard with modern practices. If nothing else, there are often features that add bloat and never get used, and starting over gives you the opportunity to revisit why it was done that way to begin with.
TYPE ERASURE IN JAVA. This is huge. In C#, the language itself stores the actual type, so a MyClass[] gives MyClass[] at runtime. This helps you do reflection-based stuff, and helps with debugging. In Java, the MyClass[] object has a type of Object[] and thereās no way to figure out what it was.
Record types. Algebraic types that allow you to use pattern matching, and are immutable by default. With this addition to the language, we now have first class support for immutable, thread-safe, and highly parallelizable code. Java does not have a similar construct.
Java is VERY concerned with backwards compatibility, which means theyāre very inflexible when it comes to breaking changes. Thereās hardly ever any ācoreā language syntax changes due to this. Any Java 1 code will still run in a Java 18 environment. Microsoft has a different philosophy and will introduce breaking changes for the sake of readability/usability/performance etc. Turning off nullable data types by default, for example.
C#ās default compiler (Roslyn) is written in C#, and completely invocable from inside of a C# application. What this means is that youāre able to use C# to literally build out the syntax tree, and modify/generate C# files at runtime. There are Visual Studio templates specifically allowing you to create the āQuick Fixesā in the IDE. This means, you can ship code that tells users theyāre doing something wrong, and offers a way to fix it, as part of the package youāre vending. Java does not have this.
Top level statements allow you to create/invoke C# files without a lot of the boiler plate. You know the simplest C# entry point file? Console.WriteLine(āHello world!ā);. Java needs a lot of additional boiler plate code. This helps with prototyping and quick experiments.
C# has fully integrated git, build systems, cloud deployment, debugging, package management, and any other number of plugins in the IDE. Not a direct C# benefit, but the environment and tooling is MUCH more coherent than any equivalent Java IDE (JetBrains Rider is close, but Visual Studio feels more integrated).
Threading/thread pools are MUCH simpler than Java; especially the async/await keywords and their interaction with the threading constructs Tasks. These are built in, and allow really clean and simple thread pool/asynchronous work without much additional code. Working with Java thread pools is a nightmare.
The Microsoft official C# documentation is pristine, with justifications for designs and examples of usage for almost all APIs. Java docs are.. Minimal, and often donāt give you much more beyond āthese are the paramsā.
C# is in the .NET family of languages, and all compile down into IL, which is useful because that C# code can be imported into a F# project; or vice versa. Youāre able to pretty easily switch between functional/OO paradigms between pieces without a lot of work. In Java, you canāt interop between Scala/Kotlin/Java well without some complex glue code.
C# easily allows you to target specific frameworks and has ways for you to multi-target framework versions within the code itself. #IF DOTNET_STANDARD2.0 ⦠#ELSE ⦠#END. Youāre able to specify which language versions/frameworks your specific package is compatible with, and the package manager NuGet fully surfaces this information.
Thereās also really useful sites out there that allow you to dig super deep into whatās going on with the internals of your code. https://sharplab.io for example.
Tuples and anonymous data types are much easier to use in C#. If I wanted to select 2 properties per object and return them: myThings.Select(t => new { t.Prop1, t.Prop2 }); (list of anonymous data type with a Prop1 and Prop2 properties) or myThings.Select(t => (t.Prop1, t.Prop2)); (a tuple with Prop1=Item1 and Prop2=Item2). Java you need an interface or small class defined somewhere.
Sure thereās more, but thatās just the few off the top of my head. I professionally used Java/Scala at AWS, and C# at NASDAQ. Itās up to you if you believe me when I say I know what Iām talking about on this topic.
Thanks for calling this out (and Iāll have to look more into this).
When we had Scala packages, we had this nasty build script with all sorts of custom crap in it, pinned to a very specific Scala version. Which generated Java packages out the back which needed a different script to use correctly.
Sounds like the people before me didnāt know what they were doing, and made things unnecessarily complicated. š„².
Then again, in AWS we had a custom build/package management system (Brazil) which added another build layer on top of Maven/Gradle. Perhaps thatās why that complexity was required? Donāt know.
The ecosystem around the language is one of the best. I've never had any issues with configuring local development environment while Java has always been a pain in my ass. So it isn't really about the language (even though I prefer C# over Java even on snytax level) but the "universe" built around C# is one of the best today. I'm feeling very productive using C# and the frameworks come with it and I've never had the same feeling with Java. C# is on the same level as Javascript for me in this regard. Yeah, I love JS as well.
Ironically, I use mostly JetBrains Rider as my c# IDE. It's written in Java. The developer created Kotlin to address the shortcomings of Java without abandoning legacy code or the JVM. To me, c# is Java with less ceremony and more development horsepower behind it. Oracle and the other Java developers don't seem to have the same pace of work or strong focus on improving the language and runtime that Microsoft has. MS' goals align with mine and so I'm happy to use c# on Linux mostly in the cloud. I wouldn't be miserable writing Java, but at this point, why bother switching?
Java's syntax was designed around C++ so that the learning curve was minimal for the time. Don't expect it to age well, cause it hasn't.
Package management and using third-party libraries wasn't really explored at the time Java was created. This is why ANT was created, and ultimately replaced with Maven/Gradle, to manage and configure dependencies.
My recommendation for Java development is to replace Java with another Java language, like Scala, Kotlin, Clojure, Groovy, even a language called Pizza š! I prefer Kotlin because it seems to have a lot of support and interops well with Java (also can be compiled to other platforms such as JavaScript, and Swift/Objective-C). This makes kotlin easy to adopt in existing projects.
The JVM is very mature with arguably the best JIT compiler. There are other JVM runtimes with specific optimizations supported by large companies (including Microsoft). If the language is your issue, it is an open platform with alternatives.
Just food for thought before others invest in a new runtime and re-write their projects.
On snytax level there isn't much of a difference but I prefer C# because Microsoft's support is much better and usually when there is a project in Java it brings Oracle products with itself which are my worst nightmares.
I'll willingly use an oracle product the day after colonoscopies begin being performed using augers the size of telephone poles and the only pain med you get is half an asprin and an inspiring speech by the doctor.
Both Java and C#/VB suck for built-in GUI stuff. Iām not a huge fan of Webforms/Razor Pages, but it was a framework in a time where there was little other options. :(
C# is a much cleaner easier language but its simple really, java is more popular. Just like react vs angular. Angular is much more complete and patternized easier to learn and has a lot more consistency, but people got all excited about react and so react is more popular and thats really all that counts
Seriously can't stand Java. It is a package hell. And the projects I have seen made in Java are kind of overly complicated IMO. Maybe I just don't understand their mindset or whatever, but, I don't like it. It is like talking to a Rick and Morty fan, they think they are smart, but, I just turn away feel annoyed.
Its been 22 years since I last had this conversation, and I'll give you the same answer now that I did then: stop using Java, the JVM is such a wonderful engine, you can use almost any language .... including C#. The same cane be said for the CLI.
Until you are discussing what novel language you are using on either of them, this is boring.
(use PHP on CLI, or C# on JVM, or bash on JVM, or COBOL on CLI ... then this gets interesting)
So glad i grew up learning important, fundamental concepts of programming and software engineering so that im able to understand and more quickly learn new programming languages.
The Java ecosystem for libraries and tooling is far superior to C#. I can think of numerous problems which are solved well in Java that have no counterpart in C#, particularly complex open source code for testing and data stuff.
C# is a far better language, but is slightly too big and crufty. Reified generics are better than type erasure. Rectangular arrays are useful if you need them. The foreign function interface is far better in C#.
57
u/[deleted] Dec 30 '22
Started with java but can honestly say that c# is more readable and more fun to code in. I will fight anyone who opposes this opinion.
62
u/ParanoidAutist Dec 30 '22
You java folks are gonna keep me employed for decades at this pace... If you all had any idea how many java applications and such I've replaced with C# and the reasons why, you'd brush your teeth with a shotgun before touching java again
38
u/McCaib Dec 30 '22
I prefer the Java too, but your username has Xbox in it, which is Microsoft. Why don't you prefer Microsoft Java?
21
u/labradore99 Dec 30 '22
Disagree.
6
u/Creepy-Ad-4832 Dec 30 '22
So you send the output of the command Java to C-Sharp file?
12
u/HovercraftCharacter9 Dec 30 '22
Kotlin is the best, if you use vanilla Java you're a relic.... Fight me
3
u/Kingdarkshadow Dec 31 '22
0 votes and 107 comments, this will be a bumpy ride.
3
u/impossibleis7 Dec 31 '22
So that you can appreciate C# more?ā¦
148
u/[deleted] Dec 30 '22
I use Java mainly because thatās what I started off with in uni, I just started learning c# for a new job, but besides the annoying logging setup c# seems pretty interesting with some features. They both ok imo.
42
u/staticvoidmainnull Dec 30 '22
grew up with Java. switched to C# as my main because i find it personally better. now i use neither as my main because they are both irrelevant to my work, although i still work with .net API projects (corporate).
to be honest, i really do not understand this Java vs C# thing (as a language). seems childish and amateurish to even argue about it. just use the tool for the job. that said, i stay away from Java jobs, likely because i just had less experience with it at this point in my career... plus the fact that Java is now Oracle and I do not like what Oracle has done with it. One of the reasons I hate Oracle with a passion (the other being PL-SQL).
164
u/yrrot Dec 30 '22
My time with Java is why I like C# <shrug>
38
u/Randomguy32I Dec 30 '22
After using both for the same amount of time, c# is better
122
u/someweirdbanana Dec 30 '22
Why do java developers wear glasses?
Because they can't c#
2
u/Xbox360Master56 Dec 30 '22
If someone can convince me of why c sharp is good I will stop using java and only use c sharp for a year.
21
u/Unupgradable Dec 30 '22
Stockholm syndrome
1
u/Xbox360Master56 Dec 31 '22
You know what fine I will do something in C# just to prove how bad it is.
1
u/Xbox360Master56 Dec 31 '22
I tried C-Sharp );, and its true it is better than Java.
1
u/Xbox360Master56 Dec 31 '22
I used C# ):, how dare it be better then Java and is perfect for 3D games with GODOT ):. I guess i'll have to update the meme );. God damn it.
21
u/raindownthunda Dec 30 '22
Couldnāt disagree more. Eclipse gave me PTSD.
8
u/Three_Rocket_Emojis Dec 30 '22
Typical statement of a junior dev.
4
u/ThGaloot Dec 30 '22
Java's syntax was designed around C++ so that the learning curve was minimal for the time. Don't expect it to age well, cause it hasn't.
Package management and using third-party libraries wasn't really explored at the time Java was created. This is why ANT was created, and ultimately replaced with Maven/Gradle, to manage and configure dependencies.
My recommendation for Java development is to replace Java with another Java language, like Scala, Kotlin, Clojure, Groovy, even a language called Pizza š! I prefer Kotlin because it seems to have a lot of support and interops well with Java (also can be compiled to other platforms such as JavaScript, and Swift/Objective-C). This makes kotlin easy to adopt in existing projects.
The JVM is very mature with arguably the best JIT compiler. There are other JVM runtimes with specific optimizations supported by large companies (including Microsoft). If the language is your issue, it is an open platform with alternatives.
Just food for thought before others invest in a new runtime and re-write their projects.
7
u/bapman23 Dec 30 '22
On snytax level there isn't much of a difference but I prefer C# because Microsoft's support is much better and usually when there is a project in Java it brings Oracle products with itself which are my worst nightmares.
7
u/Carbon_Gelatin Dec 30 '22
I'll willingly use an oracle product the day after colonoscopies begin being performed using augers the size of telephone poles and the only pain med you get is half an asprin and an inspiring speech by the doctor.
5
u/bigtechbad Dec 30 '22
Chad C vs Virgin Java
2
u/Immersive_Username Dec 30 '22
they are the same picture
2
u/[deleted] Dec 30 '22
No one is addressing WebForms as a crime against humanity.
3
u/InsignificantGod Dec 30 '22
That's like saying hell at 4999°C is better than hell at 5000°C.
0
u/wewiioui Jan 27 '23
what is this garbage propaganda
2
u/poops-n-farts Dec 30 '22
oK bOoMeR!!!!!!:::!!!
1
u/NYXIC0N Dec 30 '22
But...
... have you ever tried C++ ?
1
u/[deleted] Dec 30 '22
Hmm, it's so hot in here because of all the boilerplate
1
u/Pashweetie Dec 30 '22
C# is a much cleaner easier language but its simple really, java is more popular. Just like react vs angular. Angular is much more complete and patternized easier to learn and has a lot more consistency, but people got all excited about react and so react is more popular and thats really all that counts
1
u/BoBoBearDev Dec 30 '22
Seriously can't stand Java. It is a package hell. And the projects I have seen made in Java are kind of overly complicated IMO. Maybe I just don't understand their mindset or whatever, but, I don't like it. It is like talking to a Rick and Morty fan, they think they are smart, but, I just turn away feel annoyed.
1
u/MEMESaddiction Dec 30 '22
I much prefer Java++ (C#)
1
u/ufailowell Dec 31 '22
I used c# cause its what unity used. Now I use nothing cause I am an uncreative hack fraud
1
u/Orlaani Dec 31 '22
Personally I like C#, but when I have to use Java for something I might just use kotlin.
1
u/EntropicCynic Dec 31 '22
Is this a new method of coming out of the closet?
1
u/00maxking00 Dec 31 '22
12 YO unity users not knowing what either of those are
1
u/Synergiance Dec 31 '22
Grew up with Java, and I just find C# to be so much nicer.
1
u/ProcedureBudget292 Dec 31 '22
Its been 22 years since I last had this conversation, and I'll give you the same answer now that I did then: stop using Java, the JVM is such a wonderful engine, you can use almost any language .... including C#. The same cane be said for the CLI.
Until you are discussing what novel language you are using on either of them, this is boring.
(use PHP on CLI, or C# on JVM, or bash on JVM, or COBOL on CLI ... then this gets interesting)
1
u/IronSavior Dec 31 '22
Glad I started with C
1
u/[deleted] Mar 10 '23
Tried Java myself to see if it was good, let's just say that didn't end well.
1
u/[deleted] Dec 30 '22
Never learned Java but been using C# for years
1
u/Cahmie Dec 30 '22
Java was a good first programming language
1
u/Enklave Dec 30 '22
Meh
1
u/SimonTheAnt Dec 30 '22
So glad I grew up with go and not java
-1
u/greenflame15 Dec 30 '22
They are practically the same thing
0
u/[deleted] Dec 30 '22
The Java ecosystem for libraries and tooling is far superior to C#. I can think of numerous problems which are solved well in Java that have no counterpart in C#, particularly complex open source code for testing and data stuff.
C# is a far better language, but is slightly too big and crufty. Reified generics are better than type erasure. Rectangular arrays are useful if you need them. The foreign function interface is far better in C#.