-2

Ok so first I want to describe the anti-pattern anti-practice.

Company creates system for customer number 1. Then customer number 2 comes along they fork the codebase customize it. (Say for variations in customer number 2s country) Rinse and repeat for the next 14 customers.

Now to add an new feature needs to be repeated 16 times. Very expensive!

Let's say you get to rewind the clock back to starting work for customer number 2.

What patterns or practices can be used to keep one core code base which can service many different customers/countries, but with some quite divergent requirements?

I am not looking for implementations, but for abstract patterns that can be applied to any system

DarcyThomas
  • 119
  • 5
  • 3
    Does this answer your question? [How to maintain different, customized versions of the same software for multiple clients](https://softwareengineering.stackexchange.com/questions/60393/how-to-maintain-different-customized-versions-of-the-same-software-for-multiple) – Philip Kendall Aug 18 '20 at 08:43
  • @PhilipKendall Partly. That one is asking how to build several versions. I am looking for higher level patterns and practices. – DarcyThomas Aug 18 '20 at 09:02
  • 2
    Can you elaborate on how the recommendations (namely project separation and dependency injection), given in [the highest voted answer](https://softwareengineering.stackexchange.com/a/60567/177827) from the question that @Philip linked to, do not apply to your situation? Have you already tried those? – null Aug 18 '20 at 09:36
  • 2
    How is this different from abstracting code instead of copy/paste/adjusting it? Identify the reusable parts and make them reusable. – Flater Aug 18 '20 at 10:14
  • 4
    Sorry, but [list-of-things questions](https://softwareengineering.meta.stackexchange.com/questions/7537/why-do-some-examples-and-list-of-things-questions-get-closed) are not well received by our community. Specificially ["shopping for patterns"](https://softwareengineering.meta.stackexchange.com/questions/8492/how-bad-are-shopping-for-patterns-type-questions) is very unpopular. – Doc Brown Aug 18 '20 at 11:04

1 Answers1

2

What you need is a core and modules.

The core will contain all of the functionality that is common to every tenant.

Modules will also contain common functionality, but can be customized to each tenant, and there will be modules that are specific to particular tenants.

Hence, you need a "modular" system.

There are several technical solutions for modularity, in particular plugin systems. Most modern programming languages use interfaces. I suggest you begin by researching those.

Making a database multi-tenant can be as simple as adding a TenantID field to each table.

Robert Harvey
  • 198,589
  • 55
  • 464
  • 673