C, C# or C++?

Started by
26 comments, last by PropheticEdge 13 years ago

He wasn't regarding C++ as "C with classes" in the slightest.




I know.



I wouldn't recommend using C for anything practical, apart from some training, instead - think of it as if it was Latin - a dead language (not true in case of C, but just bear with me :)), but also the foundation of most of European languages. You can't really chat up foreigners with it, but it will make it easier for you to learn any modern, European language. In case of C - modern oop languages, of course.



Latin is the foundation of the modern Romance languages which are a sub-family of the Italic languages (everything non-Romance being extinct AFAIK). It is NOT the foundation of any other Indo-European language families. Furthermore, most of the modern Romance languages are pretty distant from Latin. Only Romanian really retains the case system and that's had such a huge influence from the Slavic languages in terms of vocabulary that Latin wouldn't really help with that much.

Similarly if you learn C, you'll probably have an okay time with anything that's deliberately C like, and a decidedly non-okay time with, say, J.
Advertisement
Man, these threads get out of control quickly. In a broad sense, it doesn't matter what you pick. My recommendation is C#, with Python being a close second. These languages are easier to manage, in the sense that you can get a working program done more quickly/directly than other languages. This lets you focus on programming concepts, rather than entangling those concepts with syntax that can be highly language-specific.

But whatever you choose, you're going to be fine. You mentioned that you'll be going to University soon, where you'll be getting formal training in computer science and programming and several languages (I assume, that's a pretty standard curriculum). I would still pick something that will get you going quickly and (relatively) easily, like C# or Python. But don't fret about what you start with right now.

-------R.I.P.-------

Selective Quote

~Too Late - Too Soon~


Latin is the foundation of the modern Romance languages which are a sub-family of the Italic languages (everything non-Romance being extinct AFAIK). It is NOT the foundation of any other Indo-European language families. Furthermore, most of the modern Romance languages are pretty distant from Latin. Only Romanian really retains the case system and that's had such a huge influence from the Slavic languages in terms of vocabulary that Latin wouldn't really help with that much.
[/quote]

Indeed, that's a bit of an oversimplification on my part. However, despite Latin only being the foundation of French, Italian, Spanish and other Romance languages, its influence had a great impact on both Germanic and Slavic languages (not sure about the Ugro-Finnic family though) and there plenty of shared words and phrases that you can understand knowing Latin, but not necessarily the given language. I'm no expert, as you seem to be, MeshGearfox, but as an English and Polish speaker (with a little Latin training) I can easily see the overlaps, which sometimes really prove helpful...


Similarly if you learn C, you'll probably have an okay time with anything that's deliberately C like, and a decidedly non-okay time with, say, J.
[/quote]

..and I think this also applies to C. Plenty of languages are based on it directly or indirectly or were influenced by it in a relatively strong way. Functional languages are a definite exception, but apart from them, most languages used in game development inherit from C. According to wiki, programming languages influenced by C include: AMPL, AWK, csh, C++, C-- , C#, Objective-C, BitC, D, Go, Java, JavaScript, Limbo, LPC, Perl, PHP, Pike, Processing, Python.
Knowing C, you can pick up most, if not all, of these quite easily.
I use C pretty much weekly, now that is for microcontrollers, but it is still C.

C with Classes


I think C++ is better regarded as C with self-referential structs and Haskell-esque metaprogramming.


[/quote]

The title of C with Classes goes to Objective-C, with the addendum "and a suicide inducing syntax"

Anyway, I'll clear up a few myths here and now.

1) C++ is not the superior, be all end all language. It's a powerful one, a widely used one, and a useful one for game development, but not inherently "better" than other languages. Computer languages are tools, and they perform different tasks. C++ is kind of like a chainsaw, you can cut down trees with it, you can cut boards with it, you can cut your own foot off with it, you can even carve an elegant statue with it if you're good enough, but it won't do you a damn bit of good if you just need a screwdriver.

2) There is no right or wrong language to learn first. Hell, I don't even think there's a best language to learn first. Learning language X first is not going to screw you over by forming Y bad habbits. Yeah, a novice learning C# might have bad or non-existent memory management skills, but I can guarantee you that a novice learning C++ will have shit-tastic memory management skills, too. The difference there is that C# will keep chugging along with its garbage collector, while C++ will just kind of roll over and die, which can be a frustrating and confusing experience for someone just starting off. You're going to make mistakes and have to re-learn stuff no matter which language you start with. That's just a part of learning a new skill.

3) C++ is not nearly as hard and scary as people make it out to be. Honestly. I was totally surprised when I started learning C++ only after several years of programming other languages. I was expecting that I'd have to pore over tomes both ominous and arcane in nature for years, but quickly discovered it was basically like every other OO language out there with some extra quirks and manual memory management. Not a big deal.

Now, I'll talk about some advantages and disadvantages to picking up various languages first.

