Sign in to follow this  
whitin

C# vs C++ I need to know!

Recommended Posts

I really need to know. I just got started with C++ so I am not that far. I need to know if I would be better off mastering C#. I know some of you may say the C# will never take off and C++ is the industry standard. Well for those of you who say that. I am not in the industry and by the time I am I dunno what to expect. Would it be better to just learn C#? I have heard alot of good things about it and how the development time is cut greatly and how you do not have to focus on memory management. I thought I had a good thought of just learning C++ but I am getting discouraged and I really need some more opinions.

Share this post


Link to post
Share on other sites
Quote:
Original post by Anonymous Poster
go c++ way. you'd just be wasting time with C#.


I'm sorry but that is'nt enough to convince me. I need reasons why I should stick with C++.

Share this post


Link to post
Share on other sites
i would recommend starting with c++. Generally what I have found is that people who start with C# or anything higher level than c++ have a very hard time going back and learning c++. Learning c++ first and sticking to it will probably benefit you much more overall.

as for the whole 'here to stay' question you had, its only going to be answered in a flame war...

for a nuts and bolts perspective, c++ will help you understand a LOT more than C# will. This will benefit you in making games.



Share this post


Link to post
Share on other sites
If you want a job in industry, learn C++.

If you want to make your own smallish game, use C#. It'll save you a lot of grief.

C# is the future. There will be increasingly fewer reaons not to use it. Visual Studio 2005 has its best features (like automatic refactoring) exclusive to C#. It will be the language of choice for all but the most performance oriented applications.

Somehow I violate my own advice but using C++. But that's probably due to my illusions of grandeur (my game is going to be all this and all that and require every last ounce of performance, etc etc). Believe me I often wonder if I made the right decision. But it makes little sense to switch now.





Share this post


Link to post
Share on other sites
I've been learning C for the last 2 years (almost 3 actually) and, now I'm learning Win32 for GUI Developement. I sometimes have thought about going the C# way because; C/C++ combined with win32, DirectX, OpenGL or some other API really requires a TON of code to make something basic that can be done in C# with a couple of lines, I soppose, from what I've seen and heard.

C# is a RAD (Rapid Application Development) language, like VB. That means that, you can code up an application pretty quick compared to doing it in straight up C or C++ with some API.

Do note that, C# is a bit slower than the other mentioned languages but I don't see it as a deterrent because most PC's nowadays are pretty FAST and that would certainly help make your apps more fast.

Take a look at my recent thread to give you an idea at the amount of code it is required to make a simple input GUI application.

Share this post


Link to post
Share on other sites
Learning a programming language isn't really what matters, yes it does make it faster to write code once you've used a language for awhile, but any good programmer should be able to pick up a new language relatively quickly.

For this reason I would suggest learning using c++ out of these two as it makes you do more and should make learning c# later easier than the other way around, but mostly it shouldn't make to much different.

For windows development c# will probably take over from c++, but c++ will still be quite common for a while longer on linux and also there will be alot of code that will need to be modified/maintained that was written in c++.

Share this post


Link to post
Share on other sites
Quote:
Original post by xllx_relient_xllx
I've been learning C for the last 2 years (almost 3 actually) and, now I'm learning Win32 for GUI Developement. I sometimes have thought about going the C# way because; C/C++ combined with win32, DirectX, OpenGL or some other API really requires a TON of code to make something basic that can be done in C# with a couple of lines, I soppose, from what I've seen and heard.

C# is a RAD (Rapid Application Development) language, like VB. That means that, you can code up an application pretty quick compared to doing it in straight up C or C++ with some API.

Do note that, C# is a bit slower than the other mentioned languages but I don't see it as a deterrent because most PC's nowadays are pretty FAST and that would certainly help make your apps more fast.

Take a look at my recent thread to give you an idea at the amount of code it is required to make a simple input GUI application.


The part about couple of lines of code only applies to your initial window code/Windows GUI. C# is not going to magically increase your productivity in writing your Scene Graph/Renderer/AI/Game Logic. Most of the productivity which C# boasts comes from the .NET Framework which in essence is a library. There are libraries for every language and C++ has an abundant supply of them. Using a so called more "productive" Language is not going to reduce your development time anywhere as much as using a library which does what you want. Example, i can open my Rendering window in couple of lines using C++ using SDL/GLFW/GLUT as well. I can skip writing a proffessional grade Renderer by using Ogre(C# port Axiom as well) which will save you 2-4 years of your develoment time. It's the libraries/api's you use which help save your development time.

