The company where I am currently employed is struggling with an architectural decision for our range of applications. At the moment we have a couple applications that have common parts (think like a calendar module). Until now we kept on copying code from other existing application, but in the future we want to evolve our applications to a more modular design:
我目前就业的公司正在努力应对我们的应用范围的架构决策。目前我们有几个具有共同部分的应用程序(想象日历模块)。到目前为止,我们一直在复制其他现有应用程序的代码,但是在未来我们希望将应用程序发展为更加模块化的设计:
As you can see in the picture above it is possible to have different versions of modules per application.
如上图所示,每个应用程序可能有不同版本的模块。
We are considering to possible solutions:
我们正在考虑可能的解决方案:
- Building a core application framework where we can install our modules in. We're think about a tool like Nuget to accomplish this.
- 构建一个核心应用程序框架,我们可以在其中安装我们的模块。我们考虑像Nuget这样的工具来实现这一目标。
- Building one application where all our modules are included in (=one code base), but the customer only gets the functionality that is activated for him. We're forseeing some problems with versioning here.
- 构建一个应用程序,其中所有模块都包含在(=一个代码库)中,但客户只获得为他激活的功能。我们在这里预测版本化的一些问题。
Any suggestions on this? We can't be the first company who struggles with this problem?All our applications are ASP.NET MVC 4/5 web applications, built with Razor Templates or JavaScript templates (knockout.js). All of our applications are deployed on Microsoft Azure and we have extensive inhouse knowledge of buildscripts (MSBuild), CI Servers...
有什么建议吗?我们不能成为第一家遇到这个问题的公司吗?我们所有的应用程序都是使用Razor模板或JavaScript模板(knockout.js)构建的ASP.NET MVC 4/5 Web应用程序。我们所有的应用程序都部署在Microsoft Azure上,我们拥有丰富的内部知识(MSBuild),CI服务器......
2 个解决方案
#1
8
Having separate project/assembly for each module and delivering it as Nuget package is definitely a good strategy.
为每个模块分别进行项目/组装并将其作为Nuget包交付绝对是一个很好的策略。
Advantage:
优点:
- Can maintain and release multiple version. Different client get different version.
- 可以维护和发布多个版本。不同的客户获得不同的版本
- Installation of latest or specific version supported through Nuget. This helps during development where App A developer can target 2.0 version of module A while App B developer can target 1.0.
- 通过Nuget支持安装最新或特定版本。这有助于开发期间App A开发人员可以定位模块A的2.0版本,而App B开发人员可以定位1.0。
- Single source base with separate branches for each version. Client using 1.0 request a change will get code from branch 1.0 with just the fix requested.
- 单一源代码库,每个版本都有单独的分支。使用1.0请求更改的客户端将从分支1.0获取代码,仅提供所请求的修复。
- Each module can be released or updated independently.
- 每个模块都可以独立发布或更新。
Challenges:
挑战:
-
During development debugging assembly code that's installed using Nuget. Nuget supports it inbuilt. We achieved it in our case (Framework being used by multiple platform).
在开发期间调试使用Nuget安装的汇编代码。 Nuget支持它内置。我们在我们的案例中实现了它(框架被多个平台使用)。
-
Code changes required in module code (a bug or a new feature required). Well this is tricky:
模块代码中所需的代码更改(需要错误或新功能)。这很棘手:
Option 1: Same developer just go ahead and make that change, create new package and install new version in his app. Got to authorize the change as it is critical code.
选项1:相同的开发人员继续进行更改,创建新包并在他的应用程序中安装新版本。必须授权更改,因为它是关键代码。
Option 2: A designated team responsible to fix issue or change request in framework code.
选项2:指定的团队负责修复框架代码中的问题或变更请求。
#2
2
You can also try using the plugin architecture, just build the different modules that makes up the application as a plugin, then build the module that is required for every application as a single code base. In this case, installing a component for any particular user, will be a matter of adding or pulling out plugins. Many large projects makes you of this particular architecture as it reduces copy and paste, increases and reuse and speed of development. You can check nopcommerce an open source project for an idea of how it is done.
您还可以尝试使用插件体系结构,只需将构成应用程序的不同模块构建为插件,然后将每个应用程序所需的模块构建为单个代码库。在这种情况下,为任何特定用户安装组件将是添加或拔出插件的问题。许多大型项目使您了解这种特定的体系结构,因为它减少了复制和粘贴,增加和重用以及开发速度。您可以查看nopcommerce一个开源项目,了解它是如何完成的。
#1
8
Having separate project/assembly for each module and delivering it as Nuget package is definitely a good strategy.
为每个模块分别进行项目/组装并将其作为Nuget包交付绝对是一个很好的策略。
Advantage:
优点:
- Can maintain and release multiple version. Different client get different version.
- 可以维护和发布多个版本。不同的客户获得不同的版本
- Installation of latest or specific version supported through Nuget. This helps during development where App A developer can target 2.0 version of module A while App B developer can target 1.0.
- 通过Nuget支持安装最新或特定版本。这有助于开发期间App A开发人员可以定位模块A的2.0版本,而App B开发人员可以定位1.0。
- Single source base with separate branches for each version. Client using 1.0 request a change will get code from branch 1.0 with just the fix requested.
- 单一源代码库,每个版本都有单独的分支。使用1.0请求更改的客户端将从分支1.0获取代码,仅提供所请求的修复。
- Each module can be released or updated independently.
- 每个模块都可以独立发布或更新。
Challenges:
挑战:
-
During development debugging assembly code that's installed using Nuget. Nuget supports it inbuilt. We achieved it in our case (Framework being used by multiple platform).
在开发期间调试使用Nuget安装的汇编代码。 Nuget支持它内置。我们在我们的案例中实现了它(框架被多个平台使用)。
-
Code changes required in module code (a bug or a new feature required). Well this is tricky:
模块代码中所需的代码更改(需要错误或新功能)。这很棘手:
Option 1: Same developer just go ahead and make that change, create new package and install new version in his app. Got to authorize the change as it is critical code.
选项1:相同的开发人员继续进行更改,创建新包并在他的应用程序中安装新版本。必须授权更改,因为它是关键代码。
Option 2: A designated team responsible to fix issue or change request in framework code.
选项2:指定的团队负责修复框架代码中的问题或变更请求。
#2
2
You can also try using the plugin architecture, just build the different modules that makes up the application as a plugin, then build the module that is required for every application as a single code base. In this case, installing a component for any particular user, will be a matter of adding or pulling out plugins. Many large projects makes you of this particular architecture as it reduces copy and paste, increases and reuse and speed of development. You can check nopcommerce an open source project for an idea of how it is done.
您还可以尝试使用插件体系结构,只需将构成应用程序的不同模块构建为插件,然后将每个应用程序所需的模块构建为单个代码库。在这种情况下,为任何特定用户安装组件将是添加或拔出插件的问题。许多大型项目使您了解这种特定的体系结构,因为它减少了复制和粘贴,增加和重用以及开发速度。您可以查看nopcommerce一个开源项目,了解它是如何完成的。