Does anyone have real CSLA experience?

My company's main web application is a cry for an excellent set of libraries to make it somehow convenient and scalable, and one of my colleagues suggested CSLA. So I bought a book, but how:

programmers no longer read books

I wanted to appreciate the opinion of the SOFlow community about this.

So here are my questions:

  • How can people use CSLA?
  • What are the pros and cons?
  • Is CSLA not suitable for TDD?
  • What are my alternatives?
  • If you stopped using it or decided on why?
+50
frameworks csla
Aug 18 '08 at 21:23
source share
23 answers

Before I specifically answer your question, I would like to express my thoughts a little. Is CSLA right for your project? It depends. I would personally consider CSLA for desktop applications that do not rate unit testing as a high priority. CSLA is great if you want to easily scale an n-tier application. CSLA tends to get some flack because it does not allow for pure unit testing. It is true, however, like nothing in technology, I believe that there is not one True Way. Unit testing may not be something you are undertaking for a particular project. What works for one team and one project may not work for another team or another project.

There are also many misconceptions regarding CSLA. This is not an ORM. he is not a competitor to NHibernate (in fact, using CLSA Business Objects and NHibernate, since data access is very well combined). He formalizes the concept of a mobile object.

1. How many people use CSLA?
Based on the CSLA Forums , I would say that there are many CSLA-based projects. Honestly, I do not know how many people really use this. I used it in the past on two projects.

2. What are the pros and cons?
Although it is difficult to summarize the short list, here are some of the pro / con that come to mind.
Pros:

  • It is easy to attract new developers to accelerate, gain speed. The CSLA book and sample app are great resources to speed up.
  • The validation framework is truly world-class - and has been “borrowed” for many other projects and technologies not related to CSLA.
  • n-Level Undo in your business objects
  • Changing the configuration configuration for n-level scalability (Note: not even recompilation is necessary)
  • Key technologies are abstracted from the "real" code. When WCF was introduced, it had minimal impact on the CSLA code.
  • You can split your business objects between windows and web projects.
  • CSLA helps normalize behavior, not normalize data (leaving a database to normalize data).

Minuses:

  • The complexity of testing modules
  • Lack of separation of the problem (usually your business objects have a data access code inside them).
  • Because CSLA helps normalize behavior, not normalize data, and this can lead to business objects that are named similarly but have different goals. This can cause some confusion and the feeling that you are not reusing suitable objects. Nevertheless, as soon as the physiological leap is taken, it more than makes sense - it seems inappropriate to structure objects in the "old" way.
  • It is not “in fashion” to create applications this way. You can try your best to get developers who are passionate about technology.

3. After reading this, CSLA is really not suitable for TDD?
I have not found an effective way to do TDD with CSLA. However, I am sure that there are much smarter people than me who may have tried this with great success.

