Skip to main content
GameDev.net gamedev.net
🔒 Locked

C-C#-C++ or C#-C-C++

Started by MrGuild Nov 24, 2011 at 7:02 PM 29 replies 7.2k views
Original Post
MrGuild
MrGuild
I recently came apon the site http://thenewboston.org/tutorials.php I had decided since C++ would be a bad place to start that I would learn the older sides/ simple sides (as I hear) of programming. I will then eventually move onto Game development with this but I want to ofc learn the language first. Bucky has 15 C tutorials and 200 C# tutorials, I was wondering if I should learn C to help me with C# to then help me with C++ or to learn the C# then C to help me learn C++?
SiCrane
SiCrane
You don't need to learn C to learn C# or C++. If you want to start with C#, just learn C# and don't worry about the others.
MirageUY
MirageUY

I recently came apon the site http://thenewboston.org/tutorials.php I had decided since C++ would be a bad place to start that I would learn the older sides/ simple sides (as I hear) of programming. I will then eventually move onto Game development with this but I want to ofc learn the language first. Bucky has 15 C tutorials and 200 C# tutorials, I was wondering if I should learn C to help me with C# to then help me with C++ or to learn the C# then C to help me learn C++?


I think you have to larn C# then C++, C# is easier than c++. And is recommended to start in the faq
Serapth
Serapth

[quote name='MrGuild' timestamp='1322161379' post='4887348']
I recently came apon the site http://thenewboston.org/tutorials.php I had decided since C++ would be a bad place to start that I would learn the older sides/ simple sides (as I hear) of programming. I will then eventually move onto Game development with this but I want to ofc learn the language first. Bucky has 15 C tutorials and 200 C# tutorials, I was wondering if I should learn C to help me with C# to then help me with C++ or to learn the C# then C to help me learn C++?


I think you have to larn C# then C++, C# is easier than c++. And is recommended to start in the faq
[/quote]

There is only one real downside to starting with C#.


After using C#, especially with the .NET framework libraries, C++ seems absolutely archaic by comparison. So much less cruft and so much more developer friendly libraries, It is extremely difficult to go back.
DarkRadeon
DarkRadeon
Avoid C, it a useless language now. Start with C# (if you wanna take an easier approach) or C++.
NightCreature83
NightCreature83

[quote name='MirageUY' timestamp='1322165047' post='4887372']
[quote name='MrGuild' timestamp='1322161379' post='4887348']
I recently came apon the site http://thenewboston.org/tutorials.php I had decided since C++ would be a bad place to start that I would learn the older sides/ simple sides (as I hear) of programming. I will then eventually move onto Game development with this but I want to ofc learn the language first. Bucky has 15 C tutorials and 200 C# tutorials, I was wondering if I should learn C to help me with C# to then help me with C++ or to learn the C# then C to help me learn C++?


I think you have to larn C# then C++, C# is easier than c++. And is recommended to start in the faq
[/quote]

There is only one real downside to starting with C#.


After using C#, especially with the .NET framework libraries, C++ seems absolutely archaic by comparison. So much less cruft and so much more developer friendly libraries, It is extremely difficult to go back.
[/quote]

Do you really find it hard to switch between the two, I don't mind working in either as I do that on a regular basis anyway. The only thing I miss when switching back to C++ is the lack of feeling you are getting stuff done as you have to do more in C++.



Avoid C, it a useless language now. Start with C# (if you wanna take an easier approach) or C++.


C isn't useless even now there just are things that are solved in a easier manner in a non OO language, I think you should know non OO languages as well as a programmer. Utility functions shouldn't have to be static public functions on a class in the project, just general subroutines are far nicer to read.

21st Century Moose
21st Century Moose
I disagree with the "avoid C" advice, but I'd definitely say that you shouldn't learn it yet (and maybe get a scripting language under your belt first as well).

The reason why is because C has been - for a hell of a long time - the lingua franca of computing. There is an awful lot of C code out there, and you're inevitably going to come across it sooner or later. While you're learning you should certainly focus on the job of learning, but once you start getting some experience and flexing your muscles, you'll start finding more and more examples, source code, etc in C. And you'll eventually find something that you need, something that you must use, but that's been written in C, and when that time comes you're going to need to understand what it is you're looking at.

A second reason is that C uses a completely different programming paradigm to other more popularly recommended languages. You won't find objects here, you won't find classes. If all you ever learn is OOP then you're restricting your experience and restricting your exposure to programming, and that's going to leave you as a less well-rounded programmer. Believe it or not, there are some classes of problem for which OOP is actually an inappropriate solution, so knowing that you have the non-OOP option available and having a reasonable degree of comfort with using it will stand to your good. You could say "use the C-like subset of C++ then" and that would be perfectly reasonable - once you know what you're doing. The risk on the other hand is that you may find yourself drifting into familar patterns. C will prevent that.

