Multiple objects create their own dependencies, which causes tight coupling and makes testing more difficult. An example is the rest server:
|
RestServer::RestServer(AsyncWebServer *server, Scheduler *scheduler) { |
|
this->scheduler = scheduler; |
|
|
|
module_service = new ModuleService(); |
|
plant_service = new PlantService(scheduler); |
This should be changed so the root file (main.cpp) or a dependency injection framework creates these and passes them in as references. Don't worry about the sensors in plant service for now, those will be fixed in #4.
Multiple objects create their own dependencies, which causes tight coupling and makes testing more difficult. An example is the rest server:
Firmware/src/restserver.cpp
Lines 15 to 19 in 881d03b
This should be changed so the root file (main.cpp) or a dependency injection framework creates these and passes them in as references. Don't worry about the sensors in plant service for now, those will be fixed in #4.