What is the design approach for this problem statement?

52 views Asked by At

Currently there are 200 customers and each of them have their own code base which has almost exact same code. The level of differences are as follows

  1. There are values in app.config and based on that the Business logic varies for each customer.
  2. The different methods have different code. For example, for client 1 the code to processSectionA might be different thant the processSectionA for client 2.

The requirement is to write a the same code for all the 200 customers to handle this level of customization. Let's say we onboard a new customer tomorrow, it should be done smoothly without anycode changes. Some JSON changes should be fine.

Things that a customer has ( app.config values,and their own business logic)

Can anyone help me with any approach, I can only think of an abstract factory and in that we can have different implementation for different customers. But this won't solve the problem of minimum code changes when we onboard a new customer as we need to add the logic in the code itself.

1

There are 1 answers

0
Matt Timmermans On

Your requirements are a little misguided. The way you implement the open-closed principle, which is what you want (the behavior of your software can be extended without modification) is via the dependency inversion, and that means that you let each customer provide its own code to handle things you haven't thought of.

This only works when you let customers provide code, because there is no limit on what code can do. If you only let customers provide JSON, and you don't want your code to change for new customers, then your code has to implement everything that any customer could possibly want. You don't want that job.

You should change your approach to design, and stop trying to be the boss of your customers. Make your software modular, so they can take or leave whatever parts they want, connect it together in ways you haven't anticipated, and use it for solving problems you haven't though of. Provide solutions to the problems you want to solve instead of making everything your business.