PDA

View Full Version : C vs C++, Objected Oriented Programming vs Data Oriented Programming



Quick3nd
07-13-2017, 05:47 AM
As someone new and planning on getting into Graphics Programming and possibly Game Development, the following topics/paths always leave me wondering as to which route I should take. Now, I know some of these subjects are a little controversial and might create much debate, but still, I would love to hear about your personal view and experience in the industry and hopefully get a better perspective.

As someone who is planning on getting into Graphics Programming or Game Development, would it be better to :

1. C or C++

2. Object Oriented Programming or Data Oriented Programming

After researching around on the internet, there seems to be two schools of thoughts. One that prefer to use C with perhaps a few features from C++ such as operator overloading, etc. (Casey Muratori, Mike Acton....) Who value performance and the Data Oriented approach and see Object Oriented as an unnecessary evil. And, those who use C++ and Object Oriented Programming (responsibly).

Now, as a relatively new programmer with only python experience, I'm really having a hard time deciding which road to take; especially when it comes to the initial decision of deciding which language to learn.

Both sides seem to make a good case, yet the undeniable fact is that majority of the people do seem to use C++ (but perhaps someone in the industry could shed some light on this subject), while some use a Cish C++, and relatively few using only pure C. Even John Carmack -- Quake's developer who used to code in pure C have recently decided to use C++ for their new and recent installment of Quake 3.

After years in the industry, what would you recommend to newcomers who are interested in Graphics Programming, making their own engine, or Game Development in terms of C, C++, OOP, DOD?

Thanks in advance :)

Cornix
07-13-2017, 10:35 AM
Programming languages are not religions, they are tools. You choose the right tool for the job. Dont choose the tool first and then look for the task; instead, focus on the task and then choose the tool that fits best.
If you dont know which tool is better to solve a given problem then you are probably too inexperienced to really benefit from either choice. If you are a beginner I would suggest you just make an "arbitrary" choice and stick with it until you are experienced enough to understand the pros and cons.

Silence
07-14-2017, 12:03 AM
1. C or C++

2. Object Oriented Programming or Data Oriented Programming

For 1, If you choose C, then it will be more hard to do OOP. You would be able to mimic OOP (see gtk+ or directx for example). But that's hard, and will loose many options a real OOP language could provide.

For 2, you can be data driven and still use OOP style. Both are not incompatible.

As a global point, games are usually written in an OOP language nowadays, and are all data oriented too. There are pitfalls that should be avoided. But if you follow a data oriented programming and possibly an entity component system for the game logic, then you'll avoid almost all of them.

If you want to do game development, then try this forum (https://www.gamedev.net/) as this one is really dedicated to OpenGL.