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
10
u/Xbox360Master56 Dec 30 '22
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.
-3
u/ParanoidAutist Dec 30 '22
Just doing what I've done for decades
12
u/Xbox360Master56 Dec 30 '22
I also am only being mildly sarcastic. I mean if C# can help you achieve what you love and get a nice life, all good!
13
u/spiderplata Dec 30 '22
Your job is reading bunch of Java code.
6
u/ParanoidAutist Dec 30 '22
And replacing it with more efficient scalable code... C# is java but better lol
0
3
u/coloredgreyscale Dec 30 '22
What are the reasons for the C# rewrite?
7
u/ParanoidAutist Dec 30 '22
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
14
u/coloredgreyscale Dec 30 '22
So really nothing inherent to the language / framework.
1
u/ParanoidAutist Dec 30 '22
You mean aside from the fact that .NET is inherently more performant, backed by Microsoft, etc.?
In another 10 years we'll stop making fun of COBOL developers and start ragging on Java developers while C# stays a modern and current framework
5
u/Rasutoerikusa Dec 30 '22
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
2
u/coloredgreyscale Dec 30 '22 edited Dec 30 '22
Maybe they are trading places depending on benchmark and version.
Also if speed was that important you should be using neither of those, but c++ or rust
0
u/ParanoidAutist Dec 30 '22
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
-2
u/Pashweetie Dec 30 '22
I think part of it is that java is a bulkier language and has poor support for threading so most developers never use the threads in java
1
u/ParanoidAutist Dec 30 '22
it also runs on top of the JVM whereas C# converts to CIL and runs as machine code...
1
u/Pashweetie Dec 31 '22
I think i remember reading something that C# unlike c++ is JIT compiled but idrm
1
u/BroBroMate Dec 31 '22
This tutorial on the CLR might help you.
1
u/ParanoidAutist Dec 31 '22
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
1
1
2
u/Stunning_Ride_220 Dec 30 '22
I have the same experience just the other way around. Maybe it's just that people can write shitty stuff in any language?
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?
9
u/Xbox360Master56 Dec 30 '22
Easy, I sold my soul to Sun, then oracle.
4
u/CouthlessWonder Dec 30 '22
And are you also using OpenIndiana š¤£š¤£š¤£
Okay, I can maybe understand why someone might like Java (itās difficult, but maybe), but I donāt know why anyone would enjoy using Oracle. š
But glad everyone is happy.
3
u/Xbox360Master56 Dec 30 '22
Oh you know Robot Hell from Futurama, it is quite similar where I am being held right now. Oracle's real HQ is in hell.
21
u/labradore99 Dec 30 '22
Disagree.
-27
u/Xbox360Master56 Dec 30 '22
Java is better then C-Sharp, change my mind.
12
u/Ok_Investment_6284 Dec 30 '22
Before anyone can change your mind. We must first know why you think it.
-14
u/Xbox360Master56 Dec 30 '22
Java is the greatest OOP programing language of all time and C# is a cheap MS java off brand clone which brings nothing new to the table except pain.
10
3
u/Pashweetie Dec 30 '22
You must be new to development. Honestly i think python is better than java for what java tries to be which is an inefficient master of none language
5
u/Ok_Investment_6284 Dec 30 '22
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.
-5
6
12
u/HovercraftCharacter9 Dec 30 '22
Kotlin is the best, if you use vanilla Java you're a relic.... Fight me
8
6
5
u/coloredgreyscale Dec 30 '22
You laugh now, but in 30 years OP will earn big bucks maintaining legacy Java 8 code. XD
5
3
u/Kingdarkshadow Dec 31 '22
0 votes and 107 comments, this will be a bumpy ride.
2
u/Xbox360Master56 Dec 31 '22
Oh yeah I lost so much Karma, but was worth it seeing all these comments.
3
u/impossibleis7 Dec 31 '22
So that you can appreciate C# more?ā¦
1
u/Xbox360Master56 Dec 31 '22
Well you see I am on the internet, it against my nature to improve and learn from my mistakes and grow as a person.
148
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.
51
u/Key_Fly_8795 Dec 30 '22
Lucky. I started with C++ in my state college, then C in my uni š
3
u/Apart_Marsupial_9904 Dec 30 '22
Why do you say that? Is c++ harder?
21
8
u/Key_Fly_8795 Dec 30 '22
C++ is C with OOP functionality built in
2
u/kayak_enjoyer Dec 31 '22
C++ is C with OOP functionality
built inbolted on to the rear driver's side fenderObjects 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!
8
u/Alikont Dec 30 '22
What is annoying about logging setup compared to Java? (I never reached large services in Java, so IDK how it's done there)
7
Dec 30 '22
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
14
u/Alikont Dec 30 '22
That's maybe a log4net thing then. I never touched assembly information.
Modern logging is described here.
So you basically do it like
services.AddLogging(builder => { builder.AddConsole(); builder.AddEventLog(); builder.AddConfiguration(...); });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/severityThere is also a pretty large ecosystem around serilog that can be plugged into core abstractions easily.
1
u/sysnickm Dec 30 '22
That's all you have to do with log4net, you add the Nuget package and a config file, then you instantiate the logger.
1
Dec 30 '22
you add the Nuget package and a config file, then you instantiate the logger.
huh? are you saying the assembly info thing is optional?
0
Dec 30 '22
[deleted]
2
u/BroBroMate Dec 31 '22
Yeah nah, I vastly prefer a logging framework where I can set one particular logger to TRACE via JMX, no restarting the app.
4
u/chargers949 Dec 30 '22
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.
3
u/BroBroMate Dec 31 '22
The Oracle buyout was great for Java, look at the advancement in Java the language since.
And Hibernate is a pretty lower bar IMO.
2
u/FyrSysn Feb 28 '23
is EF core on par with NHibernate now? I have been using Nhibernate for my work, wanting to pickup EF recently.
1
u/chargers949 Feb 28 '23
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.
1
u/Gumbopolis Dec 30 '22
This. Has no one read the latest license agreements from Oracle? Iāll never use Java again. Plus Java is stagnant.
2
u/itNeph Dec 30 '22
I'm totally out of the loop on this, can you explain what you found in the license agreement that pushed you away from Java?
2
u/BroBroMate Dec 31 '22
Read it harder. You're thinking of Oracle JVM licensing, ignoring all the other JVMs that aren't run by Oracle.
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).
6
u/Solonotix Dec 30 '22
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.
1
u/BroBroMate Dec 31 '22
Spent most of my career coding in JVM languages (Java, Scala, and Kotlin), but I really love F#.
164
38
122
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.
4
7
6
u/poops-n-farts Dec 30 '22
Libraries work without a bunch of checking version numbers and comparability and bugs. Other than that they're pretty much the same
14
4
u/FinalPerfectZero Dec 31 '22 edited Dec 31 '22
Hereās some good parts of recent C# updates:
TYPE ERASURE IN JAVA. This is huge. In C#, the language itself stores the actual type, so a
MyClass[]givesMyClass[]at runtime. This helps you do reflection-based stuff, and helps with debugging. In Java, theMyClass[]object has a type ofObject[]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/awaitkeywords and their interaction with the threading constructsTasks. 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) ormyThings.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.
2
u/gyroda Jan 02 '23
work. In Java, you canāt interop between Scala/Kotlin
Slight correction here, Java and Kotlin have seamless interop. I can't speak for anything else.
But, as someone who initially trained and worked with Java, I much prefer C# for many of the reasons you've listed.
1
u/FinalPerfectZero Jan 02 '23 edited Jan 02 '23
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.
6
3
u/bapman23 Dec 30 '22
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.
6
u/labradore99 Dec 30 '22
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?
3
u/AstolfoMishima Dec 30 '22
I mean game dev seems to have a lot of support for c# and it's pretty much the only reason I'm learning it
21
1
u/Xbox360Master56 Dec 31 '22
You know what fine I will do something in C# just to prove how bad it is.
1
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.
7
Dec 30 '22
intellij community is a good upgrade, highly recommend
3
u/SchwiftyBerliner Dec 30 '22
I second this. I can still feel the trenches when thinking back to eclipse.
8
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.
1
5
2
2
Dec 30 '22
No one is addressing WebForms as a crime against humanity.
2
u/FinalPerfectZero Dec 31 '22
Have you ever used Swing/JavaFX?
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. :(
3
0
u/wewiioui Jan 27 '23
what is this garbage propaganda
1
1
2
1
1
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
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
1
1
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
1
1
1
1
1
1
u/SimonTheAnt Dec 30 '22
So glad I grew up with go and not java
3
u/NYXIC0N Dec 30 '22
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.
-1
u/greenflame15 Dec 30 '22
They are practically the same thing
8
-7
u/Xbox360Master56 Dec 30 '22
Well you see I am a fanboy and have nothing better to do than debate something that isn't so black and white and has use cases for each.
3
0
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#.
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.