Im not saying that C# does not have libraries, there are many appearing. But the argument of the language increasing your productivity by 100% is just flawed. Most people compare C#'s huge .NET framework with C++'s standard library and reach that conclusion. Yes in terms of standard libraries, C# wins hands down especially for Windows development. But open your eyes to the thousands of excellent libraries for C++ and you will see that you can be just as/more productive in C++.

If you only plan to develop Windows games, you are safe with C# because i agree that there is no equvailent library to WinForms for windows GUI development. Then again you wont be using much of it for games. Also keep in mind that C++ is far more portable which is another strong reason for me not to switch.

Share this post


Link to post
Share on other sites
C# and C / C++ are just tools.

Some programs are like screws, which work better with screwdrivers than nails. While others are like nails, which work better with hammers than screwdrivers.

There isn't a silver bullet. C# will not hinder your game knowledge any more than C++ will help it. That is why asking a generic 'vs.' question will rarely get you a definite or even good answer.

Share this post


Link to post
Share on other sites
I don't know how old you are, or any other circumstances about your situation, but you say that you are getting discouraged, and so I can share my own experiences, hoping that they will help you.

I started programming when I was about 12. My first language was qbasic. After a couple of months of that, I decided to jump right into C++. It really wasn't an informed decision, and I really didn't understand that it would be hard. The only resource I had to learn from was one of those "Learn C++ in 21 days" books. I quickly got discouraged, believing that I was too stupid to be a programmer, and quit programming for years. What I did not understand was that programming is hard. It takes years to become good at. It takes patience, hard work, and perseverence. If you are interested in being a programmer, don't make the mistake of quitting just because it's hard. Quit because you don't enjoy it, or you aren't interested in programming, but not because it's hard. I found out years after I quit that I *do* want to be a programmer after all. I cringe every time I think about how talented I would be if I had just persevered. Don't make that mistake.

Share this post


Link to post
Share on other sites
Quote:
Original post by Ikana
I don't know how old you are, or any other circumstances about your situation, but you say that you are getting discouraged, and so I can share my own experiences, hoping that they will help you.

I started programming when I was about 12. My first language was qbasic. After a couple of months of that, I decided to jump right into C++. It really wasn't an informed decision, and I really didn't understand that it would be hard. The only resource I had to learn from was one of those "Learn C++ in 21 days" books. I quickly got discouraged, believing that I was too stupid to be a programmer, and quit programming for years. What I did not understand was that programming is hard. It takes years to become good at. It takes patience, hard work, and perseverence. If you are interested in being a programmer, don't make the mistake of quitting just because it's hard. Quit because you don't enjoy it, or you aren't interested in programming, but not because it's hard. I found out years after I quit that I *do* want to be a programmer after all. I cringe every time I think about how talented I would be if I had just persevered. Don't make that mistake.


Sorry, you seemed to just look at the word discouraged and programming. I mean that I am getting discourage in learning C++ instead of C#. Mainly because I am only 15, just going into 10th, and C++ may not be the standard for game programming by the time I get out of highschool. I was wondering if I should just learn C# now or C++.

Share this post


Link to post
Share on other sites
Quote:
Original post by whitin
Sorry, you seemed to just look at the word discouraged and programming. I mean that I am getting discourage in learning C++ instead of C#. Mainly because I am only 15, just going into 10th, and C++ may not be the standard for game programming by the time I get out of highschool. I was wondering if I should just learn C# now or C++.


Please don't look at what will be the standard when you are finished with your education, when you have programmed C++ or C# for a year or two you'll see that it aren't very hard to learn the other.

Right know you are just starting out and just learning the programming language seems like such a hard task that you don't want to do it again, but just wait until you have to learn OpenGL or DirectX, then you'll think that to learn C++ really wasn't that hard, and when you're designing a game engine you might think that OpenGL and DirectX weren't hard to learn. I'll bet that if you stick to one of the languages now, in one year you'll be able to learn the other pretty easily.

