Is C# Better than Java?

แชร์
ฝัง
  • เผยแพร่เมื่อ 26 ม.ค. 2025

ความคิดเห็น • 193

  • @battletremor
    @battletremor ปีที่แล้ว +34

    I have just started programming in c#, It was very easy to learn and I could put my logic into code effortlessly. So c# is a better choice for me, this video helped me understand more about c#, great work 💯

    • @GavinLon
      @GavinLon  ปีที่แล้ว +3

      It's my pleasure. I'm really happy that this video has been helpful to you :)

  • @aweklin
    @aweklin ปีที่แล้ว +29

    The differences are the reason I stick with C#. Though, I started with Java but more mouth watering features of C# made me stick to it.
    C# wins almost everywhere if objectively compared.

    • @GavinLon
      @GavinLon  ปีที่แล้ว +4

      I totally agree! C# wins for me too! Thank you for your comment! :)

  • @femidaniel
    @femidaniel ปีที่แล้ว +11

    My Experience,we once had an airtime vending project built with Java and deployed on wildfly,,@ peak demand periods it would suddenly freeze daily,when we moved over to another one built with C#, i took time to note we only restarted that application twice in a whole year,i have a great Java Dev as a friend too,but Microsoft with DotnetCore and now Blazor will always be my preferred choice and serious wide margins,Thanks for the detailed post,great work.

    • @GavinLon
      @GavinLon  ปีที่แล้ว +2

      You are very welcome! Thanks so much for sharing your experience with both Java and C#/.NET. I will certainly not be moving over to Java any time soon. I'm very happy sticking with .NET and C# :)

  • @LE8271
    @LE8271 ปีที่แล้ว +6

    I believe one aspect is missing from the summary. It is the fact that .net core was created containers and Internet in mind. When it comes to containerization it just kills Java hands-down. Look at the size and the performance of a Java based container that tells everything.

    • @GavinLon
      @GavinLon  ปีที่แล้ว

      Great, yes that is a useful addition - thank you!

  • @MegaJohn144
    @MegaJohn144 ปีที่แล้ว +17

    I programmed in Java for about 10 years, but I never fully got it. Java and all its tools seemed clumsy and disjoint. After retiring, I taught myself C# and Python, and I much prefer them. I cut my teeth on C and C++, so it is a natural choice.

    • @GavinLon
      @GavinLon  ปีที่แล้ว +2

      Yes exactly, why make life harder than it needs to be? :) Python and C# are so much easier to learn and apply in my humble opinion. My first language was C - definitely a great first language.

  • @lufenmartofilia5804
    @lufenmartofilia5804 2 หลายเดือนก่อน +2

    I code in both in a daily basis and I prefere personally java. The reason is the ecosystem, the language doesn't bloat with keywords and hide logic from the user.
    Java is straightforward easy to read, verbose (which is a good thing imho, as it make crystal clear what is happening). Further more a lot of important/ highly reliable tech I work with (Kafka, hivemq, apache beam, elastic search etc) was buildt in java with java in mind. While they do sometimes do have a c# client, they mostly feel like a second hand citizen.
    Furthermore, c# dependency often require some form payment (example if you need to do an advanced ETL pipeline that require to process a big amount of data, you end up using efficient data format like .avro.) while c# can work with it, free libs they have are far from as good as java.
    Not to mention virtual threads that is a god sent.
    Now everything is not pretty on java side too. Java is basically only usefull for backend / embedded environment which make it a very specialized language and not as versatile as C# that does : gaming, backend, frontend, desktop app etc.
    An other thing is that migrating legacy java (java 8) to modern java (21+) is a pain in the ass.
    Too much jobs require to work still on java 8 because of the migration problem / cost.
    Also java mentality in general is all about being functional and stable and less about rushing behind the new flashy trend or methodology that get popularity outside (95% of case) of the real world usage. This can be a plus or a con based on the envirronment. But usually this can be solved by basically using kotlin.

    • @GavinLon
      @GavinLon  2 หลายเดือนก่อน +1

      Thanks so much for this detailed feedback! :)

  • @michel_dutch
    @michel_dutch 5 หลายเดือนก่อน +11

    The best language is the one that pays the bills. In my case, that would be Java.

    • @GavinLon
      @GavinLon  5 หลายเดือนก่อน

      I totally agree with you! Definitely pay the bills as first priority :)

    • @michel_dutch
      @michel_dutch 4 หลายเดือนก่อน

      @@GavinLon I'd like to add that I do appreciate C# in that it provides an incentive for Java to improve, the same way that Groovy and Kotlin did. Java is becoming an awesome language. Well, at least if you started with Java 6, that is. 😊

    • @lufenmartofilia5804
      @lufenmartofilia5804 2 หลายเดือนก่อน +1

      Well that is how I ended up with java too but to be fair java or c#, you can't go wrong with any of them 😁

  • @hammeedabdo.82
    @hammeedabdo.82 ปีที่แล้ว +7

    My personal opinion is that C# is better, and it should be ranked after Python and JavaScript. However, I don't know why I always see Java ranked before C#?

    • @GavinLon
      @GavinLon  ปีที่แล้ว +8

      I honestly and objectively cannot think of a better programming language than C#. I also like Python and JavaScript, they certainly have their place but Java could probably be seen as the most similar language to C#, and in my humble opinion C# wins hands down! :)

    • @igorthelight
      @igorthelight 4 หลายเดือนก่อน +1

      They are ranked by popularity - not on how good they are.
      Typescript is better than JavaScript but it's rated lower ;-)

  • @cissemy
    @cissemy ปีที่แล้ว +2

    Thanks
    Can you make one about CSharp vs python ?

    • @GavinLon
      @GavinLon  ปีที่แล้ว +2

      I've already done that. :) Please check out the video here - th-cam.com/video/DWH0T5bK9kE/w-d-xo.html

  • @adikztv6371
    @adikztv6371 ปีที่แล้ว +5

    It isn't 100% fair to say that the difference between Java and c# is that you can Write frontend in c#. In java you can do it as well. If you want to make such notion then you'd Rather have to compare These technologies instead of saying that Java lacks it

    • @GavinLon
      @GavinLon  ปีที่แล้ว +1

      Okay - thanks for your feedback :)

    • @kaihusravnajmiddinov5413
      @kaihusravnajmiddinov5413 7 หลายเดือนก่อน

      How you do it in java ? Of course I know you can write WASM compiler from scratch, or java-to-javascript compiler. But is there anything ready for that ?

    • @adikztv6371
      @adikztv6371 7 หลายเดือนก่อน

      @@kaihusravnajmiddinov5413 you can do JSP (probably not a good idea as it's a bit old technology) or you can use thymeleaf.

    • @dennycrane2938
      @dennycrane2938 3 หลายเดือนก่อน

      ​@@adikztv6371 lo.. So your argument is that you CAN do it, ... you just have to time travel back to 1999 or 2011 to do it. There's also more to frontend than web. What are the desktop options and when were they last updated/evolved? yikes

  • @marcus31425
    @marcus31425 8 หลายเดือนก่อน +2

    Whatever language I use, I always miss at least one feature that C# has

  • @RedbeardyMcGee
    @RedbeardyMcGee ปีที่แล้ว

    did you generate this video script with chatgpt 1.0

    • @GavinLon
      @GavinLon  ปีที่แล้ว +2

      No - I never use AI in my videos.

  • @ryanobray1
    @ryanobray1 ปีที่แล้ว +3

    I wish that C# would include the ability to add properties to enums like Java, but that's pretty much where it ends for me. Perhaps my biggest turn off with Java is that Oracle is the language steward. I also VERY much prefer Visual Studio over IntelliJ and Eclipse AND not having to deal with pom files.

    • @GavinLon
      @GavinLon  ปีที่แล้ว +1

      Thanks for this interesting comment. Visual Studio definitely makes life a lot easier. I wonder if Microsoft will add properties to enums in a future version of .NET - might happen :)

    • @julianjupiter5890
      @julianjupiter5890 ปีที่แล้ว

      Oracle may be a bad company in general. But we should not judge by that optic as far as Oracle being steward of Java is concerned. Oracle turns out way better steward of Java. Those who observe objectively do recognize Oracle being good steward.

    • @dotnetforever
      @dotnetforever ปีที่แล้ว

      "Properties to enum"... Are u okay? That it wont be an enum.

    • @julianjupiter5890
      @julianjupiter5890 ปีที่แล้ว

      The good thing with build system like Maven (pom.xml) is you don’t need IDE to build our app.

    • @kaihusravnajmiddinov5413
      @kaihusravnajmiddinov5413 7 หลายเดือนก่อน

      @@julianjupiter5890 honestly speaking, oracle is not even close to Microsoft in terms of product development culture and enthusiasm.
      I think oracle lacks scientists. By other words real smart people in managerial positions. I am sure many smart people work in oracle, but those are probably not in decision making positions.

  • @stelios.a
    @stelios.a 2 หลายเดือนก่อน

    The choice of collaboration among developers severely underrates partial classes. You can use them to "extend" code generated from a source generator without messing up with the source generator itself. Try it and you will see what I mean. :)

  • @Viewer990
    @Viewer990 หลายเดือนก่อน

    This was explained in such a fun yet simple way! Thank you!!

    • @GavinLon
      @GavinLon  หลายเดือนก่อน

      You are very kind. Thanks so much for your positive feedback! I'm so glad you enjoyed the video :)

  • @paulpach
    @paulpach 9 หลายเดือนก่อน +2

    I work in Java most days at work. It is an ok language. Libraries like spring boot help make it more palatable.
    Then I go home and work on my own projects in C#.
    So if I have the choice, I will choose C# for many of the reasons you listed.

    • @GavinLon
      @GavinLon  9 หลายเดือนก่อน +1

      It's great to get comments like yours that are based on personal experience with the relevant languages. Thank you for your comment :)

    • @himanshutripathi7441
      @himanshutripathi7441 6 หลายเดือนก่อน

      Dck cbippllledsreEE😂🎉😂El​@@GavinLon

  • @Ewig_Luftenglanz
    @Ewig_Luftenglanz 9 หลายเดือนก่อน +5

    C# as a language is more flexible and we may say "better" than Java. But Java has a far better, bigger and open ecosystem and multiplatform support. With C# you are basically traped in a golden cage made and controlled by Microsoft, I know the latest versions of .NET framework (.Net core) has multiplatform support but it came very late AND the multiplatform support it's incomplete (no win forms for Linux for example) also the nature of .NET in the past and all the legacy applications have made that basically 95% of C# development is focused on windows. Nothing wrong with that, but if you are not interested in windows development (both server and desktop) real world C# development will mostly target Microsoft and azure and that's a limitation.

    • @GavinLon
      @GavinLon  9 หลายเดือนก่อน +2

      Awesome! Thank you! It's great to get a fairly detailed comment from the Java perspective! :)

  • @vijayansivaraman7923
    @vijayansivaraman7923 ปีที่แล้ว +2

    C# wins over java. Great video on the planet to showcase the pros and cons of c# and java. Kudos to your hard work and efforts.

    • @GavinLon
      @GavinLon  ปีที่แล้ว

      Thank you for your very kind comment! It is greatly appreciated :)

  • @H4KnSL4K
    @H4KnSL4K 7 หลายเดือนก่อน

    Have you tried to install .Net core SDK on Linux? The instructions have so many caveats and only the latest version is supported (well, it depends...) and many ways to install it . And different problems with different choices... Java is not perfect, but it is much better supported

    • @GavinLon
      @GavinLon  7 หลายเดือนก่อน +2

      Great to get push back from the other side. Thank you for your comment. I'll look at .NET on Linux at some point - that will make for an interesting video topic. Java is a great technology, but on the whole I just prefer .NET.

  • @igorthelight
    @igorthelight 4 หลายเดือนก่อน

    A few additional interesting things about C#:
    * It has a "dymanic" type which is the same as in Python - a dynamic type! It's slow but you can do things like that:
    dynamic my_var = 10;
    my_var = "hello";
    * Since .NET 8 you could compile application to a native binary! It will have a Garbage Collector with it but you would not need .NET installed on the system! And also it works faster and uses less memory!

  • @tanakamichael-dp1nb
    @tanakamichael-dp1nb ปีที่แล้ว +8

    Java was my 2nd first programming language. Used it quite a bit until I started to hate it, then I switched to JavaScript with mostly Angular. Later on, I picked up on how some startups are combining Angular and .NET to create performant solutions. So, I embarked on a journey to learn C# language basics early this year. One thing I'm certain of is I'm staying with C# and .NET. Definitely it's better than Java.

    • @GavinLon
      @GavinLon  ปีที่แล้ว

      Thanks for this interesting comment! Yes, it's also quite convenient that .NET provides Angular and React project templates to make it easy to combine relevant front-end SPA frameworks with .NET and C# on the backend. :)

  • @isnotnull
    @isnotnull ปีที่แล้ว

    Is Java still using get and set compared to properties in C#

    • @GavinLon
      @GavinLon  ปีที่แล้ว

      This is how getter and setter properties are implemented in Java - www.geeksforgeeks.org/getter-and-setter-in-java/

    • @isnotnull
      @isnotnull ปีที่แล้ว +1

      @@GavinLon So still no auto properties. I learned Java in 2014, seems no progress since then

    • @GavinLon
      @GavinLon  ปีที่แล้ว

      @isnotnull I don't think Java have auto implemented properties like in C# :)

    • @henryvaneyk3769
      @henryvaneyk3769 ปีที่แล้ว

      @@GavinLonAlmost no Java devs use get and set anymore. We all Lombok our properties.

    • @blueSurfer
      @blueSurfer ปีที่แล้ว +1

      Java also has records . so we can only write a single line to create getters, setters, toString, hashcode. public record Employee(int id, String firstName, String lastName) {}

  • @jaymartinez311
    @jaymartinez311 9 หลายเดือนก่อน +1

    Started with C++, then python and then Java. Left all of that behind once i started using typescript. Got a job in Vuejs saw i was dealing with many api fetches & changing the data for my use case once fetched, so i started learning back end. Tried typescript blah. Java was a mess for it. Golang was great but didn’t have enough stuff built in. Rust was fun but without a framework i couldn’t learn how to use lifetimes but polonius might fix that soon. Then i finally tried C# seriously with their ugly bracket placements 😂. I love it. Dotnet 8/C# 12 is like a typed typescript. It’s my favorite language. The brackets i use K&R code style meaning them brackets are with the signature on the same line 😜. I usually use a big O notation project to learn a language & hands down C# was flawless in creating such a project. inline object creation with new = { } is one of the many js/ts type coding i love C# for. Though Java & C# look alike from far away C# is a much bigger language & much much better to develop in and the cli is awesome 😎

    • @GavinLon
      @GavinLon  9 หลายเดือนก่อน +1

      Wow - thank you for this well thought out comment! I really enjoyed reading it and I totally agree with you on everything you said about C#! It's definitely my favourite language too! :)

    • @jaymartinez311
      @jaymartinez311 9 หลายเดือนก่อน

      @@GavinLon Only frustration is i’m 41, just got my CS degree but Jr roles (real ones) are non-existent anymore. I love this stuff but i guess i’ll just build something with a dotnet backend with vuejs or if im lazy webflow for the frontend 😂🫡

    • @GavinLon
      @GavinLon  9 หลายเดือนก่อน +1

      You'll get a job. Just keep going and keep building. My advice is build something awesome and get it into a GitHub repository - so that you can show potential employers what you are capable of creating. Don't worry about your age - 41 is pretty young these days anyway. Just keep going - you certainly have great enthusiasm and seem to love coding - that is very important! :)

    • @jaymartinez311
      @jaymartinez311 9 หลายเดือนก่อน

      @@GavinLon Thank you for the kind words.

  • @marko5734
    @marko5734 ปีที่แล้ว +1

    Great video as always

    • @GavinLon
      @GavinLon  ปีที่แล้ว +1

      Thank you very much! :)

  • @diadetediotedio6918
    @diadetediotedio6918 9 หลายเดือนก่อน

    I prefer Kotlin because the syntax is way nicer, but I love C# because it has a waaaaaaay better runtime with value types and type monomorphization, a Kotlin for .NET would be the best of both worlds.

    • @GavinLon
      @GavinLon  9 หลายเดือนก่อน

      Thanks for your great comment. I must say I'm intrigued by Kotlin and would like to explore the language more. I like what you said about C#, .NET is an amazing runtime and I love the type system! It's definitely my favourite programming language.

  • @dirkschannel5817
    @dirkschannel5817 ปีที่แล้ว

    Another great Video.
    I used both in my career. C# long felt like the better Java. For the defense of Java one should keep in mind that Java is a bit older than C#, so Microsoft could improve C# and add stuff like properties. Since C# can now be used on Linux systems, the main advantage of Java vanished.

    • @GavinLon
      @GavinLon  ปีที่แล้ว +2

      C# has benefitted from being the younger language. Now that C# is cross platform, C# and .NET, in my humble opinion, is far better than Java.

    • @hugochavez6170
      @hugochavez6170 ปีที่แล้ว

      What do you mean with properties?

    • @dirkschannel5817
      @dirkschannel5817 ปีที่แล้ว

      @@GavinLon Do you know Dave Plummer’s channel? The result of the software drag race with implementation of the prime sieve algorithm regarding C# and Java was an interesting surprise. Would be interesting to see a rematch with .NET 8

    • @GavinLon
      @GavinLon  ปีที่แล้ว

      @@dirkschannel5817 I'll check out Dave Plummer's channel. Thanks! It would be good to do a deep dive comparison between C# on .NET 8 and Java - its just finding the time to do all these things :)

  • @nestormartinez9259
    @nestormartinez9259 ปีที่แล้ว

    In fact C# it's cool lenguage but here where I live Java came with a better salary and also it's more used, althought maybe this could be change soon. I belive not in a way where java would be replace but in way where both of them compete more directly in fields where Java is well adpted like banks and other enterprise aplications.

    • @GavinLon
      @GavinLon  ปีที่แล้ว +1

      Yes, Java is still more widely used than C# in general, but that gap is getting narrower. Java is certainly a great technology but I prefer .NET and C#. The great thing about these two languages is that if you know object oriented principles and you are skilled in one of these two languages, it is relatively easy to learning the other language (because they are very similar in many ways).

  • @TedFanat
    @TedFanat 2 หลายเดือนก่อน

    There was a moment in my career when I worked on a project with C# and Java. It was .NET 4.6/C# 7(not sure) and Java 8. Java 8 came out only a year before C#7 but has absolutely NO CHANCE against it - Java is worse in all possible and impossible criteria. But I have no idea of how is modern Java compared to modern C#. Also, I heard Kotlin is also very nice, but yeah it's no Java, so it's a different story

    • @GavinLon
      @GavinLon  2 หลายเดือนก่อน

      I definitely want to do a deep dive on this channel into Java and Kotlin. Thank you for sharing your experience and point of view :)

    • @lufenmartofilia5804
      @lufenmartofilia5804 2 หลายเดือนก่อน

      Kotlin is java. You run on the jvm, you use java ecosystem, it compiles to bytecode and are fully interoperable

  • @randyriegel8553
    @randyriegel8553 ปีที่แล้ว

    I used Java a long time ago. Then I met up with C#... It had almost the same syntax the time but C# was like Java on steroids. Been a C# developer since 2005. My first job out of college I used plain C on a SCO Unix server. It's very funny now that the company I work for has many languages for different things... my biggest downfall is Python... I always have to search stuff up or ask the Python Guru at our company when working that stuff.

    • @GavinLon
      @GavinLon  ปีที่แล้ว

      Thanks so much for sharing your experience. C was actually the first language that I studied, VB6 was the language I used at my first job, then I moved to VB .NET and then C#..Most people seem to favour C# over Java - and I can certainly see why. Python is definitely worth learning, especially with the rapid evolution of AI! :)

  • @wakeelsaliu5190
    @wakeelsaliu5190 ปีที่แล้ว +2

    C#. It's faster, and knowing only C# is enough to be a fullstack developer and also build both your mobile and desktop apps with it.

    • @GavinLon
      @GavinLon  ปีที่แล้ว +1

      Yes, those two points certainly make C# sound like a great choice over Java. :)

  • @JakeMGolle
    @JakeMGolle 7 วันที่ผ่านมา

    My literal only concern with C# is the hold that Microsoft has over it.

  • @potatoml4631
    @potatoml4631 ปีที่แล้ว +5

    C# but im using Java for work

    • @GavinLon
      @GavinLon  ปีที่แล้ว

      Java is an awesome technology but I much prefer C# and .NET. Nothing wrong with Java at all in my humble opinion.

    • @christopherwilliams3293
      @christopherwilliams3293 ปีที่แล้ว

      I'm in the same both. I do admit that IntelliJ is better than Rider, but Jetbrains does allocate a lot of resources to Rider still. I wish Rider had search structurally and the rich debugging features like IntelliJ. However, Rider team is very busy keeping up with the .NET technologies.

    • @kaihusravnajmiddinov5413
      @kaihusravnajmiddinov5413 7 หลายเดือนก่อน

      You work sucks 😂 (joke)

  • @barkeldiho
    @barkeldiho 8 หลายเดือนก่อน

    Who starts a video like that disqualifies himself immediately :D

    • @GavinLon
      @GavinLon  8 หลายเดือนก่อน

      lol - just intended as a bit of fun :)

  • @fabricehategekimana5350
    @fabricehategekimana5350 ปีที่แล้ว +2

    Thank you for this informative video ! I am really proud to see the new iteration of C like C++, Java, C#, or Rust my preferences:
    1. Rust
    2. C#
    3. C++
    4. Java
    Actually, I heard that Java is paid more because companies have a large code base of legacy code written in Java (too expensive to switch technologies) and some java devs are retiring so a java dev is a precious resource

    • @GavinLon
      @GavinLon  ปีที่แล้ว +1

      Very good point about large Java code bases of legacy systems. So Rust is your number 1 - I hear it is a great language - I look forward to diving deep into Rust fairly soon! :)

  • @joakimdahlstrom2532
    @joakimdahlstrom2532 ปีที่แล้ว

    Regarding split classes... Now... I'd argue that the intended group of programmers sat down and at least learn SOLID if ending up having to split the classes :)

    • @Turko77777
      @Turko77777 ปีที่แล้ว

      I don't understand what you're saying

  • @farrenh
    @farrenh ปีที่แล้ว +1

    C# is wayyy better than Java in terms of language design. But also its runtime is better. Don't listen to people who've invested decades in Java when they tell you that performance and resource use are roughly similar and it depends on the application. It's just not true. .Net runtime is more performant and uses less resources. And it absolutely slaughters Java in high concurrency tasks (1 million+ equivalent concurrent tasks on the same hardware)
    The video mentions pointers in C#, but doesn't mention that apart from the performance gains from doing some C# algorithms with direct pointers and pointer arithmetic (in an unsafe {...} scope), you can use pointers in C# to run inline assembly by getting a delegate function pointer to the start of a byte array representing assembly code. Which means you can get the same or better performance than C/C++ code using assembly for specific functions. I mean aside from just interoperating with C libraries, which you can also do. But Java can do that too.
    Also not mentioned in the video (because its mainly about the languages not their runtimes), but the .net runtime does tail-call optimization of recursive functions, whereas the JVM does not. You can google what that means, but the Cliff's notes version is:
    If you write a recursive function where the self reference is the last statement in the function, like this
    int myFunc(int i) {
    //do stuff with i
    if (someExitCondition) {
    return i;
    } else {
    return myFunc(i);
    }
    }
    The .net runtime will optimize it so that there is only ever one instance of the function on the stack. That means it can continue recursing (calling itself) endlessly, without constantly consuming more memory. No matter how many recursions it will only consume the memory required for a single instance of the function. The JVM, in contrast, will create a new instance of the function on every call, while preserving every previous instance, meaning if it recurses for ever it will continuously consume more memory and you *will* eventually get a stack overflow.
    Also not mentioned: Java *still* doesn't have properties (looks and behaves like a public variable or constant from the outside, getter and setter methods hidden under the hood) or events (much easier than using callback interfaces in Java) as first class language constructs, unlike C#.
    And they only just introduced pattern matching in Java. C# has had it for something like 7 years. And like most equivalent features, the C# version is much less verbose.

    • @GavinLon
      @GavinLon  ปีที่แล้ว +1

      Wow - thanks for these additional points. I especially love your point about recursion! When I've got the time I'd love to do a much deeper dive into C# vs Java. The points you make here show just how much thought has gone into .NET and C# optimisations.

    • @aliksargsyan2782
      @aliksargsyan2782 3 หลายเดือนก่อน

      First of all using pointer to reach C/C++ performance it is a dream dude, because C/C++ are compiled language while C# not. What about Java, Java's key target is multicore processors via multi threading which is more faster then async await . C# really fast to fetch requests form database, handling file system by using acync await while Java more faster for large data processing by using multy threading. That's why 90% of banking, commercial, enterprise level and critical applications whice requires large data processing are written with Java. That's the main reason that Java relies on traditional multi threading.

    • @aliksargsyan2782
      @aliksargsyan2782 3 หลายเดือนก่อน

      First of all using pointer to reach C/C++ performance it is a dream dude, because C/C++ are compiled language while C# not. What about Java, Java's key target is multicore processors via multi threading which is more faster then async await . C# really fast to fetch requests form database, handling file system by using acync await while Java more faster for large data processing by using multy threading. That's why 90% of banking, commercial, enterprise level and critical applications whice requires large data processing are written with Java. That's the main reason that Java relies on traditional multi threading.

    • @farrenh
      @farrenh 2 หลายเดือนก่อน

      @@aliksargsyan2782 You can do true multithreading in C# so that's not really a Java advantage. It's just that Java defaults to multithreading as the idiomatic way of doing concurrency while async is the default idiomatic way of doing it in C# - not the *only* way. That's what makes C# so great. Its *far* more flexible and supports more paradigms in the base language than Java.
      And I have seen many, many benchmarks comparing optimized concurrent code spawning the same number of concurrent processes written by people who are intimately familiar with both languages and its simply a fact that C# murders Java when you get to very high numbers of concurrent tasks on the same hardware. I mean like 1 million + concurrent tasks. At much lower numbers of concurrent tasks Java has an advantage, but it vanishes and reverses when you scale. My practical experience with both languages and their runtimes makes me certain that the runtime engine is vastly better optimized for scaling, tail recursion and many other aspects .Net than Java's runtime is.
      It makes me very sad every time I have to work on a bunch of interacting but seperate Java projects (Like clients, servers, apps and libs) because I know that no matter how powerful my dev hardware, the JRE is going to greedily try to grab as much of my machine's resources as possible and not release them until I unload everything. Android Java development using Android Studio is the absolute worst, because even on a new dev laptop with 32GB of RAM I know that opening three projects simultaneously (like an app and two SDK library projects that it uses) and doing a bunch of builds will end up consuming most of my RAM and the machine becoming slightly sluggish and less unresponsive, at which point I must close everything and re-open it before continuing. I feel like people who mainly only develop in Java just don't realize how crap the experience is compared to working with other better optimized stacks.
      Also using pointers and pointer arithmetic in unsafe blocks of C# code does make it possible to make certain algorithms faster in C#, in a way that is not possible in Java. Its irrelevant to this discussion whether C# is slower than C++ (which is not Java) because its a bytecode language that is executed by a runtime. What's relevant is that it has constructs like unsafe scopes and pointers that make it possible to optimize some algorithms, in a way that is not possible in Java.
      But since you raised that point - although IIRC this is considered a hack and not recommended - you can actually hack C#s unsafe scopes and pointers to run actual native machine code inline. I've seen tutorials on how to do it. Which I mentioned above.
      Finally, you can now compile C# to actual native code, like go, rust and C++, in a non hacky way. See this video:
      th-cam.com/video/sa3XsvSiMtk/w-d-xo.html

  • @slr150
    @slr150 ปีที่แล้ว +8

    Java is more careful about introducing new syntax than C#. C# may not be very attractive in the moment, but in the long run you get a more stable language in Java.
    A good example is Java victual threads, it was carefully designed to make sure that functions are colorless, where c# is still stuck with colored functions and await/async. The trouble with having new syntax catering every new fad is that when it goes out of fashion you are left with language bloat. C++. is another example of language bloat going badly .

    • @GavinLon
      @GavinLon  ปีที่แล้ว +2

      I like your point about syntax. It is far more important to learn programming principles and fundamentals - code sugar can be good but it should not be a priority, as you say to follow every fad that comes along :)

    • @dotnetforever
      @dotnetforever ปีที่แล้ว

      What is the new systax is really bad in c# added in the latest releases?

    • @slr150
      @slr150 ปีที่แล้ว +1

      ​ @DmitryBaranovskiyMrBaranovskyi
      The trouble is not with "new syntax" , it is when "new syntax" eventually becomes old syntax and goes out of fashion.
      I already gave you an example with sync/wait (these color your functions). Java accomplished the same thing as async/await without introducing a single keyword or having a color limitations on function calls (Lookup project loop/virtual threads).
      Although I think Java is better than C# when it comes to unnecessary features, it still has some historical baggage. I would personally pick Go instead of Java/C# for new projects. Go has minimal syntax, had virtual (green) threads from the start, avoids multiple ways of doing the same thing, and is relatively fast compared to C#/Java.

  • @henryvaneyk3769
    @henryvaneyk3769 ปีที่แล้ว +1

    Any developer that limits their programming toolbox to a single language is a fool. Rather learn to use both Java and C#, and do not stop there.

    • @GavinLon
      @GavinLon  ปีที่แล้ว +3

      As a new developer, I personally wouldn't waste my time learning both C# and Java. I would specialise in one of these languages but I do certainly agree with learning more than one language, but between Java and C#, I would pick one or the other. I would then perhaps learn Python for machine learning and data science applications. I think regardless whether you are proficient in C# or Java, you should definitely learn JavaScript, especially if you are an aspiring web developer. There are some attractive new languages like Rust or Go - which I would also consider learning.

  • @samsondavidoff372
    @samsondavidoff372 หลายเดือนก่อน

    I totally prefer C# because of it's modern syntax and other reasons but I have to choose Java just because I hate windows and unfortunately .NET programming has not fully support for other operating systems. Of course .NET Core can be installed on macOS but we can't fully use essential tools from .NET ecosystem on macOS or even Linux. We don't have Visual Studio and SQL-Server on macOS and Linux. I know it's possible to work with SQL-Server through Docker but it has performance lack. Also we can using SQL-Server Management Studio (SSMS) just on Windows! I don't think Microsoft has a plan to officially bring these products to macOS and Linux (maybe because Microsoft wants to prevent migrating from Windows to another operating systems). In past we had Visual Studio for Mac that was terrible. It was based on Monodevelop IDE that compared to Visual Studio (Windows version) didn't have full features! Finally Microsoft discontinued Visual Studio for Mac and suggest developers to use Visual Studio Code but even vscode doesn't have main Visual Studio dialogs and other necessary tools to work on C# projects.
    So I disappointed from Microsoft and decide to work with Java language (but in the end I still love C# 😂 )

    • @GavinLon
      @GavinLon  หลายเดือนก่อน

      Thanks for this excellent, detailed comment. :)

  • @judewestburner
    @judewestburner 3 หลายเดือนก่อน

    For me it entirely depends on the job I'm going for.

  • @vincentfernandez7328
    @vincentfernandez7328 5 หลายเดือนก่อน

    the question is very simplistic. You don't consider the historic point of view... From that point of view it was java (sun microsystems) who develop all this new technologies, architecture etc... Microsoft just copied it. From this point of view without a doubt Java is much better. Also you dont consider the frameworks... It is not only the language itself but Java frameworks that were developed ahead of anybody else...

    • @GavinLon
      @GavinLon  5 หลายเดือนก่อน

      I wouldn't say that Microsoft just copied Java. I believe Microsoft was certainly influenced by Java (especially by the Java Runtime Environment and Java Virtual Machine), but I think C# was developed with a view to combine the rapid application development capabilities of Visual Basic and the power and expressiveness of C++ (in fact Anders Hejlsberg even said as much). I have a bias toward C# and .NET but I do appreciate that Java is a very powerful language and platform.

  • @nicholasbrooks7349
    @nicholasbrooks7349 3 หลายเดือนก่อน

    I was a java fanboy until I built my first windoss phone app and game with monogame.

    • @GavinLon
      @GavinLon  3 หลายเดือนก่อน

      Thank you for sharing your experience. I'll have to experiment with monogame myself :)

  • @kaihusravnajmiddinov5413
    @kaihusravnajmiddinov5413 7 หลายเดือนก่อน +2

    C# and its ecosystem is (nowadays) developed by more smarter people than those in Oracle struggling to develop java.
    That's the main, perhaps only reason why c# is really more productive in action.

    • @GavinLon
      @GavinLon  7 หลายเดือนก่อน +1

      As you have alluded to in your comment, Microsoft is certainly in a position where they can hire the best people :) That of course is reflected in the quality of their products.

    • @kaihusravnajmiddinov5413
      @kaihusravnajmiddinov5413 7 หลายเดือนก่อน +1

      @@GavinLon yes, agree. But again, I am not sure if any tech company which got similar financial capability may reach the same results. E.g. apple is very rich company, but it's programming languages (objective c, swift) are far from being good problem solver, rather than on it's own hardware.

    • @GavinLon
      @GavinLon  7 หลายเดือนก่อน +1

      @kaihusravnajmiddinov5413 Interesting point, I do think for e.g. Anders Hejlsberg (who lead the team that designed and developed C#) is exceptional.

  • @bigbilly29
    @bigbilly29 7 หลายเดือนก่อน

    Great video earned a sub. Cut nails

    • @GavinLon
      @GavinLon  7 หลายเดือนก่อน

      Thank you! :)

  • @RLstavista
    @RLstavista 8 หลายเดือนก่อน +1

    Yes

  • @sugekanu6163
    @sugekanu6163 10 หลายเดือนก่อน

    Yes. C# is my new goto. I just started learning C# and it looks similar to java but simpler. Thanks for your tutorials and guides.

    • @GavinLon
      @GavinLon  10 หลายเดือนก่อน

      You are very welcome. Java is a great language but as you say, C# is perhaps simpler to use. :)

    • @aliksargsyan2782
      @aliksargsyan2782 5 หลายเดือนก่อน

      Java is more robust actually)

  • @daniel-peiro
    @daniel-peiro ปีที่แล้ว +3

    Html is the

  • @flogginga_dead_horse4022
    @flogginga_dead_horse4022 ปีที่แล้ว

    Been programming for 25 years, could never stand Java. Still using C# or Rust now at this point.

    • @GavinLon
      @GavinLon  ปีที่แล้ว

      I'm looking forward to C# vs Rust at some point!

    • @kaihusravnajmiddinov5413
      @kaihusravnajmiddinov5413 7 หลายเดือนก่อน

      How's RUST?

    • @aliksargsyan2782
      @aliksargsyan2782 5 หลายเดือนก่อน

      Haha 😆 Rust. That's why Intel cpus chashes because of Ruat 😂

    • @flogginga_dead_horse4022
      @flogginga_dead_horse4022 5 หลายเดือนก่อน

      @@aliksargsyan2782 learn spelling first?

    • @aliksargsyan2782
      @aliksargsyan2782 5 หลายเดือนก่อน

      @@flogginga_dead_horse4022 crashed dude crashed.

  • @astrahcat1212
    @astrahcat1212 ปีที่แล้ว +1

    Well, I think it's more about, all these companies are still using Java systems, so if you're a very experienced programmer you can make a lot of money using Java. C# is kind of more modern and these days I believe blowing past Java due to Microsoft's support. Python is still the best language to learn today though I think.

    • @GavinLon
      @GavinLon  ปีที่แล้ว +2

      Yup I think once a company is committed to a technology (like Java) - it often doesn't make sense to move to a more modern technology because of the cost involved. I think having Microsoft support is a huge reason to develop green field applications using .NET and C#. Python is a great language but C# is better in my opinion, one of the main reasons being that C# is a statically typed language. I also think C# is a fairly easy language to learn.

    • @astrahcat1212
      @astrahcat1212 ปีที่แล้ว

      @@GavinLonI'm actually more of a C# programmer myself, but learning Python I do enjoy the quick compilation with it being interpreter based. The younger generation all seem to be learning Python though, and CS students and many companies, so I think it'll continue to expand and grow. C#'s syntax still makes perfect sense to me though.

    • @GavinLon
      @GavinLon  ปีที่แล้ว

      @@astrahcat1212 Python is a great language, and of course great for AI and data science applications. I prefer C# for many reasons but think Python is a great first language to learn primarily because of its simplicity. :)

  • @gurudaki
    @gurudaki ปีที่แล้ว

    C# all the way for the future in my opinion...!

    • @GavinLon
      @GavinLon  ปีที่แล้ว +1

      That is also my opinion :)

  • @ronaldjohnson4470
    @ronaldjohnson4470 ปีที่แล้ว +1

    My preference is C#.

    • @GavinLon
      @GavinLon  ปีที่แล้ว

      My preference is also C# and .NET :)

  • @ripple123
    @ripple123 ปีที่แล้ว +3

    java ecosystem >> C# ecosystem

    • @GavinLon
      @GavinLon  ปีที่แล้ว

      Sure the Java ecosystem is bigger but as time goes on that gap is likely to close. :)

    • @julianjupiter5890
      @julianjupiter5890 ปีที่แล้ว +2

      ⁠@@GavinLonand language features gap between Java and C# will also close.

    • @GavinLon
      @GavinLon  ปีที่แล้ว +1

      @@julianjupiter5890 Well that will certainly improve Java - perhaps I can do a more comprehensive deep dive into the comparisons between C# and Java at a later stage. Thanks for your comment - great to get the perspective of someone who is clearly pro Java! :)

    • @Turko77777
      @Turko77777 ปีที่แล้ว

      because it has to patch the shortcomings

  • @ievgenmajor3301
    @ievgenmajor3301 ปีที่แล้ว

    c# features looks like disadvantages

    • @GavinLon
      @GavinLon  ปีที่แล้ว

      Interesting - could you elaborate on that a bit? :)

    • @izagawd
      @izagawd 4 หลายเดือนก่อน

      Yeah please elaborate

  • @sanampakuwal
    @sanampakuwal ปีที่แล้ว +1

    C# definitely wins!

    • @GavinLon
      @GavinLon  ปีที่แล้ว +1

      I agree!!! :) Thank you!

  • @anm3037
    @anm3037 ปีที่แล้ว

    I still wonder how😂java programmer manage to work without extension methods

    • @GavinLon
      @GavinLon  ปีที่แล้ว

      Yes, I'm also used to luxuries like extension methods and auto implemented properties provided by C#. :)

  • @eugenschabenberger5772
    @eugenschabenberger5772 ปีที่แล้ว

    You forgot to mention the dumb checked exceptions in Java.

    • @GavinLon
      @GavinLon  ปีที่แล้ว

      In the end I actually had to leave a lot out because it would've made the video too long :)

  • @BackendWithJava
    @BackendWithJava 4 หลายเดือนก่อน +2

    Java is the best programming language! Even your C# is trying to be like Java 😂

    • @GavinLon
      @GavinLon  4 หลายเดือนก่อน +1

      lol - there are definitely similarities between the two languages but I think C# left Java behind a long time ago :)

    • @lufenmartofilia5804
      @lufenmartofilia5804 2 หลายเดือนก่อน

      They kinda copy each other over the years. Java take c# as a testing ground and only take features that they think make sense.
      C# is looking into copying java's virtual threads at the moment as it is a clean and very lightweight way to transform blocking code to none blocking one on a giant scale (1kb per vthreads vs 1mb for a thread). Allowing you to pop millions of them without running out of ram

  • @benderbg
    @benderbg ปีที่แล้ว +2

    C# and Java can be called OOP language siblings. After all C# was developed as a Java clone. Why not learn both and be a true back end guru! Now days, C# has a nicer syntax and feels more modern. Java on the other hand has bigger ecosystem not tide to only one company. There is a reason why big tech don't prefer C# because everything around it is opinionated. If you want maximum out of it you need to be in Windows/Azure world. I'd also like for Microsoft to port Visual Studio to Linux. Its not really cross platform language until it has full IDE support it deserves. MAUI is also not supported on Linux at all.

    • @GavinLon
      @GavinLon  ปีที่แล้ว

      Very interesting comment! I really enjoyed reading it! With every release of .NET there seems to be amazing progress, so I think with the heavy investment in C# and .NET by Microsoft - we'll see a lot of positive changes - perhaps that will address the issues that you have mentioned in your comment. Having said that , I do like a lot of the points you make here :)

    • @rankarat
      @rankarat ปีที่แล้ว

      C# runs on linux perfectly!

    • @GavinLon
      @GavinLon  ปีที่แล้ว

      @@rankarat Yes I believe you can run .NET MAUI apps on Linux - I haven't tried it yet myself but I think it can be done - techcommunity.microsoft.com/t5/educator-developer-blog/net-maui-on-linux-with-visual-studio-code/ba-p/3982195

  • @flogginga_dead_horse4022
    @flogginga_dead_horse4022 ปีที่แล้ว

    yes

  • @dotnetMasterCSharp
    @dotnetMasterCSharp ปีที่แล้ว

    I like working with languages ​​in the c family.
    Because it is closer to machine language.
    I haven't tried it with Java yet.
    The information in the video was very helpful for my understanding of Java.
    Thank you!

    • @GavinLon
      @GavinLon  ปีที่แล้ว

      Great! I do like the c-style syntax myself! Thank you for your comment and you are very welcome!

  • @eriknyk2k
    @eriknyk2k ปีที่แล้ว +1

    C# copied Java since it born

    • @GavinLon
      @GavinLon  ปีที่แล้ว +1

      C# is certainly not a Java clone and is much closer to C++ in its design. It of course does have a lot in common with Java. One has to bear in mind that both of these languages are both C based and support object oriented programming. Anders Hejlsberg (the designer of C# at Microsoft) said the goal (when creating C#) was to provide the power and expressiveness of C++ as well as the rapid application capabilities of Visual Basic. Certainly the JVM and the CLR are very similar when comparing .NET to the JRE - the C# language itself, however, has evolved and seems likely to continue to evolve far beyond Java.

    • @eriknyk2k
      @eriknyk2k ปีที่แล้ว

      @@GavinLon It isn’t anymore, but here’s a brief history:
      In the late 1990s, Sun Microsystems developed a language they called Java. At the time, most programs were written for a specific operating system. Some languages were “portable”, but the source code had to be recompiled for every new system.
      Java allowed a program to be written once, compiled and then run on any operating system. Nifty! In addition, small programs could be run inside a web page.
      Microsoft got on board and started supporting Java: they supported it in their browser and even released a version of their IDE for it.
      While doing this work, they came up with ways of improving Java just for Windows. This pissed off Sun, because that was the opposite of what Java was all about: the same program was supposed to run the same on all devices. It wasn’t supposed to be different for different operating systems.
      Microsoft got mad that Sun was being mean to them, and withdrew native support for Java in their browsers and killed their Java IDE. They decided to make their own competing language, which brought us C#.
      In the beginning, C# was similar to Java in many respects. Java compiled to “byte code”, which was then executed by something called the Java Virtual Machine (JVM). C# compiled to Microsoft Intermediate Language (MSIL), which was the same idea as byte code. It was then executed by the .NET Framework, which was an idea similar to the JVM.
      C# borrowed a number of ideas from Java, such as the lack of raw pointers, using . for dereferencing always instead of . sometimes and -> at other times, a construct that C++ used.
      But right from the start, there were differences. Anders Hejlsberg, the lead designer of C#, added something called properties, which were a big boon to C# programming, and still are. They also included enums, which Java lacked (Java has them now, but considers them full classes or some such weirdness).
      Now, almost 20 years later, C# has a number of features that Java can’t touch. I won’t cover them here, but C# is less of an imitation of Java now than it originally was. C# and Java continue to borrow from each other as each continues to try to one-up each other.
      They still share a number of similarities. Most C# programmers would have little trouble reading Java and vice-versa (though a Java programmer’s head might explode trying to read some LINQ statements).
      C# started out as an imitation of Java (or a competitor), but now stands on its own.

  • @carosan3719
    @carosan3719 ปีที่แล้ว +4

    Kotlin

    • @GavinLon
      @GavinLon  ปีที่แล้ว +1

      Okay challenge accepted - coming soon - Is C# better that Kotlin?

    • @RuanStrydom
      @RuanStrydom ปีที่แล้ว

      No challenge. Kotlin is a much safer language. It prefers immutability over mutability. Coroutines enforces structured concurrency and is generally just better designed. Sequences vs the random implementations of Ienumerable. The list goes on and on. .Net == infinite runtime errors. Oh and not to mention kotlin multiplatform and all it's targets, JS, wasm, native, JVM.

    • @GavinLon
      @GavinLon  ปีที่แล้ว

      @@RuanStrydom Thanks for your strong views - well I look forward to diving into this comparison further. I disagree about .NET = infinite runtime errors. In my experience .NET is very robust.

    • @RuanStrydom
      @RuanStrydom ปีที่แล้ว

      @@GavinLon I would argue Rust is robust. Type safe functional languages are robust. A mutable language with unbound concurrency I would not describe robust. I'm looking forward to the video, I hope you spend some time with it, it's a good language. Not great but good. PS I'm currently in a C# job.

    • @GavinLon
      @GavinLon  ปีที่แล้ว

      @@RuanStrydom Thanks so much for your interesting comments :) Its great to get a variety of perspectives. I'm looking forward to exploring Rust!

  • @priyanshu4016
    @priyanshu4016 ปีที่แล้ว +1

    java and only java , :D wins

    • @GavinLon
      @GavinLon  ปีที่แล้ว

      What!!!?????? lol - Just kidding - okay - one for the Java team!

  • @H4KnSL4K
    @H4KnSL4K 7 หลายเดือนก่อน

    It looks like everything in C# is capitalized. Boo! This goes against like every other programming language. It reminds me too much of power shell. Ick. Give me bash and Java any day

    • @GavinLon
      @GavinLon  7 หลายเดือนก่อน

      Great, thank you for your comment! :)

  • @TheBunzinator
    @TheBunzinator 2 หลายเดือนก่อน

    COBOL is better than Java, so yes.

    • @GavinLon
      @GavinLon  2 หลายเดือนก่อน

      We'll have to see about that! Sounds like a great topic for a video :)

    • @TheBunzinator
      @TheBunzinator 2 หลายเดือนก่อน

      @@GavinLon Lol. :D I dare you! But if you do, please don't use an example of COBOL code that includes all the mainframe build JCL that everyone seems to include when they disingenuously want to make it look insane and unreadable. I don't actually like COBOL at all, but it's great at what it was designed for.

    • @GavinLon
      @GavinLon  2 หลายเดือนก่อน

      @TheBunzinator lol - COBOL is such an old language - not sure it would be a very popular topic! If I do the video, however, I will definitely take your advice. Thanks! :)

  • @IgorLisx
    @IgorLisx ปีที่แล้ว +2

    I prefer to stay away from anything that originated from Microsoft.

  • @7th_CAV_Trooper
    @7th_CAV_Trooper 9 หลายเดือนก่อน +1

    yes. the answer is yes.

  • @izagawd
    @izagawd 4 หลายเดือนก่อน +2

    Yes