Entity Component System used in Web Development?

Started by
4 comments, last by Hodgman 11 years ago

Has any of you used ECS in web development? I know that MVC is the big thing now in web development. It's even used in games. But I wonder how would web development be done if the ECS approach was used instead of say MVC (or any other approach).

Beginner in Game Development?  Read here. And read here.

 

Advertisement

I'm not sure what it would buy you and it isn't really analogous to MVC. You could probably design an MVC system with a more ECS approach as opposed to a more traditional OOP approach. What are the strengths of ECS that you would like to see applied to web development?

I'm not sure what it would buy you and it isn't really analogous to MVC. You could probably design an MVC system with a more ECS approach as opposed to a more traditional OOP approach. What are the strengths of ECS that you would like to see applied to web development?

Well I'm still trying to figure out this whole ECS thing myself. My question is more about exploring/learning/understanding if ECS can be applied/used in web development.

Beginner in Game Development?  Read here. And read here.

 

"ECS" is just a buzzword for the OO concept of "composition", which is a key pillar of OO.
The arguments for "ECS vs entity-hierarchy" are just obfuscated arguments for "composition vs inheritance".

I dont think its that simple.

ECS seems more like a move away from OOP back into procedural/relational with splitting up data structs(components/tables) and algorithms done on whole sets of those(systems/procedures). Putting back methods into the components could then be the counter-backmove or just half-move by people hanging onto OOP.

This article series gives a good overview of this: http://t-machine.org/index.php/2007/09/03/entity-systems-are-the-future-of-mmog-development-part-1/

Those T-Machine posts are really good for explaining entity/component systems as used in games, but I really strongly disagree with almost everything he says about OO in the process of explaining ECS...

n.b. you can have a structure with public data that's operated on by a system in an OO design... And composition should be far more prevalent than inheritance (which should be quite rare) in OOD.

When OOP took off in games, we were all new to it, and frankly, we sucked. The popularity of ECS exploded out of the fact that we'd all written these stupid OO-inheritance based entity hierarchies, that had all sorts of downsides. Eventually, we realized this was a mistake, and after admitting that our entity-hierarchies were crap, there were two paths ahead:
1) assume this was simply because OO is crap, and move on to the next misunderstood fad.
2) go back and actually learn some OOD, while also learning ECS, DOD, etc...

The author has taken path 1. He's moved on from OOP, but never had the chance to see it used properly -- almost all of his criticisms are levelled at code that's written with an OOP language, but doesn't follow OOD rules. All of the benefits and advantages that he lists for ECS can also be achieved with well written OO code.

Also, the author should make some comparisons to the Protoype paradigm, as well as relational and OO, as many "entity template" or function-sharing-via-systems mechanisms draw a lot of inspiration from that paradigm.

As a farcical proof - ECS is often implemented within an OOP language like C++, which means its possible to reverse engineer the final code into an OO-design, which you can adapt and generalize to see how this kind of structure should exist in OO... When you do this, your ECS is basically reduced to a bloated message passing and serialization framework.

At this point, please note: OOP does not have this concept of multiple aspects; it hard-codes all the aspects into one glob, and declares that the set of behaviours and values of data to be the single-aspected Class of an Object. C++’s Multiple inheritance and Java’s Interfaces can get you a small part of the way towards the aspects of an ES, but they quickly collapse under the strain in fundamental ways that cannot be fixed within OOP.

This is what I mean - not only has he apparently never heard of the SRP, but when trying to replicate his ECS structure (based on composition), he jumps straight to inheritance in his OOP toolbox, fails, then blames OO. This is a straw man argument.

only OOP programmers want to give entities hierarchical names. It can tunr out a pretty dumb idea, if you think about it: it’s usually an implicit refusal to let go of those OOP ways we’re so used to thinking in

Again, (falsely) suggesting a strong link between OO and hierarchies.

An ES takes a system where there are many things going on that are all independent, which OOP tangles up together, and pulls them apart and lets them live on their own.

argh, no! The bad OOP entity hierarchies that we were writing a decade ago do this, but that's because we were all just ad-hoc'ing our way into OOP without bothering to really study OOD first! Good OO has all the tools to let all these independent components be small, decoupled and simple. The most important tool in the OOD toolbox turns out to be the same as in the ECS toolbox: composition.

As Greenspun said, ECS systems end up being based around an ad hoc, informally-specified, bug-ridden, slow implementation of half of SOLID ;-)
I dont actually thing ECS's are that bad, but I just hate the fact that so many people have failed to learn how to use composition and SOLID effectively in OO, but think that the answer is to learn these exact same tools in another paradigm...

This topic is closed to new replies.

Advertisement