Sunday, May 20, 2012 Register    Login
Instructions

In order to add new threads or reply to existing posts, you have to be logged-in. If you are not registered yet, you need to register first, and then login with your personal credentials.

   

CslaFactory Forums
HomeHomeDiscussionsDiscussionsGeneralGeneralModeling BehaviorModeling Behavior
Previous
 
Next
New Post
11/10/2008 1:51 AM
 

I assume all of us here, having read Rocky's book and adopted his model, believe him when he says that Business Objects should model Behavior, not Data.  Can someone explain something to me about this tool?  I can't get my brain to see how you'll allow me to accomplish this task.  Code generation is trivial for lists and editable roots, so I may just be missing the boat by viewing the examples. I'm more concerned about the cases where a database table doesn't neatly match the properties of my objects.

Can someone point me to an 'Advanced' tutorial, or would it be best for me to pose a few scenarios, and allow you to tell me how you would infer the appropriate DB model? 

Also, what if I already have my database?

I love the idea of using the VS DSL Tools to work with the model, but I think it is going to be hard to adopt unless it can work in both directions.  By that, I mean having the ability to create the Database Schema when appropriate, and allowing the developer to create models 'Based On' the database as well.

Kevin

 

 
New Post
11/10/2008 8:51 AM
 

Hi Kevin,

CslaFactory is meant to help you concentrate on the business logic instead of loosing time writing the same structural code over and over again. There are lots of good tools that support you by generating code from database tables and they are very useful, especially if you have an existing database and want to apply CLSA.net on it.

Unfortunately, if you try to generate proper relations from a database, you might fail to do so sooner than later. From the table stucture you can not tell the difference between an aggregation and a composition and you can hardly figure out self-references. What about validation rules? How do you generate them from a table structure? And authorization rules? As CslaFactory is based on a DSL designed for CSLA.net. you can easily model all of this and generate the code. Imagine that you may have multiple versions of a model. This is very helpful if you want to serve multiple customers with different naming conventions or if you just want to track your versions. These are just some of the main reasons to use a model-based code generator instead of a database-driven tool, but if I still did not manage to get you back on track, please do not hesitate to drop a line.

Even if you already have an existing database, you should be able to use CslaFactory in most cases. You would have to model the entities of your existing database before generating the code, but as I just mentioned beforehand, this is good, because you can model relations, and validation rules and so on. This surely is hard work for large databases. We already received requests for an importer tool that reads an existing database structure and initially creates the model from it. Although not planned yet, it would not be too hard to provide such a tool, I guess.

Marcel

 
New Post
11/19/2008 3:09 PM
 

Thanks, Marcel.  I do agree that if you run a tool against a relational database, and let it create classes that are 1:1 with your tables, you'll be in trouble. (Although, that approach often works just fine in simple content management systems for websites, for example).  I'm just not so sure that the reverse approach works completely, either.  In other words, I don't know that you can completely infer an accurate and performant database model from a DSL model built to serve as a class diagram.  One issue is that any changes that need to be made to the DB structure after generation would somehow need to be managed and tracked along with the project(s) as well. Another issue is that versioning and multi-developer use of this system is going to be difficult. (I'm thinking about source control here)

I really think to make this thing go from useful to brilliant, it needs to be 2-directional.  One would need to be able to map properties in their objects to fields in the database.  There is a great tool for CSLA that's been around for a while.  It pulls in the database model, and lets you create CSLA objects by selecting fields from tables, views, or sproc result sets.  It has support for Authorization, Business Rules, Lazy Loading, Active Objects (an excellent implementation of the observer pattern), and more. It even navigates the relationships in the DB to generate the CRUD sprocs. [CSLAGen - http://groups.google.com/group/CslaGenerator

I'm not promoting them, just suggesting that the tool is incredibly useful, as yours will likely be.  Why is it not Brilliant? No visual model.

You are left with a list of objects, and no way to see the relationship between any of them.  Of course, those relationships are there.  You use the property grid to select objects that are child properties of other objects, for example.  There is just not a visual aid. So while it can let you build the entire behavior focused BO Library from an existing, well designed, purely relational database, it can be very difficult to see the big picture.

Just food for thought.  V2 maybe.

Best wishes on rolling out something soon!

Kevin

 
New Post
1/30/2009 2:17 PM
 

Good post from both sides, this looks like a great tool. So many CSLA generators go from schema to BO, but the coupling is so tight its nothing more than a DAL rather than BO as always intended.

 
New Post
2/8/2009 6:41 PM
 

Hi Marcel

I am a new registrant ot your project and just wanted to understand your motivations regarding this project. It looks like your group has poured lots of blood, sweat and tears - never mind the time and money :-). Have you explored the MDA world and especially the Eclipse Modelling projects? These are the evolution of many years of vertical generation projects (M2T - model to text) into standards based approaches that can save years of development! There is a large model-based development community out there. I would highly recommend your investigation there as many of the issues, questions and features discussed here have been discussed and perhaps implemented. Regarding model validators, importers and other utilities - these are implemented in M2M (model to model) pipelines supported by the most modern tools. As are model transformations between systems, visual representations, text representations and modeling standards such as MOF and eCore.

This is NOT a criticism of your project. I think it is powerful and forward thinking. I just wanted to point you to what is IMHO the state-of-the-art in MDA and DSL thinking to perhaps expand your vision.

Reuben

 
Previous
 
Next
HomeHomeDiscussionsDiscussionsGeneralGeneralModeling BehaviorModeling Behavior


   

UsersOnline
Membership Membership:
Latest New User Latest: nesopo
Past 24 Hours Past 24 Hours: 0
Prev. 24 Hours Prev. 24 Hours: 0
User Count Overall: 1605

People Online People Online:
Visitors Visitors: 5
Members Members: 0
Total Total: 5

Online Now Online Now: