World's most popular travel blog for travel bloggers.

Object ID and Persistency

, , No Comments

Object ID

Object identity is a property of an object that distinguishes the objects from all other objects in the applications. With object identity, objects can contain, or refer to other objects. You can create an object identity in three ways:
1) You can refer as memory address in programming languages.
2) Assign identifier keys in the database.
 3) By user-specified names, used for both programming and database. In a complete object oriented system each object is given an identity that will be permanently associated with the object irrespective of the object’s structural or state transitions. The identity of an object is also independent of the location, or address of the object. Object identity provides the most natural modeling primitive to allow the “same object to be a sub-object of multiple parent objects”.
Persistency
When you create an object, it exists for as long as you need it, but under no circumstances do object exist when the program terminates. While this makes sense at first, there are situations in which it would be incredibly useful if an object could exist  and hold its information even while the program is not running. When, next time you start the program, the object would be there and it would have the same information it had the previous time the program was running. Of course, you can get a similar effect by writing the information to a file or to a database, but in the spirit of making everything an object it would be quite convenient to be able to declare an object persistent and have all the details taken care of for you.

0 comments:

Post a Comment

Let us know your responses and feedback