Jump to content

  • Log In with Google      Sign In   
  • Create Account


When/Why to Move to C++?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
58 replies to this topic

#41 ApochPiQ   Moderators   -  Reputation: 14673

Like
0Likes
Like

Posted 04 September 2011 - 05:07 PM

It may be a semantic distinction, but that doesn't make it incorrect or somehow invalid. By the original definition, and by many of the subsequent iterations on that vision, Java's structure as a language encourages violation of OO principles. Arguably, the same is true of C# and its property system.

I don't feel like it is sensible to claim Java is OO by virtue of the fact that you can torture the definition of OO to suit Java's whims; it smacks of fallacious reasoning to me. Of course, one could just as well argue that my own chosen definition of OO is somehow faulty, so we really have to boil down to pragmatics to reach a useful conclusion.

By that token: for certain foundational views on Object Orientation, Java fails to pass the acid test of compliance. On the flip side, at the risk of posing a wholly circular argument: Java is OO in the sense of "OO" that Java itself was largely responsible for popularizing.

Reasonable enough? :-)

Sponsor:

#42 pulpfist   Members   -  Reputation: 528

Like
0Likes
Like

Posted 04 September 2011 - 05:17 PM

It may be a semantic distinction, but that doesn't make it incorrect or somehow invalid. By the original definition, and by many of the subsequent iterations on that vision, Java's structure as a language encourages violation of OO principles. Arguably, the same is true of C# and its property system.

I don't feel like it is sensible to claim Java is OO by virtue of the fact that you can torture the definition of OO to suit Java's whims; it smacks of fallacious reasoning to me. Of course, one could just as well argue that my own chosen definition of OO is somehow faulty, so we really have to boil down to pragmatics to reach a useful conclusion.

By that token: for certain foundational views on Object Orientation, Java fails to pass the acid test of compliance. On the flip side, at the risk of posing a wholly circular argument: Java is OO in the sense of "OO" that Java itself was largely responsible for popularizing.

Reasonable enough? :-)


I would have to say yes.

I remember attending some lessons by Nygaard myself and I got the feeling that there was more to he's ideas about OO than just the structures, so to speak. But I couldn't quite figure out what lol.
The closest I got to an answer has been languages claiming to be "true OO" languages, and the justification for that term always seemed to focus on what features those languages didn't provide. Hence, forcing the programmer to do OO the right way.

#43 Serapth   Crossbones+   -  Reputation: 5265

Like
0Likes
Like

Posted 04 September 2011 - 06:07 PM

I'll allow it. ;)


Besides, I feel sullied defending Java (in any regard), a language I really am not keen on.


I would however say that C# is much closer to the original vision of Smalltalk than you are giving it credit for, especially with its emphasis on reflection. In many ways ( except syntax/implementation ) I would regard C# as the closest mass market language to implementing Alan Kay's vision. ((With the possible exception of Objective C, a language I have ( and desire) very little experience with))

#44 kburkhart84   Members   -  Reputation: 1599

Like
0Likes
Like

Posted 04 September 2011 - 07:24 PM

This discussion reminds me of the "make an engine or make a game" discussions...

What is the final goal(at least for now)?? What tools can get you to the goal, and which ones fit better??

For example, the software Game Maker(cheesy as the name is) is actually quite capable of making 2d games. It is pretty easy to use, and yet has a scripting language(similar to Javascript, C++ language types), and so allows you do many things that the drag&drop buttons obviously couldn't do. Here's the catch. At the time of this post, the scripting is slow, and the sound system is not that great. But....for some devs it is a better choice than coding a game in C++. Why?? Because you no longer have to code everything. Of course, the more is done for you, the less you can customize. Unity is another example. It requires much more scripting, but for making games, it is still easier than simply using C++(at least in the opinion of some).

For me, I started about 12 years ago using C++, way back with Visual C++ 6.0.(I'm sure others have much longer of a history than I). I've done games with vanilla OpenGL and DInput/DSound. I've also used the Irrlicht engine(pretty nice actually). But, I currently am using Game Maker. Why? The reasons I mention above. I can use C++, and reality is my games would be faster at run-time, but dev-time on the other hand not likely.

The thing to watch is whether the tools can meet the requirements for what you want. For 2D games, Game Maker can do a lot. For 3d games, Unity can also do a lot. There are other tools/toolsets out there, with similar tradeoffs. The Torque3d lineup isn't bad, but it has downfalls too. The final verdict would depend on whether one of the easier to use tools is "good enough," and if it is, you are probably better off using it if your real goal is game creation.



#45 FlyingDutchman   Members   -  Reputation: 207

Like
0Likes
Like

Posted 08 September 2011 - 05:16 AM

There is no good answer to these questions really, languages are just tools.

Since you've made a few games allready you should have enough programming experience to be able to pick up pretty much any language.

Almost noone "switches" to C++ , an experienced programmer will know and use multiple languages, C++ is a good language to know and it is quite heavily used in many fields but there are plenty of other languages you should take a look at aswell at some point.


yeah ,.. 10 years ago when i started to learn programming, i chose C++ because everyone told me that if u want to do games u need it..
now i only use it for my own hobby projects :-).. in my work i mostly go with Obj C + Java... They provide a lot of useful functions and they are the main language to go for iOS and Android.

