Shanghai Jiao Tong University 上海交通大学 Object Oriented Analysis and Design Database Design 上海交通大学软件工程中心
Shanghai Jiao Tong University 上海交通大学软件工程中心 Object Oriented Analysis and Design Database Design
Database Design in Context [Early Elaboration [Inception Iteration] Iteration (Optional)] Define a Candidate Perform Architecture Architectural L Synthesis Analyze Behavior Refine the (Optional) Architecture 皮 Database Database Define Design the Designer Design Components Database Object Oriented Analysis and Design 2
Object Oriented Analysis and Design 2 Database Design in Context [Early Elaboration Iteration] [Inception Iteration (Optional)] Define a Candidate Architecture Perform Architectural Synthesis Analyze Behavior Refine the Architecture Define Components Design the Database (Optional) Database Design Database Designer
Database Design Overview Supplementary Specifications Database Use-Case Realization Design Data Model Project Specific Guidelines Object Oriented Analysis and Design 3
Object Oriented Analysis and Design 3 Database Design Overview Supplementary Specifications Database Use-Case Realization Design Project Specific Guidelines Data Model
Outline Map persistent design classes to the data model Distribute class behavior to the database Object Oriented Analysis and Design 4
Object Oriented Analysis and Design 4 Outline Map persistent design classes to the data model Distribute class behavior to the database
Outline Map persistent design classes to the data model Distribute class behavior to the database LK1XX9 Object Oriented Analysis and Design 5
Object Oriented Analysis and Design 5 Outline Map persistent design classes to the data model Distribute class behavior to the database
Relational Databases and Object Orientation RDBMS and Object Orientation are not entirely compatible RDBMS ·Focus is on data Better suited for ad-hoc relationships and reporting application Expose data (column values) Object Oriented system ·Focus is on behavior Better suited to handle state-specific behavior where data is secondary Hide data (encapsulation) Object Oriented Analysis and Design 6
Object Oriented Analysis and Design 6 RDBMS and Object Orientation are not entirely compatible ▪ RDBMS • Focus is on data • Better suited for ad-hoc relationships and reporting application • Expose data (column values) ▪ Object Oriented system • Focus is on behavior • Better suited to handle state-specific behavior where data is secondary • Hide data (encapsulation) Relational Databases and Object Orientation
The Relational Data Model Relational model is composed of Entities Relations Entity Relation ORDER LINE ITEM products Order_ld Lineltem_ld lineltems Description Price PRODUCT lineltem order Quantity Product_ld Product_ld Order_ld Name Price Columns Object Oriented Analysis and Design
Object Oriented Analysis and Design 7 The Relational Data Model Relational model is composed of ▪ Entities ▪ Relations ORDER LINE ITEM PRODUCT Order_Id LineItem_Id Description Price Quantity Product_Id Order_Id Product_Id Name Price lineItem order products lineItems Entity Relation Columns
The Object Model The Object Model is composed of ■ Classes (attributes) Associations Order Lineltem +lineltems -number Integer -quantity Integer +order 1.* number Integer Product number Integer description:String unitPrice:Double Software Product Hardware Product version Double assembly String Object Oriented Analysis and Design 8
Object Oriented Analysis and Design 8 The Object Model The Object Model is composed of ▪ Classes (attributes) ▪ Associations LineItem - quantity : Integer - number : Integer 1..* +lineItems Order - number : Integer +order Product - number : Integer - description : String - unitPrice : Double 1 Software Product - version : Double Hardware Product - assembly : String
Persistence Frameworks ◆ The challenge: Changes should not break the Business model Object Model The solution:An object-relational framework that Encapsulates the physical data store .Compact interfaces .Object-relational translation Provides object translation services .Encapsulates data store ◆ The importance of the framework Relational Database 30%of development time is spent in accessing an RDBMS Maintenance can be 60%of total cost Object Oriented Analysis and Design 9
Object Oriented Analysis and Design 9 Persistence Frameworks The challenge: ▪ Changes should not break the model The solution: An object-relational framework that ▪ Encapsulates the physical data store ▪ Provides object translation services The importance of the framework ▪ 30% of development time is spent in accessing an RDBMS ▪ Maintenance can be 60% of total cost Business Object Model Relational Database •Compact interfaces •Object-relational translation •Encapsulates data store
Object-Relational Framework:Characteristics ◆Performance Decomposing objects to data Composing objects from data Minimize design compromises Limit changes to object and relational models ◆Extensibility 15%-35%of the framework needs to be designed as an extensible framework Object Oriented Analysis and Design 10
Object Oriented Analysis and Design 10 Object-Relational Framework: Characteristics Performance ▪ Decomposing objects to data ▪ Composing objects from data Minimize design compromises ▪ Limit changes to object and relational models Extensibility ▪ 15%-35% of the framework needs to be designed as an extensible framework