Benefits of CSLA for a web app....

Benefits of CSLA for a web app....

Old forum URL: forums.lhotka.net/forums/t/1495.aspx


rhinoishere posted on Monday, October 16, 2006

It's taken me a long time to get through Rocky's book. Now that I have, I'm creating a business layer for an upstart business, and I am creating it with CSLA. However, I probably shouldn't be. Why?  Honestly, I'm not sure I can explain the benefits of using CSLA if someone were to ask. I'd probably have to stammer around about something to do with "mobile objects".  I'm a little nervous I'm using CSLA simply because of the time I've invested reading about it and trying to learn it (in other words, for emotional reasons rather than logical).

I was looking around the web for what others have said about the benefits of CSLA and found this frightening comment:

"I don't personally care for some of his decisions and it's not geared toward web-based development, but it's an honest-to-goodness architecture in just about anybody's book."
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=721912&SiteID=1

So please, first answer if you agree with the bolded part above. Then, any discussion on why you think CSLA is a worthwhile investment, especially from the perspective of a web app, is greatly appreciated!

thanks, Ryan

SonOfPirate replied on Monday, October 16, 2006

While I agree with the first part of the statement (that I don't agree with all of Rocky's decisions), I must disagree with any assertion that CSLA is not well-suited for web-based development.  I would suggest that the author of this post (no, I didn't take the time to go read it) comes from a more traditional web development perspective and prefers the cut-and-dry methods used in just about every ASP.NET text you can find where we make use of DataSets and DataAdapters dropped directly onto our web pages, etc. so that we can quickly and easily whip together an "application".

BUT...

When you want to use solid OOP practices and build a framework that supports not only rapid application development but code reuse, etc. CSLA is a perfect example of how this can be done.  And, since CSLA is not intended for, nor claims to be, a UI framework, it is well suited for development of Windows Forms apps, ASP.NET apps, Web Service apps, Windows service apps, Mobile apps and even (or maybe especially) SmartClient apps.  It is a framework not unlike the stick-build (2x4) structure of a house which doesn't matter if the exterior (presentation) is brick, vinyl siding or mud.

Where some people get thrown when looking at it from a web perspective is their confusion regarding the stateless nature of web apps.  However, CSLA is intended to be a stateless, disconnected framework and fully supports this notion.  Making sure it is implemented correctly is another story and not the repsonsibility of the framework.  Just because the web is stateless and disconnected doesn't mean we should abandon good OOP practices.  In fact, it is even more critical, I have found, if you are to be successful at delivering full-featured, scallable, extensible and reliable apps in a reasonable amount of time.

Where I will agree with the quote is that I don't simply download and implement CSLA.  I use it as a resource and a tool to help construct and develop my own framework based on CSLA.  It can be as simple as the names Rocky chose for his objects or properties, but there are going to be things about the CSLA framework that we all would need to tweak to our own needs.  But, you can't replace Rocky's experience and what I believe to be an exceptional job explaining the rationale behind his decisions.  While I may not full implement his design, I leave the table knowing why he did and can make my decisions from a more educated perspective.  And, imo, that is all Rocky is after.

Hope that helps.

 

skagen00 replied on Monday, October 16, 2006

When I first started evaluating frameworks and CSLA looked like the direction we were going, I was really thinking "Windows" apps. Then the decision came down that it would end up being a Web application.

I made a post a long time ago on the old forums asking this question - Web or Windows?

http://www.searchcsla.com/Details.aspx?msn_id=25525

There is, no doubt, value that CSLA provides to WinForm applications that is greater than that it provides to WebForm applications.

However, what I'm finding is the most compelling reason is the guidance and structure the framework provides towards building good business objects properly surrounded by a strong community, great framework creator, and robust documentation (the book).

Also, if we decide we want to build a Web services UI or a Win UI for part or even all of our application, we're in great shape for that. 

Prior to Rocky's book I have to admit I'd probably have been throwing data sets and so forth into my UI, violating all kinds of nice tier boundaries, and overall heading down a less structured path. I may be really at the early learning stages for building my UI utilizing Ajax/etc, but I look at my business objects & data layer and feel pretty good that those houses are in order. 

(I in fact use a Windows UI application as a test harness for my BOs as I find it easier to debug and make sure I'm getting the exact behavior that I want from my objects in a more responsive environment).

 

 

 

 

ajj3085 replied on Monday, October 16, 2006

I also recommend looking at Rocky's site, he's blogged about this before.

david.wendelken replied on Monday, October 16, 2006

skagen00:

There is, no doubt, value that CSLA provides to WinForm applications that is greater than that it provides to WebForm applications.

Are you sure that isn't because WinForm applications provide greater features than WebForm applications?

I've just used it for a web app and found it was extremely helpful!  Now that I know more about it, I can see how it could be way more helpful!

JoeFallon1 replied on Monday, October 16, 2006

I have used it for a Web app for years - it is a fantastic aid.

When I had to make some .exe tasks in a WinForms project I simply re-used some of the BOs, filled them with data, checked if they were Valid and Saved them. Piece of cake.

I plan to get around to Web Services (some day) and will dig in to that chapter in the book before I start.

Joe

 

Copyright (c) Marimer LLC