Persistent Object Basics

Recall that when an object is instantiated by an application, it lives only as long as the application itself. Thus, if you instantiate an Employee object that contains attributes such as name, ss#, and so on, that Employee object will cease to exist when the application terminates. Figure 11.1 illustrates the traditional object life cycle which is pretty straightforward. When an application creates an object, an object lives within the confines of that object. When the application ends, the object goes out of scope. For the object to live on, it usually must be written to some sort of persistent storage.

Figure 11.1. Object life cycle.

When the Employee object is instantiated and initialized, it has a specific state. ...

Get Object-Oriented Thought Process, The, 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.