Suggestions needed on an architecture for a multiple clients and customisable web application

Our product is a web based course managemant system. We have 10+ clients and in future we may get more clients. (Asp.net,SQL Server)

Currently if one of our customers need extra functionality or customised business logic, we will change the db schema and code to meet the needs.

(we only have one branch code base and one database schema)

To make the change wont affect each others route, we use a client flag, which defined in a web config file, thus those extra fields and biz logic only applied to a particular customer’s system.

if(ClientId = 'ABC')
{
   //DO ABC Stuff
}
else
{
   //Normal Route
}

One of our senior colleagues said, in this way, small company like us can save resources on supporting multiple resources.

But what I feel is, this strategy makes our code and database even harder to maintain.

Anyone there crossed similar situation? How do you handle that?

3

Parameterize as much as you can first, of course.

Avoid writing:

if(customer == 'foo') {
  doBarCalculation();
}

, but rather write:

if(customer.usesBarCalculation) {
  doBarCalculation();
}

Use the Strategy pattern:

customer.getCalculation().doCalculation();

Customer {
  CalculationStrategy getCalculation();
}

CalculationStrategy {
  doCalculation();
}

; you can use Strategy at different scales; either offer many small, simple interfaces or a few large interfaces- it is worth thinking up the scale well; large interfaces tend to provoke code duplication between implementations (and code duplication is bad), while smaller interfaces are often harder to design in advance or increase complexity.

Create a company table in the database. Every user gets associated with a company. Here is some pseudo-SQL for company-customizations for displaying dates, time-zone, fiscal offset, and contact-person:

table user:
id
company_id
... other fields ...
foreign key (company_id)

table company:
id
date_format
time_zone
fiscal_offset
contact_person
... other customization fields ...

You probably need to query the user and company for most screens in order to test for customizations. Pulling a single record from the database for a screen should take no more than 5ms.

I understand that you don’t want to introduce complexity, but having company-specific code for each client littered through your application is already complexity. Better to incorporate this officially into your database model, than to wake up one day with 100 one-off company customizations littered throughout the code. At least this puts them all in one place, and by looking at these settings on the company-edit screen, your testers can easily see what they need to think about when testing for different companies.

3

The technique described is a good stop-gab solution but does not scale well. It’s okay if you only have a few cases.

I like both Alex’s and GlenPeterson’s solutions above

  1. Parameterization – make the different cases generalized and reusable. eq.: Allows international shipping (Y/N), or Break shipping tax out (Y/N).

  2. Database flag attributes – to record each customer’s preference

In addition to those techniques other things to consider:

  1. Separate codebases. Isolate core functionality into a single code base. Have customer customizations in a different codebase which uses the core code base. This can be difficult to set up – but allows you to freely develop both codebases independently. Having good tests on the core code base will help avoid breaking the customized code bases.

  2. Separate databases (one for each client), or Namespace your database tables (one table for each client)

  3. Use Separate Configuration Files for each Customer. Yaml is great for config files. This can be much lighter weight than putting all flags in the database – and allows you to easily edit it.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật