Expert C# Business Objects by Rockford Lhotka - Chapter 6 - Object-Oriented Application Design

Expert C# Business Objects by Rockford Lhotka - Chapter 6 - Object-Oriented Application Design

----

I will be providing a chapter by chapter summary of Expert C# Business Objects by Rockford Lhotka (Amazon) as well as any thoughts and commentary when appropriate. Enjoy.

Read Expert C# Business Objects Chapter 1.
Read
Expert C# Business Objects Chapter 2.
Read
Expert C# Business Objects Chapter 3.
Read
Expert C# Business Objects Chapter 4.
Read Expert C# Business Objects Chapter 5.

Chapter 6 walks the reader through the design of a sample project tracking application. It describes building use cases, identifying entities and value objects, and creating database tables and stored procedures.

----

Chapter 6 focuses on the following key concepts:

  • Creation of a business object
  • Implementation of business rules
  • Transactional and nontransactional data access
  • Parent-child relationships between objects
  • Many-to-many relationships between objects
  • Use of name-value lists
  • Use of CSLA.NET security

This chapter is not very technical aside from showing the basic of database table design and stored procedures.

Use Cases

Rocky provides a decent overview of creating use cases for the sample project-

Project Maintenance

  • Add a Project
  • Edit a Project
  • Remove a Project

Resource Maintenance

  • Add a Resource
  • Edit a Resource
  • Remove a Resource

Assigning a Resource

Object Design

Rocky then uses a form of decomposition for the object design, which identifies the “nouns“ in the use cases and narrows down which of the “nouns“ are business entities and value objects.

He also identifies the security roles in the application based on the users in the use cases.

The chapter discusses overly complex relationships, in particular, circular containment issues. Here is a quote from the chapter that I thought was worth mentioning:

In a situation like this [circular containment issues], we should always be look for relationships that should be using, instead of containing. What we'll often find is that we're missing a class in our diagram - one that doesn't necessarily flow directly from the use cases, but is required to make the object model workable.“

The specific problem we're trying to deal with is that when we load an object from the database, it will typically also load any child objects in contains [no lazy loading here] - containment relationships will be followed in order to do the data loading. If we have an endless loop of containment relationships, that poses a rather obvious problem! We need some way to short-circuit the process, and the best way to do this is to introduce a using relationship into the mix. Typically, we won't follow a using relationship as we load objects.“

The chapter then takes a moment to briefly reflect on performance and then shows UML diagrams to describe the overall design.

Database Design

The end of the chapter steps the reader through creating the database tables and stored procedures as well as establishing database security.

 

The next chapter, Expert C# Business Objects Chapter 7, Business Object Implementation, takes you through creating the actual business objects.

posted on Sunday, October 24, 2004 6:38 PM

Main

News

Green Tea

.NET Development

Enterprise Library

Patterns & Practices