
April 10, 2005
The Magenic expert considers business object best practices
Object orientation, existing for over 30 years, is certainly not a new concept -- so why is it such a misunderstood practice? .NET expert Rockford "Rocky" Lhotka considered this and
related issues at the recent Microsoft patterns & practices Summit in the Boston area.
"If everyone loves objects, then why are they so hard to get right?" asked Lhotka, and he proceeded to discuss the state of the art of objects today.
Lhotka said that taking a behavioral approach to designing objects helps one achieve successful implementations. Understanding the comparative usefulness of different object types is
important too. Lhotka also cautioned developers to consider that reuse, often the stated goal of object technology, may not be as important as maintainability of code in object
implementations.
Lhotka, principal technology evangelist for Magenic Technologies, has become an authority on building distributed object-oriented
systems through his collection of books on business objects. In his latest additions to the series, Expert VB 2005 Business Objects and Expert C# 2005 Business Objects, Lhotka
covers his own CSLA (Component-based Scalable Logical Architecture) .NET framework. His application development guidance is intended to show developers how to use objects to create
applications, reducing the cost of building and maintenance. A download is available here.
During his presentation, Lhotka pinpointed conflicts he said can cause confusion in object-oriented design. One such conflict emerges from over-reliance on data-centric object design to
the detriment of behavior-centric objects.
Data thinking, according to Lhotka, is the most pervasive method of object design. "When data is the centerpiece of your object, you assign data to objects before saying what they do,"
said Lhotka. But, he continued, "Descriptions of data don't tell you squat about your objects."
Lhotka presented the behavioral approach as an important method to use when designing objects. According to Lhotka, the real goal is to not duplicate code or behavior. So rather than
normalizing the data so that no piece of data shows up in two objects, you should be normalizing the behavior so no code occurs more than one time.
Lhotka also focused on the differences between data transfer objects (DTOs), entity objects and business objects. "The behavior of a DTO is to contain data - and at the opposite end of
the spectrum are business objects," said Lhotka.
"Both are essential when used in the right place, but you have to use them in the right place." While entity objects are capable of more behavior than a simple DTO, they also are not
necessarily reflective of the business process, but rather business data.
This, according to Lhotka, makes them the most widely used object. "But," Lhotka said, "The danger is you'll grab this object and write the logic on the user interface (UI), and code in
the UI is evil."
The final point Lhotka drove home is that object-oriented design is all about maintainability, not reuse. "Reuse leads to coupling, coupling leads to high cost, high cost leads to anger,
and anger leads to the dark side," Lhotka good-humouredly warned. "Reuse is a fortunate side effect if you get it - but the real purpose of object-oriented design is to make your code more
maintainable and agile," he said.
Related CSLA coverage
Expert C# 2005 Business Objects is available now and Expert VB 2005 Business Objects is available mid-April. For more information, visit http://www.lhotka.net/Default.aspx.
Rocky Lhotka's CSLA download is available now. For more information, visit CSLA .NET 2.0 Release Version downloads.
Authors
 | Regina Lynch is assistant editor for TheServerSide.NET. You can reach her with questions or suggestions for the site at RLynch@techtarget.com.
|
|