4. What are my alternatives?
Domain-Driven-Design is getting a big push right now (and rightly so - it's fantastic for some applications). There are also a number of interesting patterns developed during the implementation of LINQ (and LINQ to SQL, Entity Framework, etc.). The PoEAA Fowler book details many of the patterns that may be appropriate for your application. Please note that some templates are competing (e.g. Active Record and Repository) and therefore are intended for use in certain scenarios. Although CSLA does not exactly match any of the patterns described in this book, it most closely resembles Active Record (although I believe that myopia requires an exact match for this pattern).

5. If you stopped using it or decided against what?
I did not fully recommend CSLA for my last project, because I believe that the application volume is too large for the benefits of CSLA.

I would not use CSLA in a web project. I believe that there are other technologies that are better suited to create applications in this environment.

In general, while CSLA is a bit of a silver bullet, it is suitable for some scenarios.

Hope this helps!

+72
Aug 18 '08 at 22:32
source share
— -

After reading all the answers, I noticed that some people have some misconceptions regarding the CSLA.

First, CSLA is not an ORM . How can I say that? Because Rockford Lhotka himself expressed this many times in an interview in the .NET Rocks and Hanselminutes podcasts. Look for some episode in which Rocky was polled, and he will state it in unambiguous terms. I think this is the most important fact for people to understand, because almost all misconceptions about CSLA stem from the fact that they are ORMs or try to use it as one.

As Brad Leach said in his answer, CSLA models the behavior of the model, although it may be more accurate to say that they model the behavior of the data, since the data is inherent to them. CSLA is not an ORM because it is completely agnostic about how you are talking to your data warehouse. You should use some level of data access with CSLA, perhaps even ORM. (I. I am now using the Entity Framework, which works great.)

Now, for unit testing. I never had any problems testing CSLA objects because I did not pass the data access code directly to my business objects. Instead, I use some variations of the repository template. The repository is consumed by CSLA, and not vice versa. Moving to a fake repository for my unit tests and using the local data portal, BOOM! it's simple. (After Entity Framework allows you to use POCOs, it will be even more clean.)

All this comes from the understanding that CSLA is not an ORM. He may consume ORM, but he is not alone.

Greetings.

UPDATE

I thought I would make a few more comments.

Some people say that CSLA is detailed compared to things like LINQ to SQL and so on. But here we compare apples to oranges. LINQ to SQL is ORM. It offers some things that CSLA does not do, and CSLA offers some things that L2S does not have, like integrated validation and n-level storage through various remote data portals. In fact, I would say that the latter, persistence at the n-level, surpassed them all for me. If I want to use Entity Framework or LINQ to SQL over the network, I have to put something like WCF between them, and this will significantly increase the work and complexity to such an extent that I think it is much more detailed than CSLA. (Now I am a fan of WCF, REST and SOA, but I use it where you really need it, for example, when you want to open the service to third parties. For most business applications this is not really needed, and CSLA is the best choice.) In fact With the latest version of CSLA, Rocky provides the WCFDataPortal that I used. It works great.

I am a fan of SOLID , TDD and other modern principles of software development and use them wherever possible. But I think the benefits of CSLA outweigh some of the objections of these orthodoxy, and in any case I managed to get CSLA to work well (and easily) with TDD, so this is not a problem.

+21
Aug 02 '09 at 17:40
source share

Yes, I (um, we) used it extensively to model the logic of business processes, which were mainly data formats in a Windows forms application. The application was a trading system. CSLA is designed to be at that level just below the user interface.

If you are thinking about your standard integrated business application, you may have a form with many fields, many rules for these fields (including transverse field validation rules), you can call up a modal dialog to edit some child object, you may want to be able to cancel such dialogs and return to the previous state. CSLA supports this.

This means that he has a little learning curve.

The main thing to remember is to use CSLA to simulate user interactions with forms in an application. The most effective way for me was to design the user interface and understand its flows, behavior and validation rules before creating CSLA objects. Do not use CSLA interface objects to create a user interface.

We also found that it is very useful to be able to use server-side objects of CSLA business objects to validate objects sent from clients.

We also had built-in mechanisms for asynchronously validating against the web service (i.e. checking the range of the counterparty’s credit limit against the host).

CSLA provides a strong separation between your user interface, BusinessLogic and Persistance, and we wrote a load of unit tests against them. It may not be strictly TDD, because you control it from the user interface design, which does not mean that it is not tested.

The only real alternative is to create your own model \ business objects, but pretty soon you will eventually implement the functions that CSLA offers out of the box (INotifyPropertyChanged, IDataErrorInfo, PushState, PopState, etc.).

+18
Aug 18 '08 at 22:50
source share

I had experience working with him a few years ago. This is a brilliant architecture, but very complex, difficult to understand or change, and it solves the problem that most of us develop web applications not necessarily. It has been developed more for Windows-based applications and multi-level indentation handling, with great attention to transactional logic. You will probably hear people say that since web applications are page-level request-response, this is inappropriate, but with AJAX-style web applications, this argument may not contain as much water.

It has a very deep object model, and it may take some time to really wrap your brain around you. Of course, a lot can change in a few years. I would be interested to hear other recent opinions.

All things considered, this is not my first choice of architecture.

+11
Aug 18 '08 at 21:48
source share

I used CSLA for one project, and it worked great and made things a lot easier and more accurate.

Instead of your team writing business objects in their own personal style, we know that there is a common standard for them.

//Andy

+11
Oct 30 '08 at 11:35
source share

In defense of CSLA, although I agree with the many comments that have been made, in particular for testing the unit ...

My company has widely used Windows Forms data entry application with a high degree of success.

  • He provided out of functionality that we did not have the time or experience to write ourselves.
  • He standardized all our business facilities, simplifying maintenance and reducing the learning curve for our new developers.

In general, I would say that any problems that he caused were more than justified by the benefits.

UPDATE. In addition to this, we still use it for our Windows forms application, but experiments with its use for other applications, such as websites, have shown that this is perhaps cumbersome when you do not need most of its functions, and we now explore lighter weight options for these scenarios.

+8
Aug 28 '08 at 14:42
source share

I joined a team in which CSLA is a must. We do not use a remote data portal, and this is the only reason I can agree to use this structure. I never bought the CSLA idea, so maybe that’s why I have nothing but problems with it, sorry.

A couple of problems:

I do not need a road block between my code and the .NET platform, which this structure presented to me. I had a limited list of list objects, while I just had to ignore rich list objects in the .NET framework.

II is completely ridiculous that we had these read-only lists, and then the non-read lists. Therefore, if I had to add an item to the list, I had to recreate the entire list ... are you serious?

Then csla wants to manage my state of the object, which is fine, but nothing really shows up. Sometimes I want to change the state of an object manually, rather than typing it again, which is similar to what csla wants. I basically create many properties to expose options. Csla did not think that I should have direct access.

Why can't I instantiate an object? We create static methods that copy the object and pass it back ... are you kidding me?

Check the source code of the frame and it looks heavy for the reflection code.

Reasons to use csla:

  • The direct .net infrastructure is too powerful for you.
  • your developers are not seasoned and can not understand the concept of templates, then csla will largely have on one page.

    • I don't need a road block between my code and the .NET platform ... I am stuck in these list objects.
+7
Feb 22 '11 at 0:30
source share

We started using CSLA because we thought it would help with our model layer. There was a kind of overkill, and basically all we use now is the SmartDate class, just because we are already associated with the library.

We believed that the validation interface would really help us implement business rules, but it doesn’t work very well with WCF and serialization (we still adhere to version 2.0.3.0, so this could change).

+6
Aug 18 '08 at 21:34
source share

Our company practiced CSLA in some of its projects, and some of the older projects remain CSLA. Other projects moved away from him because the CSLA violated the simple and simple OOP rule: the principle of shared responsibility.

CSLA objects are self-sustaining, for example. they get their own data, they control their behavior, they save themselves. Unfortunately, this meant that your average CSLA object has at least three responsibilities - representing a domain model containing business rules and containing a definition of data access (rather than DAL or implementing data access, as I said / implied) all in one time.

+6
Aug 18 '08 at 23:10
source share

Do not accept CSLA from the list, but before using it, study the benefits and make sure that they really apply. Will your team be able to correctly / consistently implement it? Do you need remote and portal dances?

I think that beyond all theoretical considerations, we are talking about clean / maintained / extensible / testable code after basic tested templates.

I counted the lines of code needed in a specific project domain converted from CSLA. Between all CSLA objects (read-only + editable combinations + root + list) and their stored processes, about 1700 rows were required, and the Linq2SQL + Repository implementation took 180 lines. The Linq2SQL version consisted mainly of generated classes that your team does not need to understand the book. And yes, I used CodeSmith to generate parts of the CSLA, but now I believe in DRY code with single bits of responsibility, and the CSLA implementation now looks to me like yesterday’s hero.

As an alternative, I would suggest exploring the Linq2Sql / Entity Framework / NHibernate in combination with the repository and UnitOfWork templates. Take a look at http://www.codeplex.com/backgroundmotion

Hurrah!

+6
Apr 6 '09 at 7:01
source share

We have been using CSLA for more than five years, and we believe that it works great for building business applications. In combination with code generation, you can create business objects in a relatively short period of time and focus your efforts on the meat of the application.

+4
Sep 23 '08 at 14:22
source share

We make extensive use of CSLA. There are several advantages; First, I believe that every line of business developers should read Rocky Lhotka's book on programming Business Objects. I personally found it in my top 3 best programming books. CSLA is the foundation based on this book, and using it gives your project access to very high-level features such as n-level undo, validation rules, and scalability architecture, providing details for you. Notice, I said “giving,” not “hiding.” I found that the best part of CSLA is that you understand how all these things are implemented down to the source code, without forcing you to play them yourself. You can use as many or several functions as you need, but I found that, remaining faithful to the framework design patterns, it really saves you from trouble. --Byron

+4
Jan 28 '09 at 13:33
source share

I'm new to CSLA, but I understand the concepts, and I already understand that this is not an ORM tool, so stop beating those damn drummers. There are CSLA features that I like, but using them is a bit like a wizard behind a curtain. I think if you don't mind without knowing how this works, you can use objects and they work fine.

There is a large learning curve for beginners, and I think that would be very beneficial with 5-15 minutes. such as Microsoft, for learning the basics. Or how about releasing a companion book with code instead of freeing up code and taking months to get the book? Just say, Mr. Lokhtka ... We started to build our things in front of the book, and I fought all the time. But, as I said, I'm new to this.

We used CSLA. We made our facilities suitable for our form, and then used 10% of what was offered. Cancel object level? Did not use it. Flexibility NTier? Did not use it. We ended up writing enough business rule code, which I thought the only thing we chose from CSLA was complexity. Some long-tooth developers who know the scope used it as their hammer because they had a nail that needed a hit. CSLA was on their belt, and I think many proponents of the structure see things from this point of view too.

I think our experienced developers are happy, because all this makes sense to them. I think if your organization does not have beginner programmers, and you guys are bored by creating efficient and simple POCO objects with well-formed templates, then go for it. Use CSLA.

+4
Dec 13 '10 at 23:00
source share

I use CSLA as the infrastructure of business objects for a medium-sized project. The structure has come a long way from the days of VB6 and offers exceptional flexibility and functionality out of the box. CSLA Mobile Intelligent Objects greatly simplifies interface design. However, I agree with others that this is not the right tool for every situation. Of course, there is some overhead, but also a lot of power. Personally, I look forward to using CSLA Light with Silverlight.

Pros:

  • Agnostic Data Technology 1
  • Great base to install and FREE!
  • Stable and logical structure
  • The data access code can be in your objects or in a separate assembly
  • Verification and authorization of properties and objects

Against

  • The code can be a lot to support 2
  • You may need a code generator for efficient use.
  • Learning curve. The structure of CSLA objects is easy to understand, but caveats can create headaches.


I'm not sure about test-based design. I am not a unit test or a test driven design (shame on me), so I don’t know if unit tests are different from TDD, but I know that the latest version of the framework comes with unit tests.


1 Good, because data access technologies never last long.
2 This has improved with the latest versions of the framework.

+3
Jun 08 '09 at 4:54
source share

I use CSLA with vb5 when it was more from a collection of templates than it was a structure. With the introduction of .NET, CSLA evolved into a full-blown infrastructure with a complex learning curve. However, CSLA considers many things that all business developers tend to write at some point (depending on the scope of the project): validation logic, authentication logic, cancellation functionality, dirty logic, etc. You get all these things for free from in one beautiful structure.

As others have argued, being the foundation, it forces developers to write business logic in a similar way. It also forces you to provide a level of abstraction for your business logic, so as not to use a user interface infrastructure such as MVC, MVP, MVVM, becomes less important.

In fact, I would say that the reason why so many of these user interface templates are so bloated today (in the Microsoft world) is because people have been doing things incredibly wrong for so long (i.e. using DataGrids in your UI spraying your business logic everywhere. (Tisk tisk). Create your middle level (business logic) from the very beginning, you can reuse your middle level in ANY interface. Win Form, ASP.NET/MVC, WCF Service, WPF, Silverlight **, Windows Service, ...

But beyond that, the huge profit for me was the built-in ability to scale. CSLA uses a proxy template that is configured through your configuration file. This allows your business objects to make remote calls from server to server without having to write one liz of code. Adding more users to your system? No problem, deploy CSLA business objects to a new application server, make changes to the configuration file and BAM !! Instant scalability is required.

Compare this to the use of DTO, keeping your business logic on the client (any client that may be), and should write each of your own CRUD methods as service methods. YIKES !!! Not to say that this is a bad approach, but I would not want to do this. Not where there is a basis to do this for me.

I am going to repeat what other people said that CSLA is NOT an ORM. CSLA forces you to provide your business objects with data. They don't care where you get your data. You can use ORM to deliver business objects with data. You can also use raw ADO.NET, other services (RESTFUl, SOAP), Excel tables, I can continue here.

As for your TDD support, I have never tried using this approach with CSLA. I applied the approach when I model the middle tier (ala business objects) using class and sequence diagrams, most often allowing the use script, screen, and / or process. Maybe a little old school, but UML always inspired me well in my projects and developments. , . WCF RIA , CSLA..

**

+3
05 . '10 6:09
source share

Code Generation CSLA. , .

-Blake Niemyjski ( CodeSmith CSLA Templates )

+3
05 . '10 16:11
source share

. , , CSLA . , . . N-Tier. n- , . , , .

, ( ). - , !

+2
23 . '08 14:16
source share

PHP. PHP, ORM PHP, Java .NET. , Java .NET, , PHP, , , .

CSLA , , , - - . Domain Driven Design - , , . , . , , .

dotnetrocks.com/archives.aspx dnrtv.com/archives.aspx( Lhotka).

@Byron ?

+2
10 . '09 4:12
source share

John

, CSLA 2 3.5, , " ". , , , , CRUD. , TDD , , CSLA - .

Chris

+2
06 '09 14:05
source share

CSLA VB6. , , . , , CSLA, , CSLA, , n , n ..

+2
08 '09 10:51
source share

CSLA.NET , Windows, ( asp.net ).

TDD, , - Dataportal_XYZ . , this

+2
17 . '09 12:44
source share

, ""...

+1
23 . '08 14:19
source share

CSLA - , . , . , , , , .:-) : . : , .

0
02 . '10 6:51
source share



All Articles