有人有 CSLA 的实际经验吗?

Does anyone have any real-world experience of CSLA?(有人有 CSLA 的实际经验吗?)

本文介绍了有人有 CSLA 的实际经验吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我公司的主要 Web 应用程序迫切需要一组漂亮的库,以使其以某种方式可维护和可扩展,我的一位同事建议使用 CSLA.所以我买了这本书,但是:

The main web application of my company is crying out for a nifty set of libraries to make it in some way maintainable and scalable, and one of my colleagues has suggested CSLA. So I've bought the book but as :

程序员不再读书了

我想评估一下 SOFlow 社区对它的看法.

I wanted to gauge the SOFlow community's opinion of it.

所以这是我的问题:

  1. 人们如何使用 CSLA?
  2. 有什么优点和缺点?
  3. CSLA 真的不适合 TDD 吗?
  4. 我有哪些替代方案?
  5. 如果您已停止使用它或决定不使用它,原因是什么?

推荐答案

在具体回答你的问题之前,我想先谈谈一些想法.CSLA 适合您的项目吗?这取决于.对于不将单元测试视为高优先级的基于桌面的应用程序,我个人会考虑使用 CSLA.如果您想轻松扩展到 n 层应用程序,CSLA 非常棒.CSLA 往往会受到一些批评,因为它不允许纯粹的单元测试.这是真的,但是就像技术中的任何事情一样,我相信没有一种真正的方式.单元测试可能不是您为特定项目进行的事情.适用于一个团队和一个项目的方法可能不适用于另一个团队或其他项目.

Before I specifically answer your question, I'd like to put a few thoughts down. Is CSLA right for your project? It depends. I would personally consider CSLA for desktop based applications that does not value unit testing as a high priority. CSLA is great if you want to easily scale to an n-tier application. CSLA tends to get some flack because it does not allow pure unit testing. This is true, however like anything in technology, I believe that there is No One True Way. Unit testing may not be something you are undertaking for a specific project. What works for one team and one project may not work for another team or other project.

关于 CSLA 也存在许多误解.它不是 ORM.它不是 NHibernate 的竞争对手(实际上使用 CLSA Business Objects 和 NHibernate 作为数据访问非常适合).它形式化了移动对象的概念.

There are also many misconceptions in regards to CSLA. It is not an ORM. it is not a competitor to NHibernate (in fact using CLSA Business Objects & NHibernate as data access fit really well together). It formalises the concept of a Mobile Object.

1.有多少人在使用 CSLA?
基于 CSLA 论坛,我想说有很多基于 CSLA 的项目那里.不过老实说,我不知道有多少人实际使用它.我过去曾在两个项目中使用过它.

1. How many people are using CSLA?
Based on the CSLA Forums, I would say there are quite a number of CSLA based projects out there. Honestly though, I have no idea how many people are actually using it. I have used it in the past on two projects.

<强>2.有什么好处和坏处?
虽然很难在一个简短的列表中进行总结,但这里有一些我想到的优点/缺点.
优点:

  • 很容易让新开发者上手加速.CSLA 书籍和样本应用是加快速度的绝佳资源.
  • 验证框架确实是世界级的 - 并且已被许多其他非 CSLA 项目和技术借用".
  • 在您的业务对象中进行 n 级撤消
  • 为 n 层可扩展性更改配置行(注意:甚至不是需要重新编译)
  • 关键技术是从真实"代码中抽象出来的.当 WCF 是介绍,它对CSLA 代码.
  • 可以在 Windows 和 Web 项目之间共享您的业务对象.
  • CSLA 提倡行为的规范化,而不是数据的规范化(让数据库进行数据规范化).
  • It's easy to get new developers up to speed. The CSLA book and sample app are great resources to get up to speed.
  • The Validation framework is truly world class - and has been "borrowed" for many many other non-CSLA projects and technologies.
  • n-Level Undo within your business objects
  • Config line change for n-Tier scalability (Note: not even a recompile is necessary)
  • Key technologies are abstracted from the "real" code. When WCF was introduced, it had minimal impact on CSLA code.
  • It is possible to share your business objects between windows and web projects.
  • CSLA promotes the normalization of behaviour rather than the normalization of data (leaving the database for data normalization).

缺点:

  • 单元测试困难
  • 缺乏关注点分离(通常您的业务对象内部有数据访问代码).
  • 由于 CSLA 促进行为的规范化,而不是数据的规范化,这可能导致业务对象名称相似,但用途不同.这可能会导致一些混乱和感觉就像你没有适当地重用对象.话虽如此,一旦实现了生理上的飞跃,它就更有意义了 - 以旧"方式构造对象似乎不合适.
  • 以这种方式构建应用程序并不流行".您可能很难找到对这项技术充满热情的开发人员.
  • Difficulty in unit testing
  • Lack of Separation of Concern (generally your business objects have data access code inside them).
  • As CSLA promotes the normalization of behavior, rather than the normalization of data, and this can result in business objects that are named similarly, but have different purposes. This can cause some confusion and a feeling like you are not reusing objects appropriately. That said, once the physiological leap is taken, it more than makes sense - it seems inappropriate to structure objects the "old" way.
  • It's not "in fashion" to build applications this way. You may struggle to get developers who are passionate about the technology.

3.看完这篇CSLA真的不适合TDD吗?
我还没有找到使用 CSLA 进行 TDD 的有效方法.也就是说,我相信有很多比我更聪明的人可能已经尝试过这个并取得了更大的成功.

3. After reading this does CSLA really not fit in with TDD?
I haven't found an effective way to do TDD with CSLA. That said, I am sure there are many smarter people out there than me that may have tried this with greater success.

4.我的替代方案是什么?
领域驱动设计目前正在得到大力推动(理所当然地——这对于某些应用程序来说太棒了).从引入 LINQ(以及 LINQ to SQL、实体框架等)开始,还发展出许多有趣的模式.Fowlers 的书 PoEAA,详细介绍了许多可能适用的模式为您的应用程序.请注意,某些模式是相互竞争的(即 Active Record 和 Repository),因此旨在用于特定场景.虽然 CSLA 与该书中描述的任何模式都不完全匹配,但它与 Active Record 最相似(尽管我认为声称与该模式完全匹配是短视的).

4. What are my alternatives?
Domain-Driven-Design is getting big push at the moment (and rightfully so - it's fantastic for some applications). There are also a number of interesting patterns developing from the introduction of LINQ (and LINQ to SQL, Entity Framework, etc). Fowlers book PoEAA, details many patterns that may be suitable for your application. Note that some patterns are competing (i.e. Active Record and Repository), and thus are meant to be used for specific scenarios. While CSLA doesn't exactly match any of the patterns described in that book, it most closely resembles Active Record (although I feel it is short-sighted to claim an exact match for this pattern).

5.如果您已经停止使用它或决定不使用它,为什么?
对于我的上一个项目,我没有完全推荐 CSLA,因为我认为应用程序的范围对于 CSLA 提供的好处来说太大了.
不会在 Web 项目中使用 CSLA.我觉得还有其他技术更适合在那种环境中构建应用程序.

5. If you have stopped using it or decided against why?
I didn't fully recommend CSLA for my last project, because I believe the scope of the application is too large for the benefits CSLA provides.
I would not use CSLA on a web project. I feel there are other technologies better suited to building applications in that environment.

总之,虽然 CSLA 绝不是灵丹妙药,但它适用于某些场景.

In summary, while CSLA is anything but a silver bullet, it is appropriate for some scenarios.

希望这会有所帮助!

这篇关于有人有 CSLA 的实际经验吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:有人有 CSLA 的实际经验吗?

基础教程推荐