Pregunta

I develop a game engine in XNA. This engine has some modules (subprojects), such as Renderer, StateManagement, etc.

Refering to Dependency Inversion Principle: "High-level modules should not depend on low-level modules. Both should depend on abstractions." My question is: Where should I put those abstractions in practice? Should I create some projects with groups of corresponding abstractions, or create one project with all the abstractions of my engine? The first solution will mess up my project structure, the second one will demand creation of project with tons of abstract classes with all other projects depending on it. Maybe there's a better solution?

¿Fue útil?

Solución

Although sometimes people do put their interfaces in separate projects, often the interfaces are simply placed side-by-side their implementations. One could argue that using separate projects ensures that one codes to those interfaces, but I find it is better to rely on discipline and dependency discovery tools to ensure you code to interfaces.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top