tengen-io / server

:white_circle: Server implementation of the board game Go
MIT License
13 stars 4 forks source link

wire resolver dependencies directly #34

Closed eaceaser closed 5 years ago

eaceaser commented 5 years ago

So when refactoring things I noticed the pattern to throw certain dependencies, such as the database, etc. into the context. This is kinda a code smell, mainly because we lose alot of compiler-enforced type safety, as we have to do typecasting in order to pull things out of the context.

Dependencies, such as the database model, should be wired through via struct constructors; this allows type-safe usage of said dependencies without having to assume that they exist in the context.