Which to learn C++ or C#

42d3c31a652e46f8fa9b40e822b58cc7
0
shadow651 101 Jan 03, 2009 at 17:08

I’d say there has been plently of threads on this but I’d rather make a new one the revive dead threads.

I was wondering if it would be better to learn C++ to C#, I already know C++ is better its just i dont want to learn it to find out i’ve just learnt a dead language then find C# take over as the industry standard, so need helps guys any input you got

14 Replies

Please log in or register to post a reply.

A8433b04cb41dd57113740b779f61acb
0
Reedbeta 167 Jan 03, 2009 at 17:51

C++ has lots of life left in it. It won’t be dead anytime soon. Plus, if you ever do need to learn C#, a good deal of your C++ knowledge will translate over, so it’s not as if that investment will have been for nothing.

B91eae75cd6245bd8074bd0c3f1cc495
0
Nils_Pipenbrinck 101 Jan 03, 2009 at 18:00

C++ is still alive and kicking. Even good old C still is used in the industry for a reason. However C# developer demand is rising and far outnumbers C and C++. Chances are you have less problems getting a job if you know C#.

If I were you I’d ask myself what I want to later, because the fields in informatics to some extent dictate the language. Here is a *rough* breakdown..

C#: Mostly windows applications. Some XBox and PC game-dev as well.

C++. Jack of all trades language. You’ll find applications, system and embedded programming, scientific stuff. De-facto standard for game-dev.

C: Language of choice for embedded and DSP stuff. If you want to go into automotive, avionic or medical world this is the language of choice.

But keep in mind, that the language you use is just a language to express your software-designs. It’s much more important to learn and train your problem solving skills. These btw are language-agnostic. Knowing how to approach a problem is what makes up a good prgrammer, not knowing your language of choice inside out.

This skill can’t be tought. You need years of practice to develop it.

Btw - The industry expects that you’re able to pick up a new language fast.

If a project needs for example C and Java skills, and you’re familiar with C only you get a month at most to get into Java well enough to be productive. (this does of course not include in-depth knowledge of the libraries, but in practice you need only a small part per project anyway).

6837d514b487de395be51432d9cdd078
0
TheNut 179 Jan 03, 2009 at 23:21

I know both rather well, but started with C++ first since C# didn’t exist back then ;) I can tell you that if you know C++, C# will be very easy to pick up. The opposite is not so true though. C++ is a lot more involving and a little more difficult to grasp for some. On the other hand, in my opinion it has the potential to make you a better developer. It’s not a “hold your hand” type language, so you’ll really need to work hard to write efficient and well designed code. But that experience will live on with you. .NET is such a dumbified architecture that it really promotes you not to learn anything and be a lazy developer. Window UIs, message events and other handlers are easily provided, garbage collection, reflection, a plethora of libraries that already done everything for you, etc… Not that this is bad, especially if you understand it, but going into the world of C++ after you’ve been exposed to C# will be very difficult.

If you’re serious about getting into the game industry, learn C++ and DirectX. Learning OpenGL is nice too, but no where near as popular as DX. Learning C# after that will be a breeze. You’ll probably need to spend a week to a month learning and getting use to the syntax. After that, it’s all downhill riding.

If you’re interested in getting into the software industry (ie: everything else), then C# will be more attractive on your resume. Java is another popular one, especially if you’re into writing server-side code. There’s only a handful of companies that even care about C++ developers where I live and their job offers are quite pitiful.

8676d29610e6c98d6dd2d9c38528cd9c
0
alphadog 101 Jan 04, 2009 at 02:27

C++ is not going to die anytime soon. Heck, Cobol is still kicking around in some industries. Don’t feel bad to continue in that language, especially if you are into game dev.

OTOH, a quality developer knows 2-3 languages to an average degree for every one he is above average in. If you know just C++, it’s like a woodworker with just a hammer…

Fbcc06928f1ef03dba9f0e52ee87c8bb
0
malignant 101 Jan 06, 2009 at 15:29

C++ and Java seem to be the educational starting points these days. Any .Net language is going to be just about the same thing with differing syntaxes. As mentioned by TheNut, moving into c# from c++ is a breeze, but the .Net framework (which is the sole foundation for c# support) adds a lot of precompiled libraries and extensions which takes away a lot of the manual labor involved in coding. While in c#, you CAN manage things like garbage collection, you don’t actually NEED to. When it comes down to c++ though, you’re in charge of pretty much everything you want your code to do. It won’t fill in the gaps for you, and it takes more time to learn.
I’d say, do your self a favor, and start with the harder of the two first, c++. My first exposure to code was VB .Net v1.1… and these were the dark days of .Net to begin with. Regardless of the evils of 1.1, which is thankfully behind us, this was a poor place to start. VB is syntactically different from… everything. The transition to c# has been, frankly, an actively reproducing female k9… nevermind how difficult it’s been trying to pick up on and really grasp c++.
Now it’s all about familiarizing myself with books like code complete and the pragmatic programmer. Programming theory, over syntax specific language studies.
\~malignant