I'm not sure what to recommend, in my opinion C# are a "cleaner" language, and would be pretty good for a beginner. But also almost all resources on game programming use C or C++ source code. Also it'll probably be easier to go from a low-level language(like C++) to a high-level language(like C#) than the other way around.

So if you want to get into game programming, I'ld say C++, because there is already so much code written in C/C++.

And about that being 15 and caring about it's the standard when you get out of high school. Well I'm also 15, and I was very nervous making this decision myself to, I finally choose C#(after 1 year of experience with C++) because it's in MY opinion what the future game industry will mainly use, but I quickly switched back to C++ because I couldn't do all the fun things, they were already done in C#'s library. Anyway, today I use both, mostly C++ because I think it's more fun to program low-level(but not at an assembly level) than at the C# level.

Share this post


Link to post
Share on other sites
I would suggest starting out with modern c++. This would mean using the string class, boost smart pointers and stl containers. As in this article: http://www.gamedev.net/reference/articles/article2009.asp. Using smart pointers and the vector class makes c++ as easy as java or c# and you can still optimize if necessary.

Share this post


Link to post
Share on other sites
Hmm, put it like this.

I know C++. Learning C# took me an additional 30 minutes.

It doesn't matter. Currently C++ is the industry standard, and that won't change any time soon. And if it does? So what? It's easy enough to jump from C++ to C#.

And on the other hand, C# is a better language for beginners. It lets you concentrate on actual programming, without having to worry about relatively unimportant issues like memory management or pointer hell.

You can go both ways. They're both valid, and in the end, it won't make much difference. Starting with C# might make the learning curve less steep to begin with, but you'll have to spend a few hours afterwards learning C++.

C++ is harder to get started with, but once you know it, jumping to C# is no problem at all.

Share this post


Link to post
Share on other sites
Alright, let me give you the perspective of someone who is also 15 (going into 11th). About a year ago (infact, almost exactly a year ago) I picked up a book on BlitzBasic. Game Programming For Teens or something like that. I pounded through it with no challange or issues or anything. In the back of the book was an ad for GameDev, so I came here. Like every kid, we all dream of making it to the industry, but I knew that I had the skills in learning and articulation to actually make it. So after browsing on the forums and such, I came to the conclusion that I wanted to go all the way. I wanted to learn C++, and that I would take small steps, learn to make great games, and by the time I had my Bachelors (6 years away) I would have an incredible skill set, a great portfolio, and all the resources I need to make my break.

So I started learning C++. I started... hmmm... oh, right. C++ Primer Plus. Boy that was a mistake. Dryest read ever, more like a dictionary. Better for learning the language and how it all function then learning raw programming. So from what I learned in the book I decided to take an online class at Gameversity (this was about 11 months ago). Eventually I fell behind in the class, struggled with the topics, thought it was too hard, and forgot about C++ and game programming all together. I persued other things, like film and theater.

Well, about... I don't know, 3 months ago? I came on back to C++. I went to www.cplusplus.com and worked through the language tutorial. I already had C++ knowledge in the back of my head, and it was a good tutorial. I breezed right on through, comprehended everything, and was very sucessful making sample programs. I made text-based tic-tac-toe simple and easy. Then I started in 2D with an API called Allegro. Made Pong, Space Invaders, and BrickOut. Now I've worked my way through SideScroller prototypes, I'm on a team, and I should finish my first commerial game project before my 16th birthday in October.

The point is, I stuck with it, bore through the hard points, and now I'm living my dream! I wouldn't want it any other way. Here's my biggest tip. Never get discouraged. It may seem at times that you make bad, unstable code, but you have plenty of time to learn! We're young, and we've got the advantage of time on our hands.

Be strong, live strong, code strong. C++ all the way.

-IV

DevJournal available at www.gamedev.net/community/journals

Share this post


Link to post
Share on other sites
If youre the kind of person that likes to see results before the theory,
then learn C# first. If you like to learn theory before results, learn C++.

Right now i know both languages, and every now and then i program in C#,
but usually in C++. And when i switch languages my syntax doesnt get messed
up at all (For example i dont accidently use pointers in C# (without unsafe
keyword)). My point is that these languages are pretty close in syntax
and if you learn one it wont be hard to move on to the other, as many said.

It will be pretty useful to learn both, since then whatever the standard
may be, you'll be ready.

Share this post


Link to post
Share on other sites
I'd learn C first, and once you have a firm understanding of that than jump to C++, only learn C# if you want to be stuck to windows platforms.

Share this post


Link to post
Share on other sites
Quote:
Original post by Grain
I'd learn C first, and once you have a firm understanding of that than jump to C++, only learn C# if you want to be stuck to windows platforms.


