Saturday, September 22, 2007
« Hiding a disabled Save button in WPF | Main | Data refresh in WPF »

I recently received this email, and wanted to share my reply.

Rocky,

Our company is going through a transformation in the way we do software.  We’re a very large company with offices all over the world, and it’s only my location that is using CSLA at this point.  We’ll now we’re faced with defending our decisions to use CSLA as the rest of the company attempts to create a “toolbox” of approved methodologies for development.  Normally I would think this is a good idea, but it seems to me that the people providing the recommendations, who interviewed us, don’t seem to have things right, especially when it comes to CSLA.

Now, I figure I can create my arguments just fine… however, I think your help would be very valuable.  Here is a list of comments made about CSLA that I feel I have to clarify or defend.  Personally, I know they are blatantly wrong, but nevertheless, they seem to be common misconceptions about CSLA.  What do you think?  Again, these are not my comments, just misconceptions that I’m hearing from the rest of the company that I need to clear up.  Also, one of the key misconceptions here is that we should use Enterprise Library as a replacement for CSLA, again, they don’t understand what CSLA  .NET is for

Misconceptions:

1. CSLA .NET is an older concept, ported to .Net, unlike Enterprise Library which was written for .Net.

2. Many CSLA features can be accomplished with Enterprise Library.

3. CSLA .NET is a “niche” framework, when compared to the widely accepted Enterprise Library.

4. CSLA .NET was not built with new technologies like WPF or WCF in mind.

5. CSLA .NET is component based and wasn’t designed to take advantage/or be compatible with SOA.

6. CSLA .NET, tied to its legacy, looks at the future of .NET and the adoption of SOA as merely an afterthought.

Those are the key misconceptions that I feel I have to address… any help you can provide in formulating my arguments would be greatly appreciated.

Thanks!

Jimbo

My reply follows:

Jimbo,

1. CSLA .NET is an older concept, ported to .Net, unlike Enterprise Library which was written for .Net.

That is not strictly true. There is a strong and complete break between the COM-based CSLA and CSLA .NET. No code carried forward, and realistically the concepts in CSLA .NET were enabled by .NET itself, and have little to do with the limited world of COM.

It is true that CSLA uses some OO concepts that have been around for a long time. These concepts have stood the test of time, and have proven to be very valuable for designing and building software. It would be foolish to discard great ideas just because they've had time to age. That'd be like discarding the wheel because it is an older concept...

It is also important to recognize that CSLA .NET and Enterprise Library are entirely complementary. CSLA .NET solves a set of problems not addressed by EntLib, and EntLib solves a set of problems not addressed by CSLA .NET.

2. Many CSLA features can be accomplished with Enterprise Library.

Again, EntLib is complimentary to CSLA .NET. Things like logging, caching, data access, configuration and logging are outside the scope of CSLA .NET.

Things like validation, authorization, data binding support and location transparency for n-tier development are the focus of CSLA .NET.

While EntLib does have a validation module, it is architecturally unsound, putting the business logic into the UI layer rather than encapsulating it in a separate business layer.

3. CSLA .NET is a “niche” framework, when compared to the widely accepted Enterprise Library.

There is no doubt that using a niche framework is a risk. And any organization using CSLA .NET must be aware of the nature of the framework in that regard.

However, it is also important to realize that CSLA .NET is the most widely used framework of its kind in .NET. Yes, EntLib is more widely used, but it does not duplicate or replace what CSLA .NET provides.

If you don’t use CSLA .NET, you still need to solve the problems it addresses. Like it or not, there are gaps in .NET around data binding, validation, authorization and so forth. Gaps that CSLA .NET solves. As do other products like NetTiers, LLBLGen, Ideablade and others. Some commercial, some not.

But none have the broad user base of CSLA .NET at this point in time.

I’ve had several people approach me at conferences to point out that they replicated CSLA .NET. They’d read my book, didn’t want to use a “niche framework” and set out to do their own thing. Months later they looked at their app and realized that they’d re-solved all those same problems. Addressed all those same gaps. And that they’d largely recreated CSLA .NET. Usually they are sad about this, realizing just how much time they wasted recreating a framework that already exists.

4. CSLA .NET was not built with new technologies like WPF or WCF in mind.

This is patently untrue. Sorry, but CSLA .NET 2.0 was written specifically with WCF and WPF in mind. I am on steering groups within Microsoft, and so help shape the nature of many of these developer-oriented products. I knew years ahead of time the basic shape and nature of .NET 3.0, and so in 2005 CSLA .NET was already prepared for these new technologies.

While most of the other bullets in the assessment are reasonable and well-considered (though I clearly dispute some conclusions), this bullet is simply absurd and discounts the many hundreds of hours of work I’ve put in over the past four or so years ensuring that CSLA .NET provides a seamless and transparent upgrade path from Windows Forms and Web Forms to WPF, and from Web services or Remoting to WCF.

I challenge you to find another framework that will allow a switch from Web services or Remoting to WCF through a simple configuration file change. And yet I accomplished this in CSLA .NET by preparing for these technologies way back in 2004 and 2005.

