Is C# Better than Java?

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Applause] hi and welcome I'm Gavin l so is C better than Java this is indeed a tough one in the right corner we have the new upand cominging Contender C in the left corner we have the defending Champion Jaa and C delivers the final blow and wins by knockout okay okay okay yes so I have a bias towards C and do Java is an amazing technology so is C and net so in this video I attempt to make a somewhat objective comparison between C and Java right let's look at an overview of java Java is a programming language and is also a computer platform Java was originally developed and designed by James goling a Canadian computer scientist it was first released in 1995 by on Microsystems Java has consistently been rated as in the top five most popular programming languages in the world by reputable sources it is an object-oriented programming language and its principles and syntax is based on the C and C++ programming languages the Java platform is a collection of technologies that contain an execution engine a compiler and a collection of libraries a key feature of java is based on the right once Run Anywhere philosophy the fact that a single code base written in Java can be used to run on a multitude of different types of devices is a huge competitive advantage over other programming languages this was especially true when it was first released in 1995 the Java platform runs on billions of devices and environments worldwide including mobile devices desktop computers laptop computers the Internet game consoles medical devices scientific supercomputers in data centers and many others Java is known for being fast dependable and secure it is a collection of software and specifications Java is a highlevel programming language that runs within its own environment known as the JRE Java runtime environment a core part of the JRE is the jvm or Java virtual machine this is basically how Java Works Java is first compiled into bite code Java bite code can only run within the JRE the jvm interprets the bite code in order to run it on the underlying Hardware so for example if a Java application is running on a Windows platform the jvm interprets the bite code so that the code is appropriately executed on a Windows platform if the underlying operating system is for example Linux the jvm will interpret the bite code so that it can be appropriately executed on the relevant Linux platform so let's look at an overview of c c was developed by Anders hburg and his team at Microsoft it was first released in 2001 I've heard Anders hburg say in an interview that the goal When developing C was to provide the power and expressiveness of C++ while also providing the rapid application capabilities inherent in Visual Basic it is a high level programming language that runs in an environment known ASN net C is also consistently rated by reputable sources as one of the top five most popular programming languages with the first release of net C applications initially only ran on Windows Platforms in 2016 net core allowed for C application ations to be crossplatform where one code base could be used to run on multiple platforms for example Windows Mac OS as well as Linux platforms the zamarin framework meant you could create cross-platform mobile applications where one codebase could be used to run C applications on both Android and iOS devices please note that the zamarin framework has now evolved into the net Maui framework the release of net core was a huge step in the evolution of net however it also meant that there were now two strands of net the first release of net known as The NET Framework which could only run on Windows devices and net core which enabled net to be crossplatform in 2020 Net 5 was released which unified these two main strands ofet so from this point onnet is a unified cross-platform software Tech technology that can now compete with the likes of java as a crossplatform solution so how does c and.net basically work C is typically jit compiled just in time compiled note that you can also aot ahead of time compile your C code where you can distribute your C applications as one executable but typically C code is just in time compiled so how does just in time compilation work so the higher level net language for example C visual basic.net or F is first compiled into common Intermediate Language code this common Intermediate Language code lives inside net assemblies these are the fundamental building blocks of net applications the assemblies are saved to the Target computer's relevant storage facility when for example a c method is called at runtime from within a particular assembly the jit compiler service that is provided provided by the common language runtime or Corr in net first checks to see if the code for the relevant method is compiled into machine language code remember the I code cannot be understood directly by the CPU if the method has not yet been compiled into machine language code the jit service compiles the relevant Cil code into machine language code the relevant machine language code can now be understood by the CPU of the target computer which could for example be a machine running Windows Mac OS or Linux so a single code base written in C can be used to run on multiple devices and platforms right once run anywhere so let's look at the similarities between these two popular software Technologies then after this we'll look at the differences between the two we'll then decide which of these languages wins the battle some programming languages like C and C++ can run close to the metal what does close to the metal mean it means that code created in these languages can run directly on the operating system both C and Java run on top of an additional layer that in turn runs on top of the operating system C runs on net and Java runs on the JRE Java runtime environment both the net environment and the Java runtime environment provides services that abstract away common repetitive tasks like handling security exception handling memory management and garbage collection this provides a massive Advantage for the programmer that is now able to concentrate on the business rules of the relevant application and not have to worry about writing code for these repetitive tasks that are now abstracted Away by the relevant runtime environment net contains the CLR common language runtime that automatically provides services like interpreting and compiling the code memory management garbage collection security and exception handling in both C and Java the code is not directly compiled into machine language code but in both languages the original code is compiled into a predefined format in C andn Net the C code is first compiled into common Intermediate Language code in Java the code is first compiled into Java bite code the Syntax for both languages is based on C and C++ C and Java are both statically typed program languages statically typed languages have an advantage over dynamically typed languages like for example JavaScript or python when a programming language is statically typed type related errors can be flagged and fixed at compile time which means better robustness at runtime statically typed languages typically perform better at runtime over dynamically typed programming languages because they don't have the overhead of interpreting the type of variables based on the values assigned to them C and Java are both object-oriented programming languages where the principles of encapsulation inheritance polymorphism and abstraction can be applied to create clean extensible and easy to maintain code solid principles can be implemented for architecting applications so that for example each class has a single responsibility code is easily reused and the design of the application's constituents are extensible both languages typically use semi interpreted or runtime just in time compilation the concepts of value types and reference types exist in both languages value types like integer float and Boolean are stored in a more structured way on the stack in memory and reference types like strings and user defined types are stored in a more halfhazard way on the Heap wow so these two languages are very similar in many respects so let's look at some of the main differences between C and jav then we'll be in a good position to decide which one of these great languages wins one of the most significant differences between C and Java is that c allows you to use pointers in code if you are familiar with C or C++ you'll no doubt know about pointers Java does not allow you to use pointers pointers allows the programmer to write code that directly accesses memory this is both a pro and a con by using pointers you are circumventing the safety provided through managed code so you may gain a performance Advantage by appropriately using pointers in your code but at the same time you are also potentially compromising runtime robustness you are deciding to incorporate your own memory management functionality into your code rather than allow net to do this for you this can be a risk but also may result in a performance gain generics C C handles generics differently than in Java in C for example the Java array list type can be strongly typed but you can't use primitive types for this purpose for example INT in Java you have to use the boxed integer in order to strongly type the array list of course an array list type in C does not use generics at all but the list type must be strongly typed using generics and unlike with Java's array list you are able to strongly type the list type with Primitives like int another C feature that Java lacks is operator overloading Link in C is an excellent feature that can be used for performing for example filtering grouping and aggregation operations against collections of objects Java added streams to the collections library in Java 8 but this functionality is not as flexible as link another feature that c has and Java does not not have are extension methods these are static methods that you can call as though they are part of a class or struct they allow you to provide extra functionality without the need for the relevant assembly to be recompiled an extension method is a static method that is called on a class instance C allows you to split a class struct or interface over several files these are called partial classes partial classes make it easy for several developers to work work on the same class where each developer can add functionality to the same class by adding code to separate files so this functionality allows developers to collaborate on the same class but at the same time work independently from one another Java doesn't Provide support for conditional compilation C provides support for conditional compilation through pre-processor directives C supports a value type known as a struct this is similar to a class but the the advantage of a struct over a class is that it is far more memory efficient than a Class A struct is a value type and a class is a reference type at present there is no equivalent to a struct in Java Java has a huge array of third-party libraries and has extensive documentation cop also has a lot of thirdparty packages and libraries available that are growing day by day Microsoft learn is an excellent platform that Microsoft provides that c developers and aspiring cop developers can use free of charge to better their comprehension of cop and net according to reputable sources at present there are millions more Java developers than C developers in the world but other reputable sources claim that this Gap is rapidly closing C is generally much faster than Java so those are a few similarities and differences between two very popular programming languages so which of these Technologies wins what well as always this is not as simple as just as to which of these Technologies to choose for developing an application depends on many factors like for example personal context and the type of application you wish to develop and of course also the pre-existing skills you may have in your company so some advantages of using Java are as follows there is detailed documentation available there is a huge array of third-party Java libraries there is a huge number of java developers in the world currently many millions more than C developers but that Gap is closing as C becomes more and more popular a huge community of Java developers exist that can provide you with support Java has been around a long time and is a mature language and platform you can write once and run anywhere Java is crossplatform and runs on billions of different types of devices and in different types of environments around the world some advantages for using C are as follows C is heavily backed by Microsoft corporation which is of course the largest software company in the world it is steadily growing in popularity and therefore the number of skilled developers in C is significantly growing Microsoft learn and the community provide great learning material and tutorials in CP and.net CP and.net enables your applications to provide great performance C provides some low-level features that Java does not provide like using pointers other notable features included in C like structs a better implementation of generics the flexibility provided in the Link Technology are not currently included in Java C is also crossplatform so like with Java you can write once and run anywhere of course if you need to create an application that integrates extremely well with Microsoft Technologies clearly. net and C should be your choice these are both two excellent software Technologies and it really does come down to personal context as to which of these Technologies you choose if you are a company that wants to create an Enterprise Greenfield application the first question should always be what existing skills do I already have in my company if your prevailing skill set is Java then Java is the clear choice however if your prevailing skill set at C and.net then C and.net is The Logical choice if you want to develop an Enterprise fullstack web application note that with C and.net you can use one technology for both front-end and backend development this is because you can now use the Blazer framework to develop the front end for your applications which can be written in C so with C andn Net you can leverage the benefit of using one technology for the entire full stack application from the research that I've done in general it seems like Java developers get paid slightly more than C developers but other evidence tells me that this may change in the not too distant future note that skilled C developers still generally get paid very well if salary is your criteria my advice is to research salaries in and around your area the area in which you live for C and Java developers you may just prefer the look and feel of one technology over the other I hope you have enjoyed this video so please let me know in the comments section which of these languages wins Java or C I've worked with both of these Technologies and my preference is definitely C and.net I hope I haven't triggered you Java developers too much in this video please prove me wrong in the comment section I'm ready for you if you like this video please hit the like button and please consider subscribing please also ring the bell so that you'll be notified of future content please feel free to share this video with anyone you feel May benefit from its content if you'd like to thank me by buying me a coffee you can do this through my buy me a coffee web page at this URL it will of course be greatly appreciated I love reading your comments so please feel free to engage with me in the comments section I've recently joined X formally Twitter so it would be great if you followed me on X my username is @gavin lond digital I hope to see you soon thank you and take care
Info
Channel: Gavin Lon
Views: 13,015
Rating: undefined out of 5
Keywords:
Id: E-tSUHEOf-U
Channel Id: undefined
Length: 18min 41sec (1121 seconds)
Published: Wed Nov 29 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.