What is a good solution structure to allow easy customisation of a product on a per client basis?

后端 未结 2 399
春和景丽
春和景丽 2021-02-06 01:43

I am looking for some advice on how to allow easy customisation and extension of a core product on a per client basis. I know it is probably too big a question. However we reall

2条回答
  •  长情又很酷
    2021-02-06 02:01

    I just worried that with 30 or 40 versions (most of which aren't that different) branching was adding complexity.


    +1 Great question, its more of a business decision you'll have to make:

    Do I want a neat code-base where maintenance is easy and features and fixes get rolled out quickly to all our customers

    or do I want a plethora of instances of one codebase split up, each with tiny tweaks that is hard (EDIT: unless your a ALM MVP who can "unbrand" things) to merged into a trunk.


    I agree with almost everthing @Nockawa mentioned except IMHO dont substitute extending your code architecture with branches.

    Definitely use a branch/trunk strategy but as you mentioned too many branches makes it harder to quickly roll-out site wide features and hinder project-wide continuous integration. If you wish to prevent copy/pasting limit the number of branches.

    In terms of a coding solution here is what I believe you are looking for:

    • Modules/Plug-ins, Interfaces and DI is right on target!
    • Deriving custom classes off base ones (extending the DSL per customer, Assembly.Load())
    • Custom reporting solution (instead of new pages a lot of custom requests could be reports)
    • Pages with spreadsheets (hehe I know - but funnily enough it works!)

    Great examples of the module/plugin point are CMS's such as DotNetNuke or Kentico. Other idea's could be gained by looking at Facebook's add-in architecture, plugin's for audio and video editing, 3D modeling apps (like 3DMax) and games that let you build your own levels.

    The ideal solution would be a admin app that you can choose your modules (DLL's), tailor the CSS (skin), script the dB, and auto-deploy the solution upto Azure. To acheive this goal plugin's would make so much more sense, the codebase wont be split up. Also when an enhancement is done to a module - you can roll it out to all your clients.

    You could easily do small customisations such as additional properties on domain model, viewmodel and view etc with user controls, derived classes and function overrides.

    Do it really generically, say a customer says I want to a label that tally's everyone's age in the system, make a function called int SumOfField(string dBFieldName, string whereClause) and then for that customers site have a label that binds to the function. Then say another customer wants a function to count the number of product purchases by customer, you can re-use it: SumOfField("product.itemCount","CustomerID=1").

    More significant changes that require entirely new domain models and controllers etc would fit the plug-in architecture. An example might be a customer needs a second address field, you would tweak your current Address user-control to be a plug-in to any page, it would have settings to know which dB table and fields it can implement its interface to CRUD operations.

    If the functionality is customised per client in 30-40 branches maintainability will become so hard as I get the feeling you wont be able to merge them together (easily). If there is a chance this will get really big you dont want to manage 275 branches. However, if its that specialised you have to go down to the User-Control level for each client and "users cant design their own pages" then having Nockawa 's branching strategy for the front-end is perfectly reasonable.

提交回复
热议问题