Thursday, December 01, 2005
« Strongly typed DataPortal_XYZ methods in... | Main | Commercial CSLA .NET? Open-source CSLA .... »

I’ve recommended David West’s Object Thinking book to many people. I really like the book a lot, and think that his underlying message has tremendous value. But the trick with the Object Thinking book is to take the concepts and philosophy and to adapt it into existing tools.

 

David walks through examples assuming a clean slate. No pre-existing framework like .NET or the JDK. No data binding, nothing. And that's good for making his point, but is somewhat silly in the real world. It is hard to imagine ignoring data binding or all the other powerful plumbing built into .NET...

 

Likewise, he ignores the value of IDEs. Take away Intellisense and VS becomes pretty crippled. Yet building all objects as collections of field values basically means that they all become Dictionary objects with business rules attached. No more Intellisense or compile-time checking of anything. Ouch!

 

So in my mind the value of Object Thinking isn't in the idea of creating objects at such an incredibly low level that you lose the value of .NET or of VS.

 

Rather it is in the view that objects have a single responsibility. That they are defined by their behaviors, not by their data. It is in the understanding that no class should be overly complex. If it starts to become complex it is because you aren't factoring the behaviors properly, and aren't effectively leveraging collaboration between your objects.

 

You could look at CSLA .NET and wonder why I like Object Thinking. After all, CSLA .NET can help you build some very data-centric object designs. But CSLA .NET can also help you build some very behavior-centric object designs too. That’s really your choice!

 

From a behavioral perspective, CSLA .NET merely provides (in 2.0) six broad templates:

 

·        Editable single objects

·        Editable collections of objects

·        Readonly single objects

·        Readonly collections of objects

·        Command objects

·        Name/value lists

 

All of which tap into a whole set of underlying concepts including data binding, mobile objects and object persistence.

 

But the goal is to allow a business developer to design a set of objects that have business-specific responsibilities that are better enabled by leveraging this pre-built functionality.

 

A Customer object’s responsibility may be to record valid customer data. By inheriting from BusinessBase, the business developer can focus purely on the behaviors necessary to fulfill that responsibility. The object automatically gets data binding, mobile object and object persistence concepts with essentially no effort. The focus is on the business responsibility and behaviors, not on plumbing.

 

But other objects won’t inherit from CSLA .NET. This, I think, is the biggest single hole in how people use my framework. A real business system has many objects that interact with data, true. But collaboration and behavioral OO modeling means that there should be a lot of objects that don’t interact with data. Rather they implement pure behavior!

 

These may be following the observer pattern or other design patterns. They may be business rule implementations, or implementations of business algorithms like pricing or taxing. There’s a whole ton of behaviors that often don’t belong in a BusinessBase-derived object, but rather belong in their own object. Then a BusinessBase-derived object will collaborate with these other objects to do its work.

 

To me that’s the value in West’s book. The philosophy of each object having a single, clear responsibility. Of objects collaborating with other objects to perform complex tasks, without being complex themselves.