But nevertheless.. C++ is my big love and, u can start flaming me now, I would suggest ANY NEWBIE to start with C.. the value of learning memory management and casting and all this low level ish is uncountable.. i got my last job actually only because im a c++ coder... even if i dont use it now .. people know what ive been through lol ^^

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


See my blog: (Tutorials and GameDev)

http://howtomakeitin....wordpress.com/


#46 rip-off   Moderators   -  Reputation: 8070

Like
1Likes
Like

Posted 08 September 2011 - 07:47 AM

I would suggest ANY NEWBIE to start with C].. the value of learning memory management and casting and all this low level ish is uncountable.. i got my last job actually only because im a c++ coder... even if i dont use it now .. people know what ive been through lol

Non sequitur. I don't see how low level development being useful to you at some point in your career means that one should start there.

#47 Tachikoma   Members   -  Reputation: 552

Like
1Likes
Like

Posted 08 September 2011 - 08:18 AM

I don't know.

When it comes questions like this, I usually reply with "just hack away". IF you are interested enough, then you will have the persistence to figure out how each new language works to some degree. That includes reading up plenty of material on the subject and trying new tricks.

After a while, you cherry pick the one that is more relevant to you in terms of career and interests, and then refine your coding skills with your choices.
Latest project: Sideways Racing on the iPad

#48 geekyware   Members   -  Reputation: 102

Like
0Likes
Like

Posted 08 September 2011 - 09:18 AM

Well, I started with C, that was the first I learned and i think that made me a lot easier to understand new languages, althought it took time to me to understand that one. Why to move to C++? Whenever you want. At first I didn't understand oop really good, and couldn't see why that would be usefull, but when I understood them and applied it to game, classes and all these things happened to be much more comfortable and, in my opinion, easy to use, than the things I had to do before. Now when I think about how would I do that in a game, I always think in C++, so I would recommend you to move into C++, but it's not necessary to make games at all. In fact, most libraries are for C, not for C++, (but in C++ you can use them), like SDL, OpenGL, Allegro...

#49 TangoKilo3   Members   -  Reputation: 104

Like
0Likes
Like

Posted 08 September 2011 - 11:41 AM

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.)

#50 FlyingDutchman   Members   -  Reputation: 207

Like
0Likes
Like

Posted 08 September 2011 - 11:32 PM

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)

http://howtomakeitin....wordpress.com/


#51 Gamer Gamester   Members   -  Reputation: 136

Like
2Likes
Like

Posted 08 September 2011 - 11:46 PM

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.

#52 swiftcoder   Senior Moderators   -  Reputation: 9763

Like
1Likes
Like

Posted 09 September 2011 - 12:05 AM

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 - Software Engineer @Amazon - [swiftcoding]


#53 kuramayoko10   Members   -  Reputation: 386

Like
0Likes
Like

Posted 09 September 2011 - 05:52 PM


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.

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. And C++ is a good language to learn. :)
Programming is an art. Game programming is a masterpiece!

#54 Telastyn   Crossbones+   -  Reputation: 3726

Like
0Likes
Like

Posted 09 September 2011 - 06:17 PM

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).

#55 kuramayoko10   Members   -  Reputation: 386

Like
0Likes
Like

Posted 09 September 2011 - 06:25 PM


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).


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!

#56 ApochPiQ   Moderators   -  Reputation: 14673

Like
0Likes
Like

Posted 09 September 2011 - 06:38 PM

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.

#57 kuramayoko10   Members   -  Reputation: 386

Like
1Likes
Like

Posted 09 September 2011 - 06:53 PM

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!

#58 ApochPiQ   Moderators   -  Reputation: 14673

Like
0Likes
Like

Posted 09 September 2011 - 06:54 PM

That's a very dangerous (and, IMHO, naive) assumption to be making, given that the title of this forum is "For Beginners."

#59 swiftcoder   Senior Moderators   -  Reputation: 9763

Like
0Likes
Like

Posted 11 September 2011 - 06:14 PM

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 - Software Engineer @Amazon - [swiftcoding]





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS