When/Why to Move to C++?

Started by
57 comments, last by swiftcoder 12 years, 7 months ago

I started with C as well, and while I am glad that I understand how to do my own memory management and the importance of knowing how things are stored in memory, I have to agree with rip-off that it's probably best that a person learning to program not start there. Unfortunately, I did not have much guidance in the realm of what to choose and so learning the language of operating systems seemed like a good place to start. I wish I could do it over again, I think it would have been beneficial to learn high level programming concepts first then learn how each works. Like learning how to drive, you wouldn't bother yourself with how the engine is mounted, how the fuel injection works, what sequence your distributor cap fires in; you would first learn the rules of the road, how to accelerate, braking distance etc. However, I would certainly suggest anyone who has been programming for a little while (2-3 years) at least try C out. If for no other reason then to learn pointers and malloc(). Truly understanding why malloc always returns a void * is lifechanging (at least for an 8th grader with no formal computer education.)


assembler= learning how the fuel injection works
C = driving a fully engineerd car but only with the standart functions
Java / C# = automatic gear change, ABS, parking help :

:-)


---

I open sourced my C++/iOS OpenGL 2D RPG engine :-)



See my blog: (Tutorials and GameDev)


[size=2]http://howtomakeitin....wordpress.com/

Advertisement
Memory management is one of many programming topics. There's enough to learn about computers and programming to fill a lifetime. It makes sense to start with a selection of topics that are among the most immediately and practically useful and go from there. Direct memory management doesn't really fit into that category these days -- there are more useful things to start with.

Learn everything you can about Object Oriented Programming. This is the soul of C++

I wince a little, every time I hear someone extolling the virtues of OO as applicable to C++.

Sure, C++ has (some level of) support for objects, but if you approach it purely from that angle, it really is 'C with classes'. And as 'C with classes' , the language is replete with all the dangers one would expect in something which shoehorns object orientation onto such existing abilities as that to trivially (and unintentionally) overwrite/slice/truncate your vtable.

I guess the thrust of my argument is that if you are looking for an OO language, there are likely better choices (Objective-C/Smalltalk, Modula, OCaml maybe?). As far as mastering C++ goes, a solid grasp of functional programming is likely to stand you in better stead than all the OO principles in the world...

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]


[quote name='kuramayoko10' timestamp='1315020145' post='4857022']
Learn everything you can about Object Oriented Programming. This is the soul of C++

I wince a little, every time I hear someone extolling the virtues of OO as applicable to C++.

Sure, C++ has (some level of) support for objects, but if you approach it purely from that angle, it really is 'C with classes'. And as 'C with classes' , the language is replete with all the dangers one would expect in something which shoehorns object orientation onto such existing abilities as that to trivially (and unintentionally) overwrite/slice/truncate your vtable.[/quote]
That is totally what C++ isn't. I wanted to show through my statement that if someone starts learning C++, its syntax, etc. and not learn by start OOP, they will be using 'C with classes' and not really using its potential.

I read through this thread several posts stating that C++ is not trully OOP and people criticising the language for it. People should understand that C++ implements (and it is impossible in C) the core of OOP: virtualization (dynamic dispatch), inheritance, encapsulation, polymorphism, open recursion, etc. And if you don't use that... then you don't need C++.
All of this functionality works great on C++ (it is not the sake of the matter if other languages do as well or not).

Now, if you want to learn the paradigm itself, of course you are not going to be limited to a language.
A language uses of many paradigms but never defines one... those are totally distinct things. Each language was written with a thought in mind, and yet many applications and users sympathise with the C++ thought and manage to implement it all.
If anyone wants to know what tool or language is better for a problem, go learn more languages. [color="#48D1CC"]And C++ is a good language to learn. :)
Programming is an art. Game programming is a masterpiece!

All of this functionality works great on C++ (it is not the sake of the matter if other languages do as well or not).
[/quote]

But that's the point. It does not work great in c++.

It works, but has awkward/ambiguous syntax and is surrounded by a pile of things that don't work (or worse yet, appear to work).


All of this functionality works great on C++ (it is not the sake of the matter if other languages do as well or not).


But that's the point. It does not work great in c++.

It works, but has awkward/ambiguous syntax and is surrounded by a pile of things that don't work (or worse yet, appear to work).
[/quote]

Lol ... I think I am too adjusted to the language syntax then =D
I am learning Objective-C to work with the iOS, and man, I call that a horrible syntax! O.o
Programming is an art. Game programming is a masterpiece!
If you don't have experience (i.e. nontrivial experience) in any of the languages swiftcoder mentioned, I don't think you have enough breadth of programming history to really properly argue for or against C++.

I find it interesting that so many people who praise C++ as a great language have minimal contact with anything else.

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]


If you don't have experience (i.e. nontrivial experience) in any of the languages swiftcoder mentioned, I don't think you have enough breadth of programming history to really properly argue for or against C++.

I find it interesting that so many people who praise C++ as a great language have minimal contact with anything else.

That depends greatly on application.

Of course that if I want to write my Doctorate on OOP for instance I will have to go deep on the subject and analyze every languages' implementation of this paradigm. But it all my applications can be solidly built on C++ and I am certain that I am doing good use of it, why should I argue against it?

Everyone knows that the thread got a little far off the original intent. The cool thing to analyze here and filter from all this posts is the table of good applications of C++ and bad applications of C++ as everyone have cited some. I hope you and the others didn't take this as a fight for which language is the best, etc.
I assume that everyone here have the enough experience on programming to know that each language is a tool and for every new problem we get ourselves into, we are going to look over all of them and choose the best for that matter. And that there is never the best language to rule them all :).
Programming is an art. Game programming is a masterpiece!
That's a very dangerous (and, IMHO, naive) assumption to be making, given that the title of this forum is "For Beginners."

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]


People should understand that C++ implements (and it is impossible in C) the core of OOP: virtualization (dynamic dispatch), inheritance, encapsulation, polymorphism, open recursion, etc.

And if you don't use that... then you don't need C++.

You misunderstand me a little: I don't in any way deny that C++ provides enough features to allow one to happily program in an object-oriented fashion. What I am suggesting is that if you are treating C++ purely as an OO language, then you are not using C++ to its full potential.

It is a multi-paradigm language, and if you learn only one paradigm (i.e. object oriented programming), then you are only using a fraction of the available power and expressiveness. For example, note how Boost (and the C++ standard) has trended towards enabling functional programming techniques over the last decade...

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

This topic is closed to new replies.

Advertisement