Presentation is loading. Please wait.

Presentation is loading. Please wait.

Object orientation and persistent objects Dragos Chirila Finsiel Romania Copenhagen, 24 May 2004.

Similar presentations


Presentation on theme: "Object orientation and persistent objects Dragos Chirila Finsiel Romania Copenhagen, 24 May 2004."— Presentation transcript:

1 Object orientation and persistent objects Dragos Chirila Finsiel Romania Copenhagen, 24 May 2004

2 OO overview n It is a technique of modeling a real-world system in software, based on objects n It is used in many programming languages such as C++, Java, Python n Allows developers to design programs based on higher concepts rather than bits, streams and numbers n Almost anything can be modeled as an object

3 OO concepts (I) n Class u description of a set of objects that share common attributes and behavior u describes all attributes and methods that implement the behavior n Instance/object u the basic unit of OO u is an entity that has attributes, behavior and identity u objects are members of a class

4

5 OO concepts (II) n Attributes – used to store data that describe the object n Methods – the set of actions which an object may perform (synonyms: function, operation and service) n Messages – how objects communicate with each other n Lifetime – the time an object exists, from its instantiation in its constructor until the object no longer exists; controlled by programmer or user of the system in which the objects live n Inheritance – a mechanism that allows one class (subclass) to share attributes and behaviors of another class (superclass); it defines a is-a relationship between classes.

6

7 OO concepts (III) n Abstract classes – a class that has no instances n Concrete class – a class that is completely specified and can have instances n Visibility – the ability of one class to see and use the resources of another class (attributes, methods) u public, private and protected u getters and setters – allow outside world to modify/return the value of an class attribute

8 Persistence n about storing objects for later use without losing their identity, type etc. n serialization – process that turns (saves) arbitrarily complex objects into textual or binary representations of those objects n the ability to restore the serialized form of an object back into an object that is the same as the original u e.g. in Python the serialization process is called pickling

9 ZODB (I) n is a OO database system capable of storing and managing arbitrarily complex Python objects with transaction support and concurrency support. n relies upon Pythons native serialization capability n spreads object storage over multiple records u each stored persistent object has its own database record u each object has an unique id that identifies it and is used to lookup object data in the database

10 ZODB (II) n has a single designated root object, which provides access to application root objects by name n all other objects, besides root object, are accessed through object traversal from the root

11 Zope n everything is object - Root Folder, Control_Panel, acl_users are objects n Select type to add… allows you to create new objects n can be extended by creating Products that defines their own types of objects

12 Root Folder n top-level system object its a subclass of Folder class n almost each tab can be associated with a class that Folder class extends u Content – ObjectManager contains other objects u Properties – PropertyManager is a collection of typed attributes called properties which can be managed through the web or via DTML u Security – RoleManager has configurable permissions u Undo, Ownership – SimpleItem is a base class for simple, non-container objects Find – FindSupport locate Zope objects based on different criteria


Download ppt "Object orientation and persistent objects Dragos Chirila Finsiel Romania Copenhagen, 24 May 2004."

Similar presentations


Ads by Google