There was a session in GDC called “A Data-Oriented Approach to Parallelizing Hierarchical Transforms (Presented by Unity Technologies)” and given that I had seen the past Unite the session by Joachim Ante on their new Entity Component System I wasn’t planning to go to it. I had never heard about Mike Acton, so when somebody mentioned to me "it should be really good" I decided to give it a shot.
The session starts very well; Mike makes an analogy on how Unity is like a car full of clowns, and before moving forward we have to make sure all those clowns are out of the car. At this point I’m pumped, I’m thinking that finally somebody is going to break out of this idyllic view that the Unity developers often portray (can’t remember how many discussions I was involved with Unity about weird decisions, like their IMGUI or how “C# is fast enough”) and put all its skeletons out in the open. And then he drops the bomb: “and the first clown we have to get out of there is Object-Oriented Programming”.
The session starts very well; Mike makes an analogy on how Unity is like a car full of clowns, and before moving forward we have to make sure all those clowns are out of the car. At this point I’m pumped, I’m thinking that finally somebody is going to break out of this idyllic view that the Unity developers often portray (can’t remember how many discussions I was involved with Unity about weird decisions, like their IMGUI or how “C# is fast enough”) and put all its skeletons out in the open. And then he drops the bomb: “and the first clown we have to get out of there is Object-Oriented Programming”.
Object-Oriented Programming is Communism and Data-Oriented Programming is Democracy
I’m always very weary when people take extreme positions. By default, Communism has a very good concept; to make society more equalitarian. As a goal this sounds pretty good to me, but even Marx predicted that for it to be achieved, the sacrifice would have to be huge.
At its core, Object-Oriented Programming (OOP) has the following principles:
These are very simple concepts. Nothing inherently wrong with them, and at its heart it is what OOP is. The problem, like with Communism, is not about the goal but what we do to try to achieve it.
In my opinion, there is a massive problem with how programmers are being taught today. In my line of work, I very often come across two major issues: over engineering, and suboptimal code.
Over engineering is the worst from architectural point of view, because it goes against the whole purpose of OOP; it makes things more convoluted, complicated, unmaintainable, inflexible.
Suboptimal (some might call it simply bad) code has to do more with how programmers code without realizing the implications that the code they are writing has, e.g. allocating memory like crazy, algorithms that iterate over data far more than needed.
I mostly blame schools because they teach students to do things “the right way”, but the students have their share of blame too. It is specially frustrating for me when young programmers are very stubborn in their “right ways” of doing things, and they should be more open to understand that “right” is a very subjective term (history teaches us that over and over), specially when sometimes these mentors that taught them never actually had real world experience on the subjects.
Not saying school or teachers are bad, but I do think it could be better. It’s weird to me that at the point people should be most open to learn (given that’s what they were doing for most of their life), they are the most closed to it.
And now here comes Data-Oriented Programming (DOP), the Democracy, allowing all developers to take hold of the full potential (of not only their games but themselves). Democracy is one of those interesting concepts, in theory everybody has an equal say in it and the majority drives the direction but, as we’re seeing these days, what happens when the majority is being fooled by huge propaganda machines?
This is how I feel about DOP; at the moment there’s this idea starting to push it forward as “the right way” of programming. If bad OOP code can be tricky as hell to get around with, one can only imagine with DOP code.
DOP was the old way of doing things (more out of necessity), that’s basically the core of C programming language, but at a certain point everybody (i.e. in general programming, not talking about low level kernel) kind of flocked at the idea of having a better way to organize things without sacrificing much performance.
Don’t get me wrong, I don’t think that DOP shouldn’t be used; like every tool it has its purpose but as a default I believe that OOP is a far better option when creating complex code like an App or Game, specially when you have a lot of people involved (exacerbated by lack of experience).
At its core, Object-Oriented Programming (OOP) has the following principles:
- Encapsulation
- Abstraction
- Inheritance
- Polymorphism
These are very simple concepts. Nothing inherently wrong with them, and at its heart it is what OOP is. The problem, like with Communism, is not about the goal but what we do to try to achieve it.
In my opinion, there is a massive problem with how programmers are being taught today. In my line of work, I very often come across two major issues: over engineering, and suboptimal code.
Over engineering is the worst from architectural point of view, because it goes against the whole purpose of OOP; it makes things more convoluted, complicated, unmaintainable, inflexible.
Suboptimal (some might call it simply bad) code has to do more with how programmers code without realizing the implications that the code they are writing has, e.g. allocating memory like crazy, algorithms that iterate over data far more than needed.
I mostly blame schools because they teach students to do things “the right way”, but the students have their share of blame too. It is specially frustrating for me when young programmers are very stubborn in their “right ways” of doing things, and they should be more open to understand that “right” is a very subjective term (history teaches us that over and over), specially when sometimes these mentors that taught them never actually had real world experience on the subjects.
Not saying school or teachers are bad, but I do think it could be better. It’s weird to me that at the point people should be most open to learn (given that’s what they were doing for most of their life), they are the most closed to it.
And now here comes Data-Oriented Programming (DOP), the Democracy, allowing all developers to take hold of the full potential (of not only their games but themselves). Democracy is one of those interesting concepts, in theory everybody has an equal say in it and the majority drives the direction but, as we’re seeing these days, what happens when the majority is being fooled by huge propaganda machines?
This is how I feel about DOP; at the moment there’s this idea starting to push it forward as “the right way” of programming. If bad OOP code can be tricky as hell to get around with, one can only imagine with DOP code.
DOP was the old way of doing things (more out of necessity), that’s basically the core of C programming language, but at a certain point everybody (i.e. in general programming, not talking about low level kernel) kind of flocked at the idea of having a better way to organize things without sacrificing much performance.
Don’t get me wrong, I don’t think that DOP shouldn’t be used; like every tool it has its purpose but as a default I believe that OOP is a far better option when creating complex code like an App or Game, specially when you have a lot of people involved (exacerbated by lack of experience).
The Biggest Clown
Unfortunately, it seems to me that the biggest clown in Unity will continue there. He’s the one with the driving license, and as such will not leave the car. I’m not talking about nested prefabs, input systems, core loop methods based on broadcasts, or any other piece of code; I believe that for Unity to become a real AAA engine, Unity Technologies needs to start making games.
Only when you have to do big games with a lot of people you realise all the problems that actually exist, and all of a sudden these cannot be skimmed over or ignored. They are show stoppers (or at the very least delayers) and require full on attention to tackle and solve them.
For long I’ve had a love/hate relationship with Unity. I’ve been there from the start in the Mac OS days, and I’ve been actually very close to dropping it, but fate brought me right in for professional reasons. It’s funny because Unity is in the best shape it has ever been, but like a victim of domestic abuse that endured for years eventually there’s that little thing that will tip the scales.
I honestly hope that Unity becomes better, but I advise extreme caution specially to inexperienced teams following extremist points of view.
Only when you have to do big games with a lot of people you realise all the problems that actually exist, and all of a sudden these cannot be skimmed over or ignored. They are show stoppers (or at the very least delayers) and require full on attention to tackle and solve them.
For long I’ve had a love/hate relationship with Unity. I’ve been there from the start in the Mac OS days, and I’ve been actually very close to dropping it, but fate brought me right in for professional reasons. It’s funny because Unity is in the best shape it has ever been, but like a victim of domestic abuse that endured for years eventually there’s that little thing that will tip the scales.
I honestly hope that Unity becomes better, but I advise extreme caution specially to inexperienced teams following extremist points of view.