5

We have the following setup

Current Solution:

  • Business Logic (Class Library)

  • Data Layer (Class Library containing EF,Web Services wrappers etc)

  • WebProject1

BUT we now want to write another Web Project (Web Project2) which would be almost identical to WebProject1 except for the fact that it would alter properties and input variables to functions/voids inside the Business Logic class to provide a different set of data for another completely different user. (Needs rewording). Think of Facebook as WebProject1 and Myspace as WebProject2. Same concept, same business layer almost but different products altogether.

Future Soltion

  • Business Logic (Class Library)

  • Data Layer (Class Library containing EF,Web Services wrappers etc)

  • WebProject1

  • WebProject2 (similar to WebProject1 but different authentication, different UI, different pages etc)

  • WebProject3 (possible)

Without completely destroying the Business Logic (as the class would now have to allow for 2 paths per set of input variables) how can we structure this to aviod doubling up on any code?

Edit: Explain the business logic

WebProject1 provides data based on a database filter called "ByCompany"

WebProject2 will provide the data based on a filter called "BySite Both projects will be consumed by different audiences which will not know that the other website exists.

Eg possible future logic could include something like this:

BusinessLogic.EmployeeList employeeList = new BusinessLogic.EmployeeList();

employeeList.LoadBySite("ConstructionSiteC");

employeeList.LoadByCompany("JohnDoesTractors");

The dilemma is:

Should we maintain two Business Logic class libraries? Should we add preffixes to the class names to denote their corresponding WebProject parent? Should we create base classes and inherit if there are overrides we need to make? Should we create more interface based business logic? Should we just have two separate solutions that draw from the same DAL?

The projects will likely get quite large (over business logic 300 classes) and we want to minimize double ups as much as possible. What is the your method or suggestion?

Thankyou!

Jeremy
  • 271
  • 2
  • 10
  • http://chat.stackoverflow.com/rooms/7/conversation/http-programmers-stackexchange-com-questions-67470-feedback-and-discussion "Just use namespaces to highly regiment what you want since you're providing it to the end-tier as a compiled dll" – jcolebrand Apr 13 '11 at 00:36

1 Answers1

8

except for the fact that it would alter properties and input variables to functions/voids inside the Business Logic class to provide a different set of data for another completely different user

That's just a design mistake. Nothing more.

Fix it first.

Then simply share the business logic between the two web applications.


Should we maintain two Business Logic class libraries?

Never.

Should we add preffixes to the class names to denote their corresponding WebProject parent?

No.

Should we create base classes and inherit if there are overrides we need to make?

That's why inheritance was invented.

Do that. Do a lot of that.

Should we create more interface based business logic?

Perhaps. Interfaces can be appropriate if the business logic classes are wildly different.

Should we just have two separate solutions that draw from the same DAL?

No. Too low-level an approach.

S.Lott
  • 45,264
  • 6
  • 90
  • 154
  • WebProject2 hasn't been designed yet. WebProject1 exists, but I wanted to get opinions before I went any further. See new edit. – Jeremy Apr 12 '11 at 11:08
  • Thanks for your answer btw. Really appreciate your experience. – Jeremy Apr 12 '11 at 11:11
  • @Jeremy Child: "It hasn't been designed yet"? What is "It"? You said you needed to make changes so you could share the business layer. Make the changes. Share the business layer. – S.Lott Apr 12 '11 at 11:12
  • @S.Lott Sorry for being vague with "it". "it" is WebProject2. – Jeremy Apr 12 '11 at 11:16
  • @J Child: "WebProject2 hasn't been designed yet". "WebProject2 provides the data based on a filter called..." confuses me. Either it's been designed and you know what you can share. Or it hasn't been designed and you know nothing. If you don't know **all** the details then "WebProject2 hasn't been designed yet" appears to be a very misleading description of what you know and don't know. – S.Lott Apr 12 '11 at 12:48
  • 1
    Thank you S.Lott for your analysis of the ideas I had. I appreciate it. – Jeremy Apr 13 '11 at 00:58