After you design and build enterprise object classes as discussed in “Business Objects,” you need to add business logic to some of those classes. The applications you build with Enterprise Objects derive most of their value from the business logic—or business rules—you build into them. Business rules make data relevant and the implementation of business logic is perhaps the most important task when building data-driven applications.
Many database application development environments force you to implement business logic in all the wrong places, such as in the data source itself or intermixed within user interface code. Implementing business logic in these places makes it less reusable, harder to maintain, and makes it less adaptable to changing business needs. These and other consequences of implementing business logic in the wrong places are described in “Why Enterprise Objects?.”
This chapter describes the best place to implement business logic—in reusable, portable, data source–independent Java objects called enterprise objects. It consists mostly of specific tasks that you commonly perform when adding business logic to Enterprise Objects applications. It includes these sections:
“Custom Classes” discusses why you need to generate class files for enterprise objects to which you want to add custom business logic.
“Providing Initial Values” teaches you how to provide values to enterprise object instances immediately upon creation.
“Adding Validation” teaches you how to validate properties and other state in enterprise object classes.
“Writing Business Methods” teaches you how to write business methods that return values based on an enterprise object’s data.
“Manipulating Relationships” teaches you how to use enterprise objects in relationships.
“Building a Reusable Framework” teaches you how to build a reusable framework of business logic that can be shared among applications.
Last updated: 2007-07-11