34.20. PersistentObject Superclass and Separation of Concerns

A common partial design solution to providing persistence for objects is to create an abstract technical services superclass PersistentObject that all persistence objects inherit from (see Figure 34.17). Such a class usually defines attributes for persistence, such as a unique OID, and methods for saving to a database.

Figure 34.17. Problems with a PersistentObject superclass.

This is not wrong, but it suffers from the weakness of coupling the class to the PersistentObject class—domain classes end up extending a technical services class.

This design does not illustrate a clear separation ...

Get Applying UML and Patterns: An Introduction to Object-Oriented Analysis and Design and the Unified Process, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.