1) Python: A very simple scripting language that's loads of fun to work with. It has a c-ish syntax, so it will get you used to that. It's really easy to pick up and learn, with a very bare minimum of boilerplate code (long, repetitious code needed to perform even simple tasks) and eliminates most barriers between you and programming. The limitation here is that you're not going to be writing the next Crysis in Python. It's definitely not a throwaway language, knowing scripting languages is really useful for game programmers and Python's used out in the wild.

2) C#: A really cool language that's powerful and has a clean syntax. It's like Java, but with a lot of the bullshit removed. You can do some pretty serious work with C#, and it will set you up to work your way into XNA, a great library for developing games that's quite powerful. C# will also introduce you to serious Object-Oriented programming, which is absolutely critical to learn as a programmer. It does have its limitations, however, being that it trades usability and ease of use for the extreme degree of control that C++ gives you.

3) C: A classic, very clean language. It's not OO, so you'll be limited there, but it does introduce you to very important concepts like manual memory management and pointers that are abstracted away in a higher level language like C#. This language is, and probably will forever be, useful, and I strongly believe every programmer should learn C at some point. I cut my teeth on C taking a course programming games for the Gameboy Advance, which was super super fun. I'd advise you not jump out the gate making GBA games, though, since it does require some intermediate knowledge of programming.

4) C++: An extremely powerful and useful language that has broad application to game development. You can't go wrong here, and probably will have to learn C++ at some point (you really should). You can learn it as a first language, but it's not as friendly as C# or Python or even C. The syntax can get messy (in my opinion) and you will have to deal with some of the more tedious and confusing aspects of programming that C# and Python do for you. Still, this is valuable stuff to learn and C++ can scale down very well, approaching C-like levels of simplicity and cleanliness. A good book or tutorials can guide you safely through C++ as a first language.

I think the above are all really solid picks for first languages. Personally, my progression when I learned to program was Python->Java/C#->C->C++ (with like, 20 other miscellaneous langauges strewn about along the way). This certainly worked well for me, but I wish I'd gotten around to C++ a bit sooner.

Why not start with Python, then C#, then C++? :P


This would probably be the best route.. although in my case... I skip over Python and went into C#. It actually pretty simple to get the hang off since I work in prior languages like Ruby (RPG Maker) and GML (Game Maker).
Current Project:
* Project Lavapit (Using Visual C# Studio, Version 0.2)
* Mass Invasion (Using Visual C++ Studio, Version 1.2) [Minor break]
* Invasion -Port- (Using Visual C# Studio, Version 0.1)

* Codename Alias (Using GM; Version 1.0)

* Eternal Remien (Using RPG Maker VX; Version 2.2)

* R.E.X. (Unknown Program; Ideas Only)




Current Members:
Troy Cabal (Game Art & Design Major)
Francis Simon (Business Major)
Calvin "Romell" Mathes (Business Major)
Zane Castillo (English Major)
It's not OO, so you'll be limited there[/quote]

Snarky response: You say that like it's a bad thing.

Better response: OOP is more of a programming style. You can write object oriented code in C and you can use C++'s classes in a non-OO manner. And it's arguable whether C++ is actually object oriented in a proper sense anyway.


It's not OO, so you'll be limited there


Snarky response: You say that like it's a bad thing.

Better response: OOP is more of a programming style. You can write object oriented code in C and you can use C++'s classes in a non-OO manner. And it's arguable whether C++ is actually object oriented in a proper sense anyway.


[/quote]

I was speaking in the vernacular, wherein an "OO language" is one with provisions for the object oriented programming style built in, or within easy reach (read: not an extensive library to install and learn), versus a "non-OO language" wherein there is no innate provision for the OO programming style.

C++ is object oriented enough. We can get into all sorts of dick waving wherein people will start screaming about pure OO and Smalltalk and bald eagles will start crying American flags, but at the end of the day does it matter? Languages are tools, and what matters is how well that tool can be leveraged toward a particular task. This is a matter of work, not philosophy. OO is a useful tool for improving development speed and the management of a large amounts of code.

A reasonable implementation of OO is going to increase productivity and the ability to manage large projects . Yes, you can make a reasonable implementation of OO in C, but damn I don't want to. To make an implementation that provides an equivalent degree of capability offered by C++ would probably be beyond my skills, or if it were at my skill level, would be arduous, painful and time consuming. For all I care the brilliant wizards of CS are more than welcome to sit in their ivory towers, stroking their beards sagaciously and clicking their tongues disapprovingly at me shuffling about my slovenly mud hut whilst I bang two rocks together to produce C++ code.

Yes, I consider C's lack of OO support a "bad thing." I'm not a philosopher, I'm not an artist, I'm here to make pixels move on screen and things blow up in most impressive ways. I could care less about the design philosophy, purity of my code, elegance, etc. When it comes down to it, I care about how well the language performs for my specific task and how easy it is to develop with (and maintain for expansion).

This topic is closed to new replies.

Advertisement