If an entity is composed, is it still a god object?
Posted
by
Telastyn
on Programmers
See other posts from Programmers
or by Telastyn
Published on 2013-10-30T01:20:25Z
Indexed on
2013/10/30
4:12 UTC
Read the original article
Hit count: 150
I am working on a system to configure hardware. Unfortunately, there is tons of variety in the hardware, which means there's a wide variety of capabilities and configurations depending on what specific hardware the software connects to.
To deal with this, we're using a Component Based Entity design where the "hardware" class itself is a very thin container for components that are composed at runtime based on what capabilities/configuration are available. This works great, and the design itself has worked well elsewhere (particularly in games).
The problem is that all this software does is configure the hardware. As such, almost all of the code is a component of the hardware instance. While the consumer only ever works against the strongly typed interfaces for the components, it could be argued that the class that represents an instance of the hardware is a God Object.
If you want to do anything to/with the hardware, you query an interface and work with it.
So, even if the components of an object are modular and decoupled well, is their container a God Object and the downsides associated with the anti-pattern?
© Programmers or respective owner