Launching CSLA in our company

Launching CSLA in our company

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


Fellmer Lloyd posted on Thursday, January 18, 2007

Hi all

I’m a software developer for 5 Years now, but my experience in developing using OOP frameworks is equal to 0 ;-)
Now I’ve got the chance to change this, but I’m not sure if my ideas are good (or rather not).

Please check my suggestions below and give me some feedback. This would be great!


In our company, we have a CRM Application which we are using additionally for Support (Error tickets, bug tracking, knowledge base and so on…).
Constantly we have more and more requirements to implement, and the CRM is now at it’s limit (Maintenance and performance is getting *real* ugly).

Now we have to implement a lot of new functions, one of them is a powerful web interface.

…I think this is the right moment to be innovative, and bring CSLA into the game :)
We could implement our functions in a CSLA Framework and use those in multiple UI’s (In our case WinForms & Web).
My idea is to implement all “CRM-Objects” (customer, contact, ticket, address) in CSLA (maybe in multiple classes, using use-cases).

It’s possible that we change our CRM system in the next year, so I want to separate CSLA from it.
I was thinking about an additional DAL using Nhibernate (I found some useful posts in the forum).
If the CRM system change happens, we could just change the DAL and keep the “CSLA Objects”.

Regards,
Fellmer

Fellmer Lloyd replied on Friday, January 26, 2007

122 Views but no comments?
I don't hope my ideas are *THAT* bad...

Fellmer

William replied on Friday, January 26, 2007

My personal opinion, CSLA is a good foundation framework for building various OLTP business applications. However, not all kinds of business applications can/should be built with CSLA. You should understand and evaluate CSLA to your context and/or goals and make the decision to adopt. The book from Rocky, resources on the web as well as this forum have a lot of information that can help you understand what CSLA is, how CSLA facilitates business application development, etc. Thus, the answer is both yes and no, that is very specific to your context.

Regards,
William

 

RockfordLhotka replied on Friday, January 26, 2007

You qurestion is whether to use an abstraction layer between your new application and your existing CRM application/database?

I would suggest that this is exactly what you should do, yes.

Ideally you would not talk directly to another application's database though. That's always an expensive (in the long run) and fragile way to do application integration.

If your CRM system implements a set of services, you'd be far better off if you can interact with those services rather than the database directly.

If your CRM doesn't implement a set of services, odds are pretty good that the one you replace it with will have a set of services. This is the direction the industry seems to be moving.

Assuming your existing CRM doesn't expose services, what you might consider, is the idea of creating your own set of services on top of your existing CRM. Then you can build your DataPortal_XYZ methods to interact with those services.

The value here, is that when you move to another CRM, your services are your abstraction layer. You can alter your services to interact with this new CRM (either its database or its services or whatever), but you won't impact your business objects as long as you preserve the same service interface.

While a DAL or ORM also offer a layer of abstraction - they only offer it in terms of talking directly to the database. Again, that is not an ideal way to implement application integration, and this is why I bring up the idea of using a more service-oriented approach.

Fellmer Lloyd replied on Monday, January 29, 2007

Hi William, Hi Rocky

Our CRM doesn't expose any services to use (besides some poor functions).
I like Rocky’s idea of using a set of services to access the CRM data (and functions).

This would result in a "SOA-like" architecture (I don't like the term SOA too...).
The exposed CRM services would be consumed by the CSLA objects.
Which technology would be used in such a scenario? Remoting (or webservices) using DTO's (like the example in your book)?

Thanks a lot for this suggestion, I think this would be a nice solution (although it would result in a lot of work... but if it's worth it, I can deal with that).

Fellmer

RockfordLhotka replied on Monday, January 29, 2007

I would build the services using a DTO for data transfer and a factory (from the business object perspective) that hides the details.

In many cases you really don't want to incur the overhead of web services or other network protocols - you just want to make a direct call to a DLL. But in the future, who knows?

Something like this:

[Serializable]
public class Customer : BusinessBase<Customer>
{
  // ...
  protected override void DataPortal_Fetch(Criteria criteria)
  {
    using (DataService svc = DataServiceFactory.GetService<Customer>())
    {
      DataObjects.CustomerQuery query = new DataObjects.CustomerQuery();
      Csla.Data.DataMapper.Map(criteria, query);
      DataObjects.CustomerData result = svc.GetObject(query);
      _id = result.Id;
      _name = result.Name;
      // etc...
    }
  }
  // ...
}

 

Fellmer Lloyd replied on Tuesday, February 20, 2007

Hi Rocky

Currently, I'm planning the base architecture of our new framework.

I want to implement the suggestions you provided (services using DTO's).
But I've got some more questions, maybe u can help me out again :)

Here's the first one:
I'm not familiar with the factory call you provided in your example (DataServiceFactory.GetService())).
What patter does match to this scenario?
It doesn't look like the "standard" factory pattern to me (e.g. CustomerFactory.GetCustomer(query); ).
Is this the "class factory" pattern, or I am completely on the wrong way?

Another question:
I'm not sure how to implement the services.
I was thinking of creating a separate application and feting the data per remoting.
But there would be a lot of network overhead (two serializations per DataPortal_XYZ method).

Now I'm more near the idea of just include the "DTO Assembly" & "DAL (Factory) Assembly".
But would this scenario fulfill the requirement of total BO / DAL decoupling?

And the final one:
Is there any additional framework or class library which would support me while creating this scenario? Maybe a ORM framework like nhibernate?
Sadly, I haven’t made experiences with such ORM frameworks yet.

Thank you in advance & best regards,
Fellmer

Fellmer Lloyd replied on Monday, February 26, 2007

Hi all No suggestions regarding this topic? Should I provide additional information? Best Regards, Fellmer

RockfordLhotka replied on Tuesday, February 27, 2007

I am talking about adding another layer BENEATH the business objects.

The app then looks like this:

UI
Business Objects (BO)
Data Access Layer (DAL)
Database (DB)

The DAL gets the data from the DB and puts the data into data transfer objects (DTOs). Those DTOs are then returned to the BO so the BO can load itself with data.

The BO needs to call the DAL to start this process. To do this, the BO needs to get a reference to a DAL object. To do this, it calls a factory method that is part of your DAL.

So the factory method that I mentioned earlier is NOT a standard CSLA object factory method, no. It is a factory method that you implement as part of your DAL.

If you want to be able to easily switch from one DAL to another, you should implement your DAL using a provider pattern. You'll have one DAL assembly where you implement your factory methods, but you will not implement your actual data access logic. Instead, this assembly would dynamically load (probably using Assembly.LoadFrom()) an actual DAL assembly that does implement the data access for a specific data source.

Copyright (c) Marimer LLC