Thursday, December 01, 2005 9:34:11 PM (Central Standard Time, UTC-06:00)  #    Disclaimer  |  Comments [10]  |  Tracked by:
"Software People - Why Good Developers are so important." (Adnan Masood's Weblog... [Trackback]
http://www.axisebusiness.com/adnano/PermaLink,guid,f02ac1d3-30d8-44d6-be13-0f954... [Pingback]

Thursday, December 01, 2005 11:03:48 PM (Central Standard Time, UTC-06:00)
Our development team read "Object Thinking" on your recommendation. I really enjoyed West's perspective on things. He certainly gets you thinking in new ways.

This reminds me that I need to get the Christopher Alexander books that West recommended.

Thanks.
Kyle Reed
Friday, December 02, 2005 5:29:43 AM (Central Standard Time, UTC-06:00)
Rocky

Have to say I agree with you here. Perhaps in the 2.0 book you could provide an example that goes a little further than ProjectTracker.. somthing which implements a basic sort of MVC or some such. Not too deep - after all you have allready said the book will be >800 pages! But seed the idea, and then provide references to other sources that will allow people to develop those ideas further?

Tim
Tim Ensor
Friday, December 02, 2005 9:46:29 AM (Central Standard Time, UTC-06:00)
Hey Tim, I'd love to but space is at a premium... I am changing ProjectTracker a bit to show some different things, but my focus at the UI level is on how to integrate with windows and web data binding more than anything else. To me that is a basic requirement for UI development.

Things like DVM, MVC or Page Controller patterns are optional - matters of taste.
Friday, December 02, 2005 3:49:44 PM (Central Standard Time, UTC-06:00)
Rocky, Is it CSLA.NET approach is more like "Active Record" apporach (PoEAA-Martin fowler). In this case each domain class is responsible for its own persistence. Each domain class will have a signature like this:

public class Employee
{
public void Save(){}
public void Delete(){}
public void Insert(){}
public void Load(long id){}
}

Similarly Ruby-On-Rails is also based on Active Record Pattern...

I feel like this (Active Record) apporach works great if you domain model and relational are almost identical. What if my domain model very different from relation model? What is your opinion on Domain-Driven Design (Eric Evans)? How can apply DDD ideas using your CSLA.NET framework?
Saturday, December 03, 2005 1:06:17 PM (Central Standard Time, UTC-06:00)
I think it depends on how you view things. Sure, CSLA .NET helps enable something like the Active Record approach. But I _specifically_ didn't put a data access or ORM concept into the framework to avoid binding CSLA .NET objects to an arbitrary data mapping scheme.

YOU implement the data access, which means you can map your objects to whatever data they require based on the domain model. The whole point of this is to allow you to create a good domain model that meets your requirements, then figure out how to get the data into/out of the model later.

In the 80% case this is unfortunate, because so many people really do just use an Active Record type scheme and would probably benefit from a built-in DAL or ORM concept. But my interest is more in that other 20% where general DALs or ORMs tend to fall on their face. Where the domain model is interesting: meaning it is quite different from the data model. THAT is when things are fun! :)
Sunday, December 04, 2005 8:40:36 AM (Central Standard Time, UTC-06:00)
Don't forget, we're at a point where we can easily apply code generation techniques as a way of abstracting DAL implementations into code templates. With very little work, we can totally change how DAL is implemented.

We are discovering on a large project 80% of CSLA Business Objects code is code generated plumbing and 20% is handcrafted business logic. This ratio has remained steady as it's grown in size. As one would expect, 99% of the defects are located in the 20%. 00-Achitecture + CSLA + CodeGen + Data-Binding: coding has never been so fun!
Rob Hoeting
Monday, December 12, 2005 11:47:59 PM (Central Standard Time, UTC-06:00)
Still waiting for the light bulb to go on re: behavior centric objects. It's been over a year since I started with CSLA and read West's book. We are hundreds of thousands of lines into CSLA version of our flagship product. Used CodeSmith for the 80% referenced above. Morphed CSLA to include custom version of Observer pattern. Overall very powerfull object model...but my gut says we still aren't designing optimally.

With exception of one facade class and principle/identity objects and a few command objects, all of our objects tie to writeable/readonly versions of business base that correlate to SQL tables!

God I wish I could sit down for a day with someone who "sees". It hurts to know I am not designing as good as I could be.

I found West's book to be true but impotent in delivering one from a state of data-centric to behavior-centric thinking in the mileau of CSLA.NET.

Sean Wegele
Monday, December 19, 2005 4:13:28 AM (Central Standard Time, UTC-06:00)
I have ordered the book, but think we are missing a community for this concepts and philosophy. Does someone know about web sites that relates to this?
Arnt Kvannefoss
Friday, December 30, 2005 7:36:01 AM (Central Standard Time, UTC-06:00)
I need to echo Sean's comments... I too do not think we are there yet with design and the models we use. I really like the CSLA but think that our cognitive abilty as designers is stuck in the past in a way. We tend to still think relationally, especially when we are struggling to grasp a business process or concept.

I have found it helpful in my designs to use the PO example. I try to think of the concept behind the data. You'll find that a purchase order "header" is useless without a "detail" and visa versa... so my PO class (although it includes a collection of detail items) encapsulates the entire concept, I create a new PO I do not create several PODetails and a POHeader that map directly to a relational table somewhere.

It comes down to this for me: the tools we have at our disposal (CSLA, etc) are awesome and only as flexible as our imagination allows. That doesn't mean go off the deep end with crazy designs and systems that are difficult to understand to anyone but you (me). It means apply solid design concepts to your work and think in terms of concepts, not tuples and attributes.
Tuesday, August 08, 2006 6:08:21 AM (Central Standard Time, UTC-06:00)
I have ordered the book, but think we are missing a community for this concepts and philosophy. Does someone know about web sites that relates to this?
Comments are closed.