8676d29610e6c98d6dd2d9c38528cd9c
0
alphadog 101 Jan 06, 2009 at 17:03

C# is actually getting more complicated to master. It’s not C++, but it’s not what it used to be. If you start looking into LINQ, and all of the new bits in 3.5…

I’ll go against the grain and say that if you pick C# (or Python before that) as your first language, you’ll be better able to focus on learning the art of programming versus the joys of syntactic masturbation. C++’s breadth and versatility is usually a boon to all but newbies who get overwhelmed…

713d1351d81f71d26ec283eac15955d5
0
Celestin 101 Jan 07, 2009 at 23:58

Why learn only one or the other? Personally, I find myself using all 3 flavours, switching between them depending on what I’m working on. Sometimes it’s simplest to just write a bit of code in plain old C, sometimes the bulk is written in C++ but I write a C# front end. And really, if you’re truly interested in getting into development, the question should ALWAYS be ‘which do I learn first?’, not simply ‘which do I learn?’.

6aa952514ff4e5439df1e9e6d337b864
0
roel 101 Jan 08, 2009 at 09:18

How can one answer this question if one doesn’t know what shadow651 wants to do with the language?

8676d29610e6c98d6dd2d9c38528cd9c
0
alphadog 101 Jan 08, 2009 at 12:53

By speaking in generalities? And, by assuming that, given the context of the forum, some lean towards game dev is in play too?

At least, that’s how I saw it…

46407cc1bdfbd2db4f6e8876d74f990a
0
Kenneth_Gorking 101 Jan 08, 2009 at 15:18

There is also the middle-road: C++/CLI

You get the speed of C++, and the UI tools from .NET

6aa952514ff4e5439df1e9e6d337b864
0
roel 101 Jan 09, 2009 at 17:14

@Kenneth Gorking

… You get the speed of C++ …

I don’t believe that at all. And then I don’t mean that C++/CLI should be slow because it is run JIT, but I don’t believe that C++/CLI is faster than C#. I welcome any references to prove me wrong. I also recommend against learning C++/CLI unless you have to port existing C++ code to .NET.

17ba6d8b7ba3b6d82970a7bbba71a6de
0
vrnunes 102 Jan 09, 2009 at 17:50

@Nils Pipenbrinck

But keep in mind, that the language you use is just a language to express your software-designs. It’s much more important to learn and train your problem solving skills. These btw are language-agnostic. Knowing how to approach a problem is what makes up a good prgrammer, not knowing your language of choice inside out.

I agree with the above statement. Although it is nice to know a language inside out, that is not the most important aspect of programming.

A good programmer does not count on any specific language.

Just as a side note, after 10 years of C++, and having to recently learn C# for my daily work (where I program wireless systems), I’m quite satisfied, because it is relatively fast, stable and comfortable to code for.

EDIT: C# is comfortable for games programming as well.

8676d29610e6c98d6dd2d9c38528cd9c
0
alphadog 101 Jan 09, 2009 at 19:17

@roel

I don’t believe that at all. And then I don’t mean that C++/CLI should be slow because it is run JIT, but I don’t believe that C++/CLI is faster than C#. I welcome any references to prove me wrong. I also recommend against learning C++/CLI unless you have to port existing C++ code to .NET.

C++/CLI is theoretically but negligibly faster. They both get compiled down to the same JIT code running on the same VM, after all. As for C++ (non-CLI) vs. C#, it’s “speed advantages” are realized only in specific cases, involving benefits like the benefits of virtual method calls, which can lead to better inlining. Not sure how many special cases there are, or how often they are found within the general field of game development.

In practice, the best optimizer is the programmer, the second best is the compiler, last is the language itself. But, that’s just preaching to the choir, I’m sure.

I would also agree with avoiding C++/CLI in game development. In fact, even if you don’t want to do it now, it’s probably good practice to know and implement the easier practices in cross-platform development in compliant C++.

46407cc1bdfbd2db4f6e8876d74f990a
0
Kenneth_Gorking 101 Jan 11, 2009 at 16:13

@roel

I don’t believe that at all. And then I don’t mean that C++/CLI should be slow because it is run JIT, but I don’t believe that C++/CLI is faster than C#. I welcome any references to prove me wrong. I also recommend against learning C++/CLI unless you have to port existing C++ code to .NET.

You can control wheter the code should be compiled as native or msil. The compiler tries to guess it, but it can be forced.

I guess I should clarify my statement. I didn’t mean people should code their performance critical stuff in C++/CLI, but rather use it for tools development. I will be much easier to piece an editor together using .Net tools, than dicking around with MFC or even the horrible Win32 API.

It also has the added advantage, that you can use already existing libraries off the bat.