应用框架 - 购买,构建还是同化?

时间:2022-06-24 11:36:59

I was curious as to what other shops are doing regarding base application frameworks? I look at an application framework as being able to provide additional or extended functionality to improve the quality of applications built from it.

我很好奇其他商店在基础应用程序框架方面做了些什么?我将应用程序框架视为能够提供额外的或扩展的功能,以提高从中构建的应用程序的质量。

There are a variety of out of the box frameworks, such as Spring (or Spring.NET), etc. I find that the largest problem with these being that they are not a la carte. Basically, they have too much functionality and unless every piece of that functionality is the best implementation available, chances are that you will end up using a patchwork of multiple frameworks to accomplish these tasks - causing bloat and confusion. This applies to free and commercial systems, in my opinion.

有各种各样的开箱即用框架,例如Spring(或Spring.NET)等。我发现这些最大的问题是它们不是单点菜单。基本上,它们具有太多的功能,除非每个功能都是可用的最佳实现,否则您最终可能会使用多个框架的拼凑来完成这些任务 - 导致膨胀和混乱。在我看来,这适用于免费和商业系统。

Of course, writing is largely re-inventing the wheel. I don't think it is without merit, though, as it provides the most customizable option. Some things are just too large to develop, though, and seem to be poorly implemented or not implemented at all in this case because of the hesitation to commit to the upfront costs of development.

当然,写作主要是重新发明*。但是,我不认为这是没有价值的,因为它提供了最可定制的选项。然而,有些事情太大而无法发展,而且在这种情况下似乎执行不力或根本没有实施,因为犹豫是否致力于开发的前期成本。

There are a large variety of open source projects that address individual portions of a could-be application framework as well. These can be adopted or assimilated (obviously depending upon license agreements) to help frame in a comprehensive framework from diverse sources.

有很多种开源项目可以解决可能的应用程序框架的各个部分。这些可以被采用或同化(显然取决于许可协议),以帮助构建来自不同来源的综合框架。

We approached the situation by looking at some of the larger concerns in our applications across the entire enterprise and came up with a list of valid cross-cutting concerns and recurring implementation issues. In the end, we came up with hybrid solution that is partially open source, partially based on existing open source options, and partially custom developed.

我们通过查看整个企业中我们的应用程序中的一些较大问题来处理这种情况,并提出了一系列有效的跨领域问题和反复出现的实施问题。最后,我们提出了部分开源的混合解决方案,部分基于现有的开源选项,部分定制开发。

A few examples of things that are in our framework:

我们框架中的一些事例:

  • Exception and event logging providers. A simple, uniform means by which every application can log exceptions and events in an identical fashion with a minimal coding effort. Out of the box, it can log to a SQL Server, text file, event viewer, etc. It contains extensibility points to log to other sources, as well.
  • 异常和事件日志记录提供程序。一种简单,统一的方法,每个应用程序都可以通过最少的编码工作以相同的方式记录异常和事件。开箱即用,它可以登录到SQL Server,文本文件,事件查看器等。它还包含可扩展点以记录到其他源。

  • Variable assignment enforcement. A generic class that exposes extension methods based upon the object type, using a syntax that is inspired by JUnit. For example, to determine if myObject is not null, we can do a simple Enforce.That(myObject).IsNotNull(); or determine if it is a specific type by doing a simple Enforce.That(myObject).IsOfType(typeof(Hashtable)); Enforcement failures raise the appropriate exception, both reducing the amount of code and providing consistency in implementation.
  • 变量赋值执行。一种泛型类,它使用受JUnit启发的语法,基于对象类型公开扩展方法。例如,要确定myObject是否为null,我们可以执行一个简单的Enforce.That(myObject).IsNotNull();或者通过做一个简单的Enforce来确定它是否是一个特定的类型。那个(myObject).IsOfType(typeof(Hashtable));执行失败会引发相应的异常,既减少了代码量又提供了实现的一致性。

  • Unit testing helpers. A series of classes, based upon reflection that can automatically test classes and their properties. (Inspired by Automatic Class Tester from CodePlex) but written from the ground up. Helps to simplify the creation of unit tests for things that are traditionally hard or time-consuming to test.
  • 单元测试助手。一系列基于反射的类,可以自动测试类及其属性。 (灵感来自CodePlex的Automatic Class Tester),但是从头开始编写。有助于简化为传统上难以测试或耗费时间测试的单元测试的创建。

We have also outright adopted some other functionality, as is. For example, we are using PostSharp for AOP, moq for mocking, and autofaq for DI.

我们也直接采用了其他一些功能。例如,我们使用PostSharp进行AOP,moq进行模拟,使用autofaq进行DI。