5. CSLA .NET is component based and wasn’t designed to take advantage/or be compatible with SOA.

There are two aspects here.

First, CSLA is a brand. Whether “component-based scalable logical architecture” is still accurately descriptive (it isn’t) doesn’t even matter anymore, because the brand is what it is. In other words, don’t read too much into the name – I’m stuck with it.

Second, there is no doubt that CSLA is designed to support n-tier client/server architectures. Such architectures are currently the best way to build interactive applications with WPF, Windows Forms and Web Forms interfaces. Like it or not, SOA simply has too much overhead and is too high-cost to be effective for most interactive application development.

It would be foolish to consider that object-oriented design is dead in the face of SOA. Or workflow. In fact, they are highly complimentary.

A service or a workflow activity are, by definition, both atomic units of functionality. If they aren’t, then you are doing them wrong.

Effectively every service and every activity are “mini-applications”. They are also effectively a use case, from an OOD perspective.

Thus you can (and often should) design and implement your services and activities using OO concepts. And CSLA .NET is all about making it easier to apply OOD/P when building applications.

As a result, whether you are building applications that consume services or that provide services or activities, CSLA .NET is a great help.

6. CSLA .NET, tied to its legacy, looks at the future of .NET and the adoption of SOA as merely an afterthought.

The reality is that CSLA .NET has been able to largely shield its users from the rapidly increasing rate of change and chaos in the Microsoft platform space. By enforcing a clear delineation between UI and business code, and by supporting .NET standard interfaces for data binding and other .NET features, CSLA .NET continues to act as a valuable buffer, allowing valuable business logic to easily move forward through time, even as interface technologies change and change and change.

More time is spent on “future-proofing” both CSLA .NET, and more importantly the users of CSLA .NET, from changes to Microsoft’s platform than any other feature of the framework. Clearly it is impossible to abstract all the changes Microsoft comes up with, but CSLA .NET strives to protect that which is most important and costly to build and maintain: your business rules and logic.

Saturday, September 22, 2007 1:36:43 PM (Central Standard Time, UTC-06:00)  #    Disclaimer  |  Comments [11]  |  Related posts:
CSLA .NET on DNR TV
CSLA into the future
CSLA .NET ObjectFactory attribute
CSLA Light data provider
Using CSLA Light Part 4
Using CSLA Light Part 3


Saturday, September 22, 2007 2:18:28 PM (Central Standard Time, UTC-06:00)
Hi, Rocky: I think you mean "complEmentary".
Saturday, September 22, 2007 5:47:45 PM (Central Standard Time, UTC-06:00)
Good point :)
Sunday, September 23, 2007 11:08:07 AM (Central Standard Time, UTC-06:00)
when we were moving our applications from classic ASP to .NET, we spent hundreds of hours trying various options.

We ultimately decided to bet our barn on CSLA. I am glad we did that!!.

We had all our programmers trained on CSLA. We use CSLA / ASP.NET / SQL 2005 / BizTalk Server as our core.

We do our own workarounds for ALL the gaps in Microsoft .NET for a true enterprise application.

People get taken up by buzz words like SOA without really understanding WHAT it does and how and where it can be applied. Most of the SOA I have seen from the so called big enterprise ERP applications are to hide the current mess of their DB and application state.

A fair majority of decision makers in most big companies do not understand what really is .NET and tend to take the safe route. As the old saying goes.. "Nobody got fired for choosing...", this way they can always blame the big vendor.

Our philosophy - niche or small does not equte to risk, but excellence.

We put CSLA in the excellence category!!!.
Monday, September 24, 2007 8:02:13 AM (Central Standard Time, UTC-06:00)
We've been using CSLA.NET 2.0 for nearly two years (going back to beta releases). After a successful prototyping phase with CSLA.NET 1.x we decided to adopt 2.0 and I'd like to say we haven't looked back.

The unfortunate truth we've had to face in my company is that - if you want to practice true "test driven development" it becomes very difficult to use a framework like CSLA.NET. What seems to have happened in the past decade or so (primarily over in Java but in recent years in .NET as well) is that the quest for test-ability has resulted in some very different design decisions than what I would have made previously (either on my own or as a consumer of CSLA.NET). Concepts like:
* POCO (plain old CLR object)
* Single Responsibility Principle / separation of concerns
* Inversion of control / dependency injection

...steer the developer away from inheritance-based, encapsulated solutions, which CSLA.NET is.

Some bloggers have distinguished Test Driven Development (or Testable Object Oriented Development) from "traditional" Object Oriented Development. Lately I am inclined to agree. There are different toolsets for the former, including nMock or Rhinomocks, castle windsor, and nHibernate. Of course these tools can be used with CSLA.NET as well, however the benefits of CSLA.NET (RAD, business value-add focused development) don't seem to gel with TDD in my opinion.

