维护应用程序的变体 [英] Maintaining variants of an application

查看:47
本文介绍了维护应用程序的变体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一种产品,针对每个客户进行了轻微的定制.确切的定制是不可预测的——我们假设代码中的任何一点都可能需要更改.但是,我们希望保留一个代码库,因为 90+% 的代码将是相同的,因此我们不必将每个更新或新功能分别合并到每个客户端.

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.

如何做到这一点?

该项目是用 PHP 编写的,带有 Yii 框架.

The project is written in 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?

还有实施问题.这如何在 PHP 和 Yii 中实现?

And also there is the implementation question. How can this be implemented in PHP and Yii?

我首先想到的是使用 PHP __autoload.但是,无论如何它只会选择该类的一个版本.这是一个问题,因为我们每次都需要选择客户端特定版本,除了一个:在定义类的客户端特定版本时,我们将扩展该类的通用版本.所以在加载时无法解析classes版本,两者都需要加载,除了一个之外,每次都会使用客户端特定的.

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.

谢谢

推荐答案

think svn, cvs, git, 所有这些版本控制系统帮助您将代码分支,主干,标记到每个客户项目

think svn, cvs, git, all these versioning control system help u to branch, trunk, tag for your code to each clients projects

这篇关于维护应用程序的变体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