0

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.

AJ Henderson
  • 1,120
  • 1
  • 12
  • 32
  • Your question sounds a little vague to me. Could you provide a small concrete examples? The question I would be interested in is along the lines of "what kind of changes to the code do I forsee in the near future, and what kind of design reduces the maintenance pain" – Samee Aug 24 '12 at 19:24
  • It's kind of a broad question. In general, I'm looking for a way to support application specific functionality while still using a shared core business layer between the applications with the application dependent differences abstracted out. A good example of two applications might be a front end website, a back end web service and a windows service. The exact needs and behavior of some of the business logic may differ slightly in the different applications, but most of the functionality will be common. – AJ Henderson Aug 24 '12 at 20:19
  • @AJHenderson Having helped you with your more recent question; sounds to me like you need interfaces here as well :P – Andras Zoltan Aug 30 '12 at 15:16

1 Answers1

0

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.

AJ Henderson
  • 1,120
  • 1
  • 12
  • 32