Finally, C will force you to get a closer exposure to the guts of how your computer works. You'll learn all sorts of fun things about pointers and recursion, which will help you understand what's going on behind the scenes with higher abstractions better (and may even save you when the abstraction leaks), and will in turn make you an overall better programmer. In some ways that's kinda like OpenGL vs D3D (and wait till you come to that if you really want to see some real fun!) - if oyu only ever learn one of them you may get quite good at that one, but it's not until you learn both that you really get a deeper level of understanding.

Having said all that, I personally wouldn't touch C for a new project with a bargepole these days. If I wanted to code in that style, I'd use - like I said - the C-like subset of C++, and get the ability to dip into OOP where it suited the problem domain. C is however still useful to know if you're ever working on an older project that has a large legacy code-base (in C, natch).
Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls. 
Serapth
Serapth

Do you really find it hard to switch between the two, I don't mind working in either as I do that on a regular basis anyway. The only thing I miss when switching back to C++ is the lack of feeling you are getting stuff done as you have to do more in C++.


Syntactically, no.

In every other capacity, yes.


It actually feels like a massive jump backwards in time. Things I can accomplish in a few lines of C# fill me with absolute dread in C++. I either spend as much time hunting down or rolling my own libraries to do things that are just included in the base framework. From string manipulation, to networking, GUIs, database connections, etc... the C# way just feels intuitive and works out of the box. That and the language itself feels "cleaner". It is getting worse, where you have cruft from prior versions, like non-generic versions of ArrayList for example, but compared to C++, where templating is basically it's own turing complete language the transition is much less jarring. Then you have things like delegetes, which are so much cleaner than function pointers, and LINQ ( anonymous types + lambdas ) which once you use, is simply a thing of beauty.


A lot of it does depend on the type of coding you are doing though. Coding a game in C# vs a game in C++, using an existing library or engine, really ins't all that different. But writing that engine itself, or worse yet, tools to support it, C# is manyfold more productive for me.
MrGuild
MrGuild
Well I don't know C++ but I have this code i've been woring on and all it does is opens a window and you can choose to leave it or u can shoot your gun ( this is code I found online because people keep telling me I will learn when I look at the code ) so I did and Im still lost. I don't know where to start ... Im so lost right now and I want to get started ASAP on learning something instead of sitting hear getting ready to make the wrong choice.
SiCrane
SiCrane
Spending too much time worrying about making a wrong choice and being afraid to try things because of it is itself a wrong choice. Pick something and stick with it for a while. Whatever you choose it'll help you somewhat in the future. Knowledge isn't wasted no matter what language you choose.
ligh
ligh
A funny thing one of my professors used to say all the time on how to say C#, "Its pronounced JAVA"
Oberon_Command
Oberon_Command

A funny thing one of my professors used to say all the time on how to say C#, "Its pronounced JAVA"


That might have been the case when C# was first released, but it sure isn't the case anymore. Try comparing actual idiomatic code in Java and C# and you'll see a world of difference there.
sharpe
sharpe
Im so lost right now and I want to get started ASAP on learning something instead of sitting hear getting ready to make the wrong choice.

Why are you lost? Every single person in this thread who answered your question told you to start learning C# instead of C or C++. The FAQ recommends C# (or Python). These threads are very common and there are several on the front page of this forum. C# seems to be the most commonly-recommended language here, and that goes along, once again, with the FAQ. There is no ambiguity about it.

Here, let me help you:

[size="7"][color="#FF0000"]---> START LEARNING C#!!! <---
A 30-year-old interested in learning to program by making an old-school, simple, text-only or 2D dungeon fantasy video game.

As of 9/28/2011, currently attempting to learn the basics of Python 2.7. As of 10/14/11, Dabbling in C#. As of 10/24/11, decisively surpassed my small knowledge of Python in C#.
Hodgman
Hodgman
A lot of it does depend on the type of coding you are doing though. ... writing that engine itself, or worse yet, tools to support it, C# is manyfold more productive for me.

Things I can accomplish in a few lines of C# fill me with absolute dread in C++.
I agree regarding tools -- C# is definitely a much more productive language, but regarding engine development, things I can accomplish in a few lines of C/C++ fill me with absolute dread in C#!!! Engine dev is all about raw memory/byte manipulation, which is almost impossible in C# without jumping through endless hoops sad.gif
21st Century Moose
21st Century Moose

Engine dev is all about raw memory/byte manipulation, which is almost impossible in C# without jumping through endless hoops sad.gif