Bad idea.
if you ever read this, i'm letting you know that learning C is a big mistake.
it teaches you bad structural habits when you should be learning object orientation in C++([cool]) or in C#. it's syntax is also harder to understand, making C++ easier to learn. things like output and memory managment are easier in C++. believe me, i know this.
as for C#, all i know is that it is easier to learn than the other two, but is slower and doesn't give you as much power and control.
I would stick with C++. that'll make C# no sweat.
Stay away from C [evil].

Share this post


Link to post
Share on other sites
Quote:
Original post by rayce
Quote:
Original post by Grain
I'd learn C first, and once you have a firm understanding of that than jump to C++, only learn C# if you want to be stuck to windows platforms.


Bad idea.
if you ever read this, i'm letting you know that learning C is a big mistake.
it teaches you bad structural habits when you should be learning object orientation in C++([cool]) or in C#. it's syntax is also harder to understand, making C++ easier to learn. things like output and memory managment are easier in C++. believe me, i know this.
as for C#, all i know is that it is easier to learn than the other two, but is slower and doesn't give you as much power and control.
I would stick with C++. that'll make C# no sweat.
Stay away from C [evil].


I'd like to know how you came to this conclusion. It sounds rather bogus to me, and unsound advice at that. But I could be wrong, so please elaborate.

Share this post


Link to post
Share on other sites
Quote:

it's syntax is also harder to understand

C and C++ are pretty similar in syntax, arent they?
Quote:
... memory managment are easier in C++.

their memory management models are nearly the same, except the usage of
the "new" keyword. Not such a big difference.

vertex *v = (vertex*)malloc(sizeof(vertex));
v->constructor();

// is basically the same as

vertex* v = new vertex(parameter1);



and using structures in C do give good OOP practice



// C
typedef struct vertex
{
float coords[3];
}vertex;

void empty_vertex(vertex* v)
{
v->coords[0] = 0.0f;
v->coords[1] = 0.0f;
v->coords[2] = 0.0f;
}

// is the same as...
// C++

class vertex
{
float[3] coords;
void empty_vertex()
{
v->coords[0] = 0.0f;
v->coords[1] = 0.0f;
v->coords[2] = 0.0f;
}
};

Share this post


Link to post
Share on other sites
Over the past few years I have learned or atleast tried to learn many languages including javascript, Visual Basic, Python, C, and C++, and many others. After all the tutorials, and guides that I've read I've realised that it's not that a language is "hard" but how it is presented to you. Some tutorials make things so easy, then you'll go to a different tutorial for the same language and it will be like trying to read Chinese. My advice would be to stick with C++. Just go to google, or the gamedev.net archive and read the first chaper/section of a few tutorials. Find a tutorial where the writer explains things in a way that makes sense to you. It's well worth reading about 'if' statements 10 times to pick out the right tutorial. Good luck man.

Share this post


Link to post
Share on other sites
First of all, I don't know much about C#, and as far as I know not too many games are developed with C#.

So I am just giving advice from my own experience when I was working in the gaming industry around a year ago.

My company was working for PC & Mac games.
The language that we use were both C and C++.
By the way, C++ is a superset of C, which means all the things in C can be applied in C++.

My suggestion is I think you should learn C++ because the language is aimed for software to be robust, maintainable, and extensible.
In other words, C++ leads you to Object Oriented Programming (OOP) and Object Oriented Design (OOD). I will let you do the homework on finding more about OOP & OOD.

As far as I had known and experienced, the current trend for software development in gaming and non-gaming industry gears towards to those 2 concepts.

If you would like to more about the reason, please feel free to post the questions because I know that I am still missing alot.

For learning C++, I would like to suggest this book that is easy to read and understand, imo:
"The complete reference C++ 3rd edition" by Herb Schildt (I don't know if there's any newer edition).

For learning OOP & OOD, try to read this one:
"Head First Design Pattern" by Eric and Elisabeth Freeman (the samples code are in Java, so you need to learn some Java syntax -> try to learn from "Head First Java").

Hope this is useful.



Share this post


Link to post
Share on other sites
I would like to reccomend the "Learn C++ in 24 Hours" book. It's really staright forward and explains things well.

http://search.barnesandnoble.com/booksearch/isbnInquiry.asp?userid=YS4HrOYBeh&isbn=0672326817&itm=1

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this