Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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!

share|improve this question
    
chat.stackoverflow.com/rooms/7/conversation/… "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 0:36

1 Answer 1

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.

share|improve this answer
    
WebProject2 hasn't been designed yet. WebProject1 exists, but I wanted to get opinions before I went any further. See new edit. –  J Child Apr 12 '11 at 11:08
    
Thanks for your answer btw. Really appreciate your experience. –  J Child 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. –  J Child Apr 12 '11 at 11:16
1  
Thank you S.Lott for your analysis of the ideas I had. I appreciate it. –  J Child Apr 13 '11 at 0:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.