Pregunta

I've got a bit of a complex scenario that I'm stuck on trying to determine a good model for. The basic idea is that I have a business logic layer that is shared by multiple applications that work in the same domain. Certain minor functionality (such as security and available information) differs from one application to another.

I have an application specific class to be used within each application (as provided by a factory). This will ensure that within each application, the only loaded objects are of the type related to the current application.

The problem I've encountered is that if I have a core logic class B inheriting from a core logic class A and an application specific version of A, I need some way to get the application specific version of B to behave both in the ways it was changed for B and the way it was changed for A.

I realize this is a bit of a classic multiple inheritance problem, but I figured I would check here to see if anyone had any ideas for alternate models that would allow both application specific and core shared functionality.

My other alternative at this point is to simply disallow inheritance in any application specific code and require that any common application specific code be written in a shared library used by both non-related application specific leafs.

¿Fue útil?

Solución

The end result of this was that inheritance for each application needed to be limited to leafs and anything that is application specific across multiple leafs needed to be broken out to a class that could be contained. Not ideal, but the best that could be done without multiple inheritance.

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