C++ vs C#

For a while now, I’ve been thinking whether , for me, as a C++ programmer, learning C# is worth investing time in. I admit I was kind of annoyed seeing people with little experience in programming saying that C# is the way to go, it is the latest release from Microsoft so it must be the greatest thing since sliced bread.

There are a lot of good posts on C++ vs. C# out there, so I won’t repeat any of the traditional pros and cons, these are just some of my thoughts on the matter.

I believe some hotshots at Microsoft took a good look at Java and thought “Hmmmm….this write once, run anywhere thingie seems intriguing…and why are so many people using it?… and we don’t like that Sun’s getting all this attention. Yeah, we definitely want a share of this! But…we didn’t really have that much of a success with J++, how can we rebrand it? Wait! Why don’t we create a new language that runs anywhere (as long as that anywhere supports a Win-based OS, of course) and market it as the language that incorporates the best features from all other major languages?”

Now, believe it or not, Microsoft has nailed a lot of good things with C#. It is easy to use, the learning curve is nowhere near as steep as C++’s and, there’s plenty of documentation for it. Unfortunately, I believe these are also its pitfalls. IMHO, while C#’s relative simplicity will – maybe – allow more people with great ideas, that might not have had the time to learn C++, to start programming, it will also encourage sloppy programming. Most (new) programmers will not bother about resource management (where and when the resources are allocated and when or where they are released) since the garbage collector does that transparently, but truth is this will have a great impact on performance.

So…back to my original problem, should a C++ programmer bother learning C# or not? Well, with the CLR included neatly into VS 2005 there’s no need to, but in the end it all comes down to the personal preference. I say, take a look at C#, you might end up liking it. Personally, I did program with it a little bit, but didn’t like it… I’m sticking with C++ for now 🙂

Tags: ,

2 comments

  1. He he! very cool post! Very *very* cool post! Funny point on the meaning of “anywhere” :))

  2. C# se merita in contextul in care vrei sa faci o aplicatie cu GUI si nu ai timp prea mult la dispozitie . Eu unul m-am jucat putin cu el dar apoi l-am aruncat intr-un colt . Pur si simplu nu-mi starneste deloc interesul. Un programator bun ar trebui sa stie C/C++ insa in ziua de azi nu mai gasesti asa ceva. Copiii nostri vor invata C# , vor invata acele “foreach in” ca pe instructiuni de baza, fara sa stie ce e aia container, ce e ala delegat , ce e aia alocare dinamica, ce e ala pointer … trist dar adevarat .

Leave a Reply

Your email address will not be published. Required fields are marked *