It is unfortunate for us because we've had a pretty good run with CSLA.NET and I loathe the idea of rewriting our business layer into seperate persistence and domain layers with each of the nicely encapsulated business entities being smashed into several POCOs, with interfaces, and factories in tow. However if TDD is the unstoppable train in your organization (as it is in mine), then I would caution against adopting CSLA.NET, not because it isn't a good framework (I believe it is excellent) but because it isn't a TDD framework.
Kirk Horne
Tuesday, September 25, 2007 8:30:18 PM (Central Standard Time, UTC-06:00)
I tried using enterprise library. I really hated it. The push towards configuration files and away from code strikes me as odd. I imagine that managers are more into configuration files. As a developer, I like writing C# code, but really dislike xml configuration hocus-pocus. EntLib was a Big disappointment for me. It's like the opposite of Csla. It promises the world, but delivers little. Csla promises [insert list of Csla features], and delivers all of them. Not without a cost. For example, it it is impossible to do orthodox TDD with Csla.

I do test first development with nunit and CSLA - but it's not really TDD. First, I don't pretend it's "Test Driven _Design_." Second, my tests are not unit tests. I try to make them granular, but almost all my tests are integration tests. I violate many of the rules of unit testing. I write the tests first. I write tests for all public methods. I refactor to the tests. I'm a green bar addict. But I wouldn't make it into the TDD or agile club. Not on a Csla project. It's just too difficult to do this kind of OO development with Csla. I really didn't want to re-engineer Csla, so I adapted my development methodology.
jsmith
Wednesday, September 26, 2007 1:51:36 PM (Central Standard Time, UTC-06:00)
Hi Rocky,
Do you think that richness(in other words complexity) of CSLA could beome CSLA's Archille's Heel ?
Anonymous Coward
Friday, September 28, 2007 9:11:59 AM (Central Standard Time, UTC-06:00)
I think that it is possible that the complexity of CSLA will become a problem over time. The fact that I've chosen to support every type of interface available in .NET (Windows Forms, WPF, Web Forms, console, asmx, WCF and workflow) means that there is a lot of complexity in the framework.

Of course the whole point is that a USER of the framework doesn't have to deal with that complexity. And this is where the "simpler" solutions ultimately fall down, because they end up forcing developers to deal with stuff I abstract away.

Sure, you can build an MVP/MVC solution for the web. Then try porting that to Windows or WPF (and actually exploiting the capabilities of the new UI target). The new controller/presenter code must then deal with being stateful (instead of stateless), and must deal with all the idiosyncracies of data binding in both the new targets.

Or you can do what most of the MVx people choose to do - and make the UI effectively stateless and web-like. At which point you gotta wonder why go to WPF at all? If you aren't going to exploit its rich, stateful nature - if you are going to impose the archaic limitations of HTML on XAML - then just stay with HTML...

All this is a long-winded way of saying that, while it is possible that the "complexity" of CSLA could become an issue, the reality is that the support for _all_ .NET interface technologies provided by CSLA is really powerful. If you ever think you might move from one UI technology to another (and we all do eventually!), then this "complexity" all of a sudden becomes a major benefit in terms of simplicity.

A benefit that is hard to achieve in many other architectural approaches (you'll note that the MVx frameworks don't span Windows, Web, WPF, services and workflows - you typically have to switch MVx frameworks when you switch UI styles).
Sunday, September 30, 2007 7:28:16 PM (Central Standard Time, UTC-06:00)
Kirk-

One of my colleagues, and my favorite person to argue the merits of TDD with, Nermin Dibek, posted the following which explains how to mock CSLA.net using TypeMock. (http://www.nermins.net/post/TDDUsing-Mock-objects-with-CSLANet.aspx) I could probably arrange a demo if you like :)
Monday, October 01, 2007 11:17:07 AM (Central Standard Time, UTC-06:00)
Aaron -

Thanks for the link. We actually looked into TypeMocks, ultimately though we have sided with the "design for testability" camp. Certainly using TypeMocks with CSLA is viable solution... however (from a purist's perspective) that is really a work around and doesn't address the underlying problem.

I'll include a link to a well-known primary contributor to the design for testability camp. Again I'm not saying CSLA is a bad solution, but it does things that some purists would take issue with. The interesting thing is that if you follow what the purists advocate, you will actually avoid the need for the TypeMocks work around. We might also never get any real work done :) that remains to be seen.

http://www.objectmentor.com/omSolutions/oops_what.html
Kirk Horne
Thursday, October 04, 2007 6:03:11 AM (Central Standard Time, UTC-06:00)
You know one of my favorite mantra's is that "we are here to solve business problems, any time that we spend coding solutions to architectural problems is a distraction from that purpose." CSLA allows us to do just that.

Thanks,

Kevin
Kevin E Ford
Thursday, October 04, 2007 2:49:16 PM (Central Standard Time, UTC-06:00)
Rocky,

I think you need to re-look at Ent Lib's validation. It is is no way, shape or form implemented in the UI. Perhaps that is a "demo" you saw of it that was bad. Validation is implemented more as a service. The code that uses that service should be put into the business layer. As a matter of fact you can attribute your business objects for validation.

In addition they have validation controls that you can put into the UI which triggers the validation rules. However, that doesn't move the rules to the UI at all. The rules are still implemented in the business layer as attributes, or imperative code or you can put the rules in a configuration file.
Bob Archer
Comments are closed.