/
Object Oriented Programming Object Oriented Programming

Object Oriented Programming - PDF document

marina-yarberry
marina-yarberry . @marina-yarberry
Follow
414 views
Uploaded On 2016-07-08

Object Oriented Programming - PPT Presentation

Object Persistence Object Oriented Programming Object Serialization Object Oriented Programming ID: 395946

Object Persistence Object Oriented Programming Object Serialization Object

Share:

Link:

Embed:

Download Presentation from below link

Download Pdf The PPT/PDF document "Object Oriented Programming" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

Object Oriented Programming Object Persistence Object Oriented Programming Object Serialization Object Oriented Programming •Simple persistence method which provides a program •Allows Java objects to be encoded into a byte stream •The class must implement the methods, and have accessorsand mutatorsfor its Object Oriented Programming •Most Client-Server applications use a RDBMS as their •Objects must be mapped to tables in the database •Applications generally require the use of SQL •“Impedance mismatch” Object Oriented Programming •There are essentially three approaches which have Object Oriented Programming •standard developed by the Committee on Data Systems Languages •allows one-to-one or one-to-many relationships between entities•allows multiple parentage –a single entity can be at the “many” •navigational Object Oriented Programming •most programming languages are now object-orientedObject Data Model–offers persistenceto objects, including their associations, attributes and operations–requirements specified by Atkinson–navigational –a step backwards frObject-Relational Model–hybrid (or “post-relational”) model –objects can be stored within relational database tables–proposed by Stonebraker(1990)–no accepted standards, but ORDBMS features supported by major commercial RDBMSssuch as Oracle Object Oriented Programming Object Relational Mapping Object Oriented Programming •Vertical mapping Object Oriented Programming •Horizontal mapping Object Oriented Programming •Filtered mapping Object Oriented Programming OR Mapping: Many-to-Many Object Oriented Programming Object Data Model Object Oriented Programming •RDBMS–entities are uniquely identified by primary keys–relationships are represented by matching primary key-–Identification •Object-oriented database –stores object identifiers (OIDs) other objects to which it is related.–The object identifier is not vi–An object Object Oriented Programming •Objects can change their state values, and are •Another component of the object data model is the •A literal is described as being Object Oriented Programming •In the diagram all relationships have •Inverse relationships are optional but can be used to •Without an inverse relationship, there is nothing to •The inverse ensures that an Object Oriented Programming •unlike relational model, the object data model allows •class at “many” end has attribute to hold OID of parent (see OrderItemin the figure above)•class at “one” end has attribute to hold a related OIDs(see CustomerOrderin the figure) Object Oriented Programming •These relationships can be represented because the object-oriented •For example, a company needs to store information about Employees. has an attribute to store a •This situation can be modelled easily in an object-oriented system. For public class SalesRepextends Employee { Object Oriented Programming •Orthogonalitycan be described by saying that feature A is n't have to care about feature •Orthogonal persistence is a form of object persistence which adheres to the following principlprinciple of persistence independence –programs look the same whether they manipulate long-term or principle of data type orthogonality–all data objects are allowed to be persistent irrespective of their principle of persistence identification–the mechanism for identifying persistent objects is not related to Object Oriented Programming The ODMG Proposed Standard•One of the crucial factors in the commercial success of RDBMSsis the relative standardisation of the data model•The Object Data Management Group (ODMG) was formed by a group of•It is still far from being as widely •The ODMG proposed standard defines the following aspects of an OODBMS:–basic terminology–data types–classes and inheritance–objects–collection objects (including sets, bags, lists, arrays)–structured objects (Date, Interval, Time, Timestamp –similar to SQL)–relationships–object definition language (ODL)–object query language (OQL) Object Oriented Programming •In general, RDBMSsare probably more suitable for applications), while OODBMSsare appropriate for access will follow predictable patterns (e.gCAD/CAM Object Oriented Programming •Versant•ObjectStoreand PSE Pro from eXcelon•Objectivity/DB•IntersystemsCache•POET fastObjects•Computer Associates Jasmine•GemStone Object Oriented Programming ORDB Example -Oraclefirst_nameCHAR (15),last_nameCHAR (15),middle_initialCHAR (1);Code to define operations –in this case simply a class constructorfirst_name:= NULL;last_name:= NULL;middle_initial:= NULL;Using the new type in a tableperson_IDNUMBER;person_nameName, Object Oriented Programming •Key features:–the programmer can work only with objects –no SQL –selected objects are initially marked as being persistent –have to write code specifically to update the database–the framework handles the mapping of the objects to ere they are actually stored–mapping of objects to database tables is usually defined in Object Oriented Programming •Sun’s Enterprise JavaBeans (EJB),•There are also open-source OR mapping frameworks which ObJectRelationalBridge(OJB)•Commercial products such as •Some OR frameworks, including Hibernate and OJB, are Object Oriented Programming Object Oriented Programming •Class Player•Has attributes name and squadNumber•The application needs to store information about •How do we do this? Object Oriented Programming •To do this, we write a Data Access •Each entity class in the system •The DAO for Player must have a Player - name: String- squadNumber: int + setName(String) : void+ getName() : String+ setSquadNumber(int) : void+ getSquadNumber() : int PlayerDAO + store(Player) : void + getByName(String) : Player Object Oriented Programming •Since only the PlayerDAOclass contains any •So we can change the application to use a completely •The following version of PlayerDAOuses •db4o stores data using the object model in a single •Note that there is no SQL in this code –objects are Object Oriented Programming Further Reading