Linked by MOS6510 on Thu 10th Jan 2013 23:25 UTC
General Development "For years I've tried my damnedest to get away from C. Too simple, too many details to manage, too old and crufty, too low level. I've had intense and torrid love affairs with Java, C++, and Erlang. I've built things I'm proud of with all of them, and yet each has broken my heart. They've made promises they couldn't keep, created cultures that focus on the wrong things, and made devastating tradeoffs that eventually make you suffer painfully. And I keep crawling back to C."
Thread beginning with comment 548296
To view parent comment, click here.
To read all comments associated with this story, please click here.
RE: spot on
by dorin.lazar on Fri 11th Jan 2013 01:30 UTC in reply to "spot on"
dorin.lazar
Member since:
2006-12-15

C++ does not force you to go OO, but it encourages it.

And this is a good thing ;)
In large systems, OO will hurt you.

Uhm. I dare to disagree. Depends on what you call 'large system'. It may be the feeling that OO causes bloat because it's easy to get bloaty when you're using OOP. But that doesn't mean that it will happen.
At the core of OOP we have the association of data and the methods that work with that data, through encapsulation. I see nothing wrong with that. It does help you to be more productive, it makes more sense for larger systems to go OOP. OOP systems are simply easier to handle and to extend.

Reply Parent Score: 4

RE[2]: spot on
by bram on Fri 11th Jan 2013 05:13 in reply to "RE: spot on"
bram Member since:
2009-04-03

I have found Noel Llopis' Data-oriented design paper to be an eye opener. http://gamesfromwithin.com/data-oriented-design

With OO, it is easy to end up with a menagerie of objects all referring to each other with deep complexities. With data oriented design you tend to end up with flatter architectures and fewer dependencies.

I'm a game programmer, and I like his advice on how you could code most of your game engine subsystems as you would code your particle system.

With C, I feel more easily guided to data oriented, structures-of-arrays, instead of the OO and arrays of structures/objects.

Reply Parent Score: 4

RE[3]: spot on
by Alfman on Fri 11th Jan 2013 06:30 in reply to "RE[2]: spot on"
Alfman Member since:
2011-01-28

bram,

That's an interesting link. From a technical standpoint I don't think anything is inherently bad with C++ features. However there's no doubt that it encourages rather different approaches to software design.

C programs often use no abstractions whatsoever and will directly call the external libraries and kernel.

C++ facilitates rich levels of abstraction, which is generally a selling point for developers to choose it over C, and yet these very abstractions can be responsible for adding many more inefficient layers than we typically find in C programs.


OOP interfaces significantly help with contract-oriented programming in teams and help make problems much more manageable. I think a good OOP programmer will know where to draw the line without going crazy about everything needing to be a proper object.

There's no reason a high performance game should not be written in C++, just be mindful of too much indirection in critical loops.

Edited 2013-01-11 06:37 UTC

Reply Parent Score: 4