November 11th, 2010, 08:39 PM
Maintaining variants of an application
We have a product which is being slightly customized for each client. The exact customization is unpredictable - we assume that any point in the code can become needing change. However, we want to keep one code base, as 90+% of the code will be identical, so we don't have to merge every update or new feature to each client separately.
How can this be done?
The project is written in OO PHP with the Yii framework.
Basically, we would like something like this: Every client will have a folder with a 'mirror' of the code. That 'mirror' will include only those classes customized for the client. Than, at runtime, the clients identity will be known, and every mention of classes name will be resolved to the generic version of the class - if no client specific version exists for this client, or to the client customized version of that class - if such a version does exist.
I'll appreciate comments about the general design question.
Any comments on the above solution.
Are there other ways to achieve what I want to achieve?
Maybe some code generation tool for generating the client specific version from the current main code?
And also there is the implementation question. How can this be implemented in PHP and Yii? (I'm not sure that this is the right place to ask about implementation. Please ignore this part of my question if it's not)
I thought first to use PHPs __autoload. However, it will anyway choose only one version of the class. And this is a problem, because we'll need to choose the client specific version every time except of one: when defining the client specific version of the class, we will extend the general purpose version of that class. So classes version can not be resolved at the loading time, both need to be loaded, and the client specific will be used every time except of one.
November 29th, 2010, 09:24 AM
auto load appears to be able to load what ever you choose and it will catch errors as ther arise giving you the chance to correct before errors stop the code running
is it therfore not the case that a client identified loader would attempt to load all the required classes etrc and default to the generic if it fails...
so load client_input oops load input ...
I think thats what is meant here?