This debate rages on and on and really appears to have no end in sight. Everyone tackles this long winded discussion from a different angle and it even gets into verbal attacks between parties. Some quoting one source while another quoting another source when really people have lost the overall picture that programming is meant to solve… providing a solution to a problem. Some languages work better on certain problems than others. Does it mean one is inferior to the other in this classic showdown? No! I will hopefully clear the air a little on this and put to rest some discussions out there talking about this very thing. I don’t expect it to bring about world peace on the topic, but I hope it closes discussions before they go too far! All this and more on this entry of the Programmer’s Underground!
1) C# was developed by Microsoft targeting their .NET framework… because of this, it is automatically limited in scope. While the ECMA did approve it as a global standard, it has largely remained a .NET language… hence people saying it is proprietary (which it started out as until approved as a standard).
2) Mono is an open source project lead by Novell to make C# available to other platforms using ECMA standards. Once ECMA approved C# as a standard, they are now attempting to put it onto other platforms through this project and a couple others. Of course the project is still being developed so it isn’t finished by all means and probably will never be fully because of each release of the .NET framework. It will have a lag in development to catch up. What do you expect for open source?
3) Is C++ is faster than C#? Yes! No questions about it, C++ does not have the CLR and under the hood type checking and safety mechanisms which slow things down (but it is hardly noticeable).
4) Is C# much safer than C++? Yes! This is because C# was designed with safety in mind. It includes things like garbage collection and type safety. Plus they largely got rid of the use of pointers (unless you specifically mark the code as unsafe) which was a major source of memory leaks and bugs. This safety also is the center of several complaints that C# ties up the programmers hands. While there is some validity to their arguments, C# still lets you implement C++ aspects into the programming when you want, you just need to mark it as unsafe.
5) Will C++ get you farther in the game development industry than C#? Yes! Why? Because it has been around longer, it takes advantage of hardware, most drivers are written in C++ and a lot of game libraries and propriety company tools were written in C++ back in the day. Take it from someone who is in Digital North (Vancouver is a huge hub of game development for consoles like Xbox 360 and PS3 as well as animation… almost all their tools are in C++ and their tool developers continue to use C++).
6) Is C# a great beginner language? Yes! Why? Because of its type safety and other little enhancements which allow the beginner to make mistakes without a lot of crashing and letting bugs run a muck. This was another aspect of its development. They wanted it to be a bit easier to learn without all the cryptic syntax. I think they only partially succeeded on this. But for beginners who don’t know about memory handling that well, it is great to start with.
7) Is C++ also a great beginner language? Yes but in a different way! I personally recommend this language before C# because it will help you learn more of what is going on behind the scenes of C# and it also forces the learner to truly learn OOP without being tied to the CLR. So a C++ person can go and develop on other machines without needing something like Mono. If you find the right book, C++ can be great to learn and the ugly error messages it gives you will certainly make you think more about what you are doing. Is it better to learn first? Perhaps. Will it take you farther to learn it than C#? YES!
8) Can you truly say one is better than the other? NO! They were designed in different eras, with different purposes, and have their different strengths. C# is not going to ultimately replace C++ but C# is not going to ultimately go away.
9) Are you going to find someone that doesn’t have a preference between the two? Hardly unlikely. Those who grew up with C++ tend to see C# as a bit simplistic and those who will grow up with C# will C++ a bit outdated and cryptic. Now this is a generalization and not everyone will fit in these categories, but a large majority will. Especially if they are of different backgrounds. .NET developers love C#. Networkers and *nix enthusiasts tend to love C++.
10) What would be the most beneficial to a learning programmer? Learn them BOTH! If you want to expand your marketability in the industry, you will have to at least know C++ and a lot of the upstarts love those with C#. Learn them both and get the maximum out of it all.
11) Do I know them both? Yes! I have enjoyed knowing them both and I wouldn’t trade it for the world. I have gotten jobs where C++ has helped me learn a new language and I love C# for hacking out great stuff on .NET.
12) Do I think the debate between C++ and C# has been beaten to death? Yes! It is like comparing the flavor of strawberries to the flavor of raspberries. Both share the idea of berries, people prefer one or the other, sure strawberry flavoring makes it into a lot more food products out there, but it doesn’t mean the raspberry flavor sucks. Maybe another analogy is the beer tasting great versus less filling debacle.
13) Any other advice you can give the beginner? Yes! Understand that this is a long discussed debate, ever since C# came out. Everyone has an opinion based on personal experience. Is there a clear winner? No… it all is relative on what you are trying to accomplish. Use whatever is the best for the job. Understand the people behind the development of the languages and what their intentions for it are. Understand where it can be used in the market and learn whatever fits your career and hobbyist goals. In the end knowing them both is the ultimate solution. If you master both, is it really worth debating? No… as long as you can apply the best solution to a problem in the end, the rest is futile.
So for those out there that are raging on about this? Lets get back to making kick ass stuff shall we?