Just wondering what other people might have done and what concerns your framework addresses that you did not find tooling that you were satisfied with? As for our experience, we are definitely reaping the benefits of the new framework and are content with the approach that we have taken.

只是想知道其他人可能做了什么以及您的框架解决了哪些问题,而您没有找到您满意的工具?至于我们的经验,我们肯定会从新框架中获益,并对我们采取的方法感到满意。

2 个解决方案

#1


1  

Our approach was to devote an entire team of architects (namely 'Technical Architects') for:

我们的方法是将整个建筑师团队(即“技术架构师”)用于:

  • either adapting existing open-source framework, in some case encapsulating them in an in-house API in order to be able to change framework should the need arise
  • 要么调整现有的开源框架,在某些情况下将它们封装在内部API中,以便在需要时能够更改框架

  • or creating new framework based on the specific needs found a several teams for several projects.
  • 或者根据具体需求创建新框架,为几个项目找到了几个团队。

Whatever the approach, those frameworks need to be very well documented (at least with a complete public API), and their release need to be well advertised:
Since all teams will based their work on those frameworks, they need to upgrade their versions of framework as soon as possible, in order to build their own deliveries.

无论采用何种方法,这些框架都需要有很好的文档记录(至少使用完整的公共API),并且需要很好地宣传它们的发布:由于所有团队都将基于这些框架,他们需要升级他们的框架版本尽快,以建立自己的交付。

#2


1  

My simple advice is that you use a framework that suits your needs. Of course, in order to do this you have to experiment and know beforehand what are you looking for. Even if the framework comes with much more than you need, what is the cost of this? For the average problem, the cost is only a few extra Mbs in a jar, which I think is OK for most projects.

我的简单建议是使用适合您需求的框架。当然,为了做到这一点,你必须事先试验并知道你在寻找什么。即使框架提供的内容远远超过您的需求,但这个成本是多少?对于普通问题,罐子里的成本只有几个额外的Mbs,我认为对大多数项目来说都是可以的。

In the end, you should choose a framework that does the job right, so that your focus is at providing user value and easing the maintenance of the developer. Of course, there isn't a single framework that addresses everyone's problems, but there are some frameworks that hit the sweet spot on what they aim for. It's all a matter of going with the best compromise.

最后,您应该选择一个能够正确完成工作的框架,以便您专注于提供用户价值并简化开发人员的维护。当然,没有一个框架可以解决每个人的问题,但是有一些框架可以达到他们的目标。这一切都与最好的妥协有关。

#1


1  

Our approach was to devote an entire team of architects (namely 'Technical Architects') for:

我们的方法是将整个建筑师团队(即“技术架构师”)用于:

  • either adapting existing open-source framework, in some case encapsulating them in an in-house API in order to be able to change framework should the need arise
  • 要么调整现有的开源框架,在某些情况下将它们封装在内部API中,以便在需要时能够更改框架

  • or creating new framework based on the specific needs found a several teams for several projects.
  • 或者根据具体需求创建新框架,为几个项目找到了几个团队。

Whatever the approach, those frameworks need to be very well documented (at least with a complete public API), and their release need to be well advertised:
Since all teams will based their work on those frameworks, they need to upgrade their versions of framework as soon as possible, in order to build their own deliveries.

无论采用何种方法,这些框架都需要有很好的文档记录(至少使用完整的公共API),并且需要很好地宣传它们的发布:由于所有团队都将基于这些框架,他们需要升级他们的框架版本尽快,以建立自己的交付。

#2


1  

My simple advice is that you use a framework that suits your needs. Of course, in order to do this you have to experiment and know beforehand what are you looking for. Even if the framework comes with much more than you need, what is the cost of this? For the average problem, the cost is only a few extra Mbs in a jar, which I think is OK for most projects.

我的简单建议是使用适合您需求的框架。当然,为了做到这一点,你必须事先试验并知道你在寻找什么。即使框架提供的内容远远超过您的需求,但这个成本是多少?对于普通问题,罐子里的成本只有几个额外的Mbs,我认为对大多数项目来说都是可以的。

In the end, you should choose a framework that does the job right, so that your focus is at providing user value and easing the maintenance of the developer. Of course, there isn't a single framework that addresses everyone's problems, but there are some frameworks that hit the sweet spot on what they aim for. It's all a matter of going with the best compromise.

最后,您应该选择一个能够正确完成工作的框架,以便您专注于提供用户价值并简化开发人员的维护。当然,没有一个框架可以解决每个人的问题,但是有一些框架可以达到他们的目标。这一切都与最好的妥协有关。