Re:Pointer Free Programming and the Future of Nim
by quotemstr on Friday October 20, 2017 @07:59AM
(#15515051)
The game engine people have the right idea with their entity-component-system [1] model. Essentially, it models the program as a big relational database instead of a graph of objects. It can work pretty well.
[1] https://en.wikipedia.org/wiki/Entity%E2%80%93component%E2%80...
Re:Pointer Free Programming and the Future of Nim
by plesn on Friday October 20, 2017 @04:28AM
(#15514314)
Could you provide more precisions / examples of this C code-style ?
Re:Pointer Free Programming and the Future of Nim
by jstimpfle on Friday October 20, 2017 @10:51AM
(#15516220)
I wrote a huge ranty reply, but deleted it because it leads OT. Basically, read up on the link to ECS in the sibling comment. Also, definitely check out "Data-oriented design". There's a talk by Mike Acton on Youtube. "Where there's one, there's many" is a pretty basic but super important insight.
I consider this to be important to code maintainability at least as much as to performance.
Rant: Personally since working on my game engine in C, my architecture has become so much simpler, I can easily avoid unnecessecary allocations. My code is much more coherent. Aspect-oriented - which is not at all OO spirit, since OO encourages (trying) to bundle things in self-contained packages.
Yes, that seems hard to believe, since there is so much bad C code out there. With allocations, strings, file system operations etc. all over the place, just as in typical OO code. (Of course some things are really hard to do in C vs C++. The point is forcing myself to have a good architecture and avoid having to make many meaningless decisions).