Definitely true this one; on the other hand it is safe. That can't be underestimated for a beginner. Even someone with 20-odd years of experience in (say) C will still find themselves scribbling all over random memory and (if they're lucky) going down in flames (if they're really lucky it will actually crash at the line that caused the error, thereby enabling them to fix it; more often it stays running for a short while and crashes somewhere completely unrelated). OP: this happens all the time in C, and - OOP vs procedural be damned - this is the one key reason why you should not pick C as a first language. You'll be spending more time chasing after stuff like this than you will be spending doing actual productive work.
Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls. 
Serapth
Serapth

[quote name='Serapth' timestamp='1322179864' post='4887453']A lot of it does depend on the type of coding you are doing though. ... writing that engine itself, or worse yet, tools to support it, C# is manyfold more productive for me.

Things I can accomplish in a few lines of C# fill me with absolute dread in C++.
I agree regarding tools -- C# is definitely a much more productive language, but regarding engine development, things I can accomplish in a few lines of C/C++ fill me with absolute dread in C#!!! Engine dev is all about raw memory/byte manipulation, which is almost impossible in C# without jumping through endless hoops sad.gif
[/quote]

Fair enough, and those bits you pay the piper and create in C++. Frankly most people aren't, or shouldn't be, developing engines, especially not beginners.

These days, C++ is basically what assembly was when I got started. In most cases, you would see greater productivity in the higher level languages, but the performance essential or low level code was easier to express in Assembly. Those layers of abstraction that make C# more productive make it harder to get low level, and for the vast majority of people in the vast majority of cases, this is a good thing.pInvoke however, has very little overhead, so you can mix and match.

C++ certainly has its strengths and obviously still exists in popular use for good reasons, but the majority of people the majority of time will be better served using a higher level language. Hell I struggle with if I should be using a higher level language than C# for exactly the same reasons.

The one thing that turns this all on end is mobile development.
Cornstalks
Cornstalks

There is only one real downside to starting with C#.

After using C#, especially with the .NET framework libraries, C++ seems absolutely archaic by comparison. So much less cruft and so much more developer friendly libraries, It is extremely difficult to go back.


And that's a bad thing?
DarkRadeon
DarkRadeon

[quote name='Serapth' timestamp='1322170167' post='4887404']
[quote name='MirageUY' timestamp='1322165047' post='4887372']
[quote name='MrGuild' timestamp='1322161379' post='4887348']
I recently came apon the site http://thenewboston.org/tutorials.php I had decided since C++ would be a bad place to start that I would learn the older sides/ simple sides (as I hear) of programming. I will then eventually move onto Game development with this but I want to ofc learn the language first. Bucky has 15 C tutorials and 200 C# tutorials, I was wondering if I should learn C to help me with C# to then help me with C++ or to learn the C# then C to help me learn C++?


I think you have to larn C# then C++, C# is easier than c++. And is recommended to start in the faq
[/quote]

There is only one real downside to starting with C#.


After using C#, especially with the .NET framework libraries, C++ seems absolutely archaic by comparison. So much less cruft and so much more developer friendly libraries, It is extremely difficult to go back.
[/quote]

Do you really find it hard to switch between the two, I don't mind working in either as I do that on a regular basis anyway. The only thing I miss when switching back to C++ is the lack of feeling you are getting stuff done as you have to do more in C++.



Avoid C, it a useless language now. Start with C# (if you wanna take an easier approach) or C++.


C isn't useless even now there just are things that are solved in a easier manner in a non OO language, I think you should know non OO languages as well as a programmer. Utility functions shouldn't have to be static public functions on a class in the project, just general subroutines are far nicer to read.

[/quote]
You can even use C++ and a C++ compiler and do procedural programming or using generics. You will probably get better errors and warnings from the compiler and a greater and better choice of libraries. I mean, this is the motivation that C++ is still backward compatible with C (and personally I hope this situation will end sooner as possible, C++ must be totally independent from C, there are now in fact two completely different languages, and this backward compatibility is counter-productive for both)


[quote name='Serapth' timestamp='1322170167' post='4887404']
There is only one real downside to starting with C#.

After using C#, especially with the .NET framework libraries, C++ seems absolutely archaic by comparison. So much less cruft and so much more developer friendly libraries, It is extremely difficult to go back.


And that's a bad thing?
[/quote]


Nope. Modern C++ has still a lot to say, specially with the last version (C++11), C++ still has a bigger support then C#, and in some cases C++ is preferable as language then C# for speed, absence of virtual machine and garbage collector. But for beginners C# is [s]usually[/s] a more friendly choice (and it works better then java on windows XD).

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.