-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rethink how entity dependencies work #30
Comments
Hi @infeeee, been busy these days. I think the choice will be to keep Entity dependencies so I'll create a flow to initialize everything in the correct order.
|
Ok, thanks, no rush. I just had too much free time nowadays. The main problem, I don't understand what is the point of dependencies. They are only checked during It seems they add a huge avoidable complexity to the code. Remember the KISS principle. I will create proof of concept to show what I'm trying to say. |
I think the current flow is not really efficient, and not easily maintainable.
The problems:
Initialize()
andPostInitialize()
. it's easy to miss it accidentally, and init flow differ between entities, but it could be similar. SometimesRegisterEntitySensor()
is inInitialize()
sometimes it's inPostInitialize()
. Chaotic.de
andos
) are actually just providing static information, which usually shouldn't change at all.MyApp.App
also provides static data, but it's not an Entity but a separate submodule.Possible solutions:
A:
Remove the whole dependency system. Move all the base methods to submodules, just like
MyApp
. Convertos
andde
entities similar toAppInfo
. If in the future some part of an Entity needed in another one, move that methods to a submodule, or create the new entity as a subclass.Maybe this new module could be merged with
MyApp
, to create a single source for all static info. I recommend this solution.This solution could also help with the config flow, as elements not available could be hidden from the list.
B:
Build correct dependency chain in EntityManager. Evaluate which entity depends on which and initialize them in the correct order.
What do you think @richibrics ? What is your plan with the dependency system?
The text was updated successfully, but these errors were encountered: