2Object-Oriented Analysis and Design with the Unified Process Objectives  Describe the differences and similarities between relational and object-oriented.

Slides:



Advertisements
Similar presentations
Chapter 10: Designing Databases
Advertisements

Chapter 12: Designing Databases
Introduction to Databases
Systems Analysis and Design in a Changing World, 6th Edition
File Systems and Databases
Database Management: Getting Data Together Chapter 14.
CS 432 Object-Oriented Analysis and Design
Data Management Design
Ch1: File Systems and Databases Hachim Haddouti
Introduction to Databases Transparencies
Chapter 4: Database Management. Databases Before the Use of Computers Data kept in books, ledgers, card files, folders, and file cabinets Long response.
Lead Black Slide. © 2001 Business & Information Systems 2/e2 Chapter 7 Information System Data Management.
Managing Data Resources. File Organization Terms and Concepts Bit: Smallest unit of data; binary digit (0,1) Byte: Group of bits that represents a single.
LOGICAL DATABASE DESIGN
Michael F. Price College of Business Chapter 6: Logical database design and the relational model.
Introduction to Databases Transparencies 1. ©Pearson Education 2009 Objectives Common uses of database systems. Meaning of the term database. Meaning.
Introduction to Databases. Case Example: File based Processing Real Estate Agent’s office Property for sale or rent Potential Buyer/renter Staff/employees.
PHASE 3: SYSTEMS DESIGN Chapter 7 Data Design.
Chapter 3 Relational Model Chapter 4 in Textbook.
Database System Concepts and Architecture Lecture # 3 22 June 2012 National University of Computer and Emerging Sciences.
Information storage: Introduction of database 10/7/2004 Xiangming Mu.
Week 1 Lecture MSCD 600 Database Architecture Samuel ConnSamuel Conn, Asst. Professor Suggestions for using the Lecture Slides.
2Object-Oriented Analysis and Design with the Unified Process Objectives  Describe the differences and similarities between relational and object-oriented.
Copyright © 2003 by Prentice Hall Module 4 Database Management Systems 1.What is a database? Data hierarchy and data organization Field, record, file,
MIS 385/MBA 664 Systems Implementation with DBMS/ Database Management Dave Salisbury ( )
Chapter 1 Overview of Database Concepts Oracle 10g: SQL
STORING ORGANIZATIONAL INFORMATION— DATABASES CIS 429—Chapter 7.
1 Chapter 1 Overview of Database Concepts. 2 Chapter Objectives Identify the purpose of a database management system (DBMS) Distinguish a field from a.
Concepts and Terminology Introduction to Database.
CHAPTER 8: MANAGING DATA RESOURCES. File Organization Terms Field: group of characters that represent something Record: group of related fields File:
MIS 301 Information Systems in Organizations Dave Salisbury ( )
Lecture 2 An Overview of Relational Database IST 318 – DB Admin.
SQL Structured Query Language Programming Course.
CSCI 3140 Module 3 – Logical Database Design for the Relational Model Theodore Chiasson Dalhousie University.
Team Dosen UMN Database Design Connolly Book Chapter
Lecture2: Database Environment Prepared by L. Nouf Almujally & Aisha AlArfaj 1 Ref. Chapter2 College of Computer and Information Sciences - Information.
Object Persistence Design Chapter 13. Key Definitions Object persistence involves the selection of a storage format and optimization for performance.
Announcements. Data Management Chapter 12 Traditional File Approach  Structure Field  Record  File  Fixed All records have common fields, and a field.
Chapter 12: Designing Databases
2Object-Oriented Analysis and Design with the Unified Process Objectives  Describe the differences and similarities between relational and object-oriented.
Lecture2: Database Environment Prepared by L. Nouf Almujally 1 Ref. Chapter2 Lecture2.
Chapter 1Introduction to Oracle9i: SQL1 Chapter 1 Overview of Database Concepts.
Lecture # 3 & 4 Chapter # 2 Database System Concepts and Architecture Muhammad Emran Database Systems 1.
5 - 1 Copyright © 2006, The McGraw-Hill Companies, Inc. All rights reserved.
DataBase Management System What is DBMS Purpose of DBMS Data Abstraction Data Definition Language Data Manipulation Language Data Models Data Keys Relationships.
Databases Shortfalls of file management systems Structure of a database Database administration Database Management system Hierarchical Databases Network.
Chapter 1 Introduction to Databases © Pearson Education Limited 1995, 2005.
MANAGING DATA RESOURCES ~ pertemuan 7 ~ Oleh: Ir. Abdul Hayat, MTI.
Prepared By Prepared By : VINAY ALEXANDER ( विनय अलेक्सजेंड़र ) PGT(CS),KV JHAGRAKHAND.
Introduction to Database AIT632 Chapter 1 Sungchul Hong.
Chapter 9 Logical Database Design : Mapping ER Model To Tables.
Management Information Systems, 4 th Edition 1 Chapter 8 Data and Knowledge Management.
Managing Data Resources. File Organization Terms and Concepts Bit: Smallest unit of data; binary digit (0,1) Byte: Group of bits that represents a single.
Lection №4 Development of the Relational Databases.
IAD 2263: System Analysis and Design Chapter 7: Designing System Databases, Interfaces and Security.
BSA206 Database Management Systems Lecture 2: Introduction to Oracle / Overview of Database Concepts.
2Object-Oriented Analysis and Design with the Unified Process OBJECTIVES  Describe the differences and similarities between relational and object-oriented.
INFORMATION X INFO425: Systems Design Chapter 13 Database Design.
Modelling Methodologies Chapter 16, 17, 18. Modeling Methodologies2 Database Design Physical DB design Logical DB design Conceptual DB design Hardware.
Chapter 18 Object Database Management Systems. Outline Motivation for object database management Object-oriented principles Architectures for object database.
Overview/Review of DB Logical Design ER Model to Relational Model Mapping.
Logical Design 12/10/2009GAK1. Learning Objectives How to remove features from a local conceptual model that are not compatible with the relational model.
1 10 Systems Analysis and Design in a Changing World, 2 nd Edition, Satzinger, Jackson, & Burd Chapter 10 Designing Databases.
Data Models. 2 The Importance of Data Models Data models –Relatively simple representations, usually graphical, of complex real-world data structures.
1 Management Information Systems M Agung Ali Fikri, SE. MM.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 The Relational Model Chapter 3.
Managing Data Resources File Organization and databases for business information systems.
12. Chapter 12: Designing Databases Systems Analysis and Design in a Changing World, Fourth Edition 12.
MANAGING DATA RESOURCES
Presentation transcript:

2Object-Oriented Analysis and Design with the Unified Process Objectives  Describe the differences and similarities between relational and object-oriented database management systems  Design an object database schema based on a class diagram  Design a relational database schema based on a class diagram

3Object-Oriented Analysis and Design with the Unified Process Objectives (continued)  Describe object-oriented design issues, including data access classes and data types  Describe the different architectural models for distributed databases  Determine when and how to design the database

4Object-Oriented Analysis and Design with the Unified Process Overview  Databases provide a common repository for data  Database management systems provide sophisticated capabilities to store, retrieve, and manage data  Detailed database models are derived from domain class diagrams  Database models are implemented using database management systems  Databases can be relational or OO models

5Object-Oriented Analysis and Design with the Unified Process Databases and Database Management Systems  A database is an integrated collection of stored data that is centrally managed and controlled  Class attributes  Associations  Descriptive information about data and access controls  A DBMS is a system software component that manages and controls access to the database  Ex. - Oracle, Gemstone, ObjectStore, Access, DB2

6Object-Oriented Analysis and Design with the Unified Process DBMS Components  Database  Physical data store ◘Raw bit and bytes of the database  Schema ◘Access and data controls, associations among attributes, details of physical data store  DBMS  Interfaces to access schema and extract information for valid requests  Data access programs and subroutines

7Object-Oriented Analysis and Design with the Unified Process Figure 10-1 The components of a database and a database management system and their interaction with application programs, users, and database administrators

8Object-Oriented Analysis and Design with the Unified Process Database Models  Database models have evolved since their introduction in the 1960s  Hierarchical  Network  Relational  Object-oriented  Most existing and newly developed systems use the relational or object-oriented approach

9Object-Oriented Analysis and Design with the Unified Process Object-Oriented Databases  Object Database Management System (ODBMS)  Stores data as objects  Prototypes introduced in 1980s  Technology of choice for newly designed systems  Object Definition Language (ODL)  Standard developed by the ODMG for defining the structure and content of an object database  Java Data Objects (JDO)  Java-specific object database standard

10Object-Oriented Analysis and Design with the Unified Process Designing Object Databases  Determine which classes require persistent storage  Represent persistent classes  Represent associations among persistent classes  Choose appropriate data types and value restrictions (if necessary) for each field

11Object-Oriented Analysis and Design with the Unified Process Representing Classes  An object database schema requires a class definition for each persistent class  ODL class definitions derive from the domain model class diagram Class Customer { attribute string accountNo attribute string name attribute string billingAddress attribute string shippingAddress attribute string dayTelephoneNumber attribute string nightTelephoneNumber }

12Object-Oriented Analysis and Design with the Unified Process Representing Associations  ODBMSs represent associations by storing the object identifier of one object within related objects  Use attributes with object identifiers to find related objects (called navigation)  Designers represent associations indirectly by declaring associations between objects  Use keywords relationship and inverse  ODBMS automatically creates object identifiers for declared associations

13Object-Oriented Analysis and Design with the Unified Process Figure 10-5 A one-to-many association represented with attributes containing object identifiers

14Object-Oriented Analysis and Design with the Unified Process One-to-Many Relationships  Partial ODL class definition Class Customer { attribute string accountNo … relationship set Makes inverse Order::MadeBy } Class Order { attribute string orderID … relationship Order MadeBy inverse Customer::Makes }

15Object-Oriented Analysis and Design with the Unified Process Figure 10-7 A many-to-many association represented with two one-to-many associations

16Object-Oriented Analysis and Design with the Unified Process Many-to-Many Relationships  ODL uses multivalued attributes and an association class Class Catalog { … relationship set Contains1 inverse CatalogProduct::AppearsIn1 } Class ProductItem { … relationship set AppearsIn2 inverse CatalogProduct::Contains2 } Class CatalogProduct { attribute real specialPrice … relationship Catalog AppearsIn1 inverse Catalog::Contains1 relationship ProductItem AppearsIn2 inverse ProductItem::Contains2 }

17Object-Oriented Analysis and Design with the Unified Process Figure 10-8 A generalization hierarchy within the RMO class diagram

18Object-Oriented Analysis and Design with the Unified Process Generalization Associations  ODL uses keyword extends Class Order { attribute string orderID … } Class WebOrder extends Order { attribute string Address … } Class TelephoneOrder extends Order { attribute string phoneClerk … } …

19Object-Oriented Analysis and Design with the Unified Process Relational Databases  Organized data into structures called tables  Tables contain rows (records) and columns (attributes)  Keys are the basis for representing relationship among tables  Each table must have a unique key  A primary key uniquely identifies a row in a table  A foreign key duplicates the primary key in another table  Keys may be natural or invented

20Object-Oriented Analysis and Design with the Unified Process Figure A portion of the RMO class diagram

21Object-Oriented Analysis and Design with the Unified Process Figure An association between data in two tables; the foreign key ProductID in the InventoryItem refers to the primary key ProductID in the ProductItem table.

22Object-Oriented Analysis and Design with the Unified Process Designing Relational Databases  Steps to create a relational schema from a class diagram  Create a table for each class  Choose a primary key for each table (invent one, if necessary)  Add foreign keys to represent one-to-many relationships  Create new tables to represent many-to-many relationships

23Object-Oriented Analysis and Design with the Unified Process Designing Relational Databases (continued)  Represent classification hierarchies  Define referential integrity constraints  Evaluate schema quality and make necessary improvements  Choose appropriate data types and value restrictions (if necessary) for each field

24Object-Oriented Analysis and Design with the Unified Process Figure Class tables with primary keys identified in bold

25Object-Oriented Analysis and Design with the Unified Process Figure Represent one-to-many associations by adding foreign key attributes (shown in italics)

26Object-Oriented Analysis and Design with the Unified Process Figure The table CatalogProduct is modified to represent the many-to- many association between Catalog and ProductItem

ER into RDB: Exercise  Example: Staff IsAllocated Branch Oversees Property Has StaffNo PropNo BranchNo M M 1M M 1 Rent Address Percent TelNo

Transforming ER into RDB  Example: Staff (StaffNo, Address, …) Branch (BranchNo, TelNo, …) Property (PropNo, Rent, …, StaffNo, BranchNo) IsAllocated (StaffNo, BranchNo, Percent) Staff IsAllocated Branch Oversees Property Has StaffNo PropNo BranchNo M M 1M M 1 Rent Address Percent TelNo Note: Underline attributes are PKs and italics are FKs; an attribute can be both PK and FK

29Object-Oriented Analysis and Design with the Unified Process Classification Hierarchies  Two approaches to represent hierarchies among tables  Combine all tables into a single table containing the superset of all class attributes but excluding invented keys of the child classes ◘See the Order class in Figure  Use separate tables to represent the child classes, and use the primary key of the parent class table as the primary key of the child class tables ◘See Figure 10-16

30Object-Oriented Analysis and Design with the Unified Process Figure Specialized classes of Order are represented as separate tables with OrderID as both primary and foreign key

31 Storing Objects in Relational Databases

32 Mapping Classes to Relations Number of strategies for mapping classes to relations, although each results in a loss of semantic information. (1) Map each class or subclass to a relation: Staff (staffNo, fName, lName, position, sex, DOB, salary) Manager (staffNo, bonus, mgrStartDate) SalesPersonnel (staffNo, salesArea, carAllowance) Secretary (staffNo, typingSpeed)

33 Mapping Classes to Relations (2) Map each subclass to a relation Manager (staffNo, fName, lName, position, sex, DOB, salary, bonus, mgrStartDate) SalesPersonnel (staffNo, fName, lName, position, sex, DOB, salary, salesArea, carAllowance) Secretary (staffNo, fName, lName, position, sex, DOB, salary, typingSpeed) (3) Map the hierarchy to a single relation Staff (staffNo, fName, lName, position, sex, DOB, salary, bonus, mgrStartDate, salesArea, carAllowance, typingSpeed, typeFlag)

34Object-Oriented Analysis and Design with the Unified Process Enforcing Referential Integrity  Every foreign key must also exist as a primary key value  The DBMS usually automatically enforces referential integrity after the designer has identified primary and foreign keys  Any new row containing an unknown foreign key value is rejected  If a primary key is deleted or modified, the DBMS can be instructed to set all corresponding foreign keys to NULL

35Object-Oriented Analysis and Design with the Unified Process Evaluating Schema Quality  A high-quality data model has:  Uniqueness of table rows and primary keys ◘Use internally invented keys  Lack of redundant data ◘Non-key attributes are stored only once  Ease of implementing future data model changes ◘New associations only require adding a foreign key (one-to-one) or a new table (many-to-many)

36Object-Oriented Analysis and Design with the Unified Process Database Normalization  Normalization is a technique to ensure database schema quality by minimizing redundancy  First normal form: no repeating attributes or groups of attributes in a table  Functional dependency: a one-to-one correspondence between two attribute values  Second normal form: every non-key attribute is functionally dependent on the primary key  Third normal form: no non-key attribute is functionally dependent on any non-key attribute

37Object-Oriented Analysis and Design with the Unified Process Figure A simplified RMO CatalogProduct table The primary key of CatalogProduct is the combination of CatalogID and ProductID, but CatalogIssueDate is only functionally dependent on CatalogID. This table is not in 2NF.

38Object-Oriented Analysis and Design with the Unified Process Figure Decomposition of a first normal form table into two second normal form tables

39Object-Oriented Analysis and Design with the Unified Process Figure Converting a second normal form table into two third normal form tables State is functionally dependent on ZipCode

40Object-Oriented Analysis and Design with the Unified Process Domain Class Modeling and Normalization  Domain class modeling and normalization are complimentary techniques  Attributes of a class are functionally dependent on any primary key of that class  Attributes of a many-to-many association are functionally dependent on unique identifiers of both participating classes  Tables generated from the RMO class diagram do not contain any 1NF, 2NF, or 3NF violations

41Object-Oriented Analysis and Design with the Unified Process Object-Relational Interaction  Hybrid object-relational databases are the most widely used approach for persistent object storage  A relational database that stores object attributes and relationships

42Object-Oriented Analysis and Design with the Unified Process Object-Relational Interaction  Designing an interface between persistent classes and the RDBMS is complex  Class methods cannot be directly stored or executed in an RDBMS  Inheritance cannot be directly represented in an RDBMS  New classes must be defined to store application- specific data

43Object-Oriented Analysis and Design with the Unified Process Data Access Classes  Data access classes implement the bridge between data stored in program objects and in a relational database  Data access class methods encapsulate the logic needed to copy values from the problem domain objects to the database, and vice versa ◘The logic is a combination of program code and embedded SQL commands

44Object-Oriented Analysis and Design with the Unified Process Figure Interaction among a problem domain class, a data access class, and the DBMS

45Object-Oriented Analysis and Design with the Unified Process Data Types  A data type defined the storage format and allowable content of a program variable or database attribute  Primitive data types are supported directly by computer hardware or a programming language ◘i.e., integer, Boolean, memory address  Complex data types are user or programmer defined ◘i.e., date, time, currency

46Object-Oriented Analysis and Design with the Unified Process Figure A subset of the data type available in the Oracle relational DBMS

47Object-Oriented Analysis and Design with the Unified Process Object DBMS Data Types  Similarities to RDBMS  Provides a set of primitive and complex data types  Allows a designer to define format and value constraints  Differences to RDBMS  Allows a schema designer to define a new data type and associated constraints as a new class ◘Class methods can perform many of the error- and type- checking functions

48Object-Oriented Analysis and Design with the Unified Process Distributed Databases  Approaches to organizing computers and other information-processing resources in a networked environment  Single database servers  Replicated database servers  Partitioned database servers  Federated database servers  A combination of the above

49Object-Oriented Analysis and Design with the Unified Process Single Database Servers  Clients on more or more LANs share a single database located on a single computer system  Advantages  Simplicity  Disadvantages  Susceptibility to server failure  Possible overload of the network or server  Performance bottlenecks or propagation delays

50Object-Oriented Analysis and Design with the Unified Process Figure A single database server architecture

51Object-Oriented Analysis and Design with the Unified Process Replicated Database Servers  Clients interact with the database server on their own LAN  Each server stores a separate copy of the data  Advantages  Fault tolerant  Load balancing possible  Disadvantages  Must implement database synchronization techniques

52Object-Oriented Analysis and Design with the Unified Process Figure A replicated database server architecture

53Object-Oriented Analysis and Design with the Unified Process Partitioned Database Servers  Partitions database among multiple database servers  A different group of clients accesses each partition  Advantages  Minimizes need for database synchronization  Disadvantages  Schema must be cleanly partitioned among client access groups  Members of client access group must be located in small geographic regions

54Object-Oriented Analysis and Design with the Unified Process Figure Partitioning a database schema into client access subsets

55Object-Oriented Analysis and Design with the Unified Process Federated Database Servers  Used to access data stored on incompatible storage models or DBMSs  A combined database server acts an intermediary, sending requests to underlying database servers  Advantages  Only feasible approach for implementing data warehouses  Disadvantages  Extremely complex

56Object-Oriented Analysis and Design with the Unified Process Figure A federated database server architecture

57Object-Oriented Analysis and Design with the Unified Process RMO Distributed Database Architecture  Two possible approaches  Single server architecture ◘Simple to implement, but high WAN requirements and risk of server failure  Combination of partitioning and replication ◘Reduced fault tolerance and WAN requirements, but need for additional database servers and synchronization techniques  Decision based on analysis of cost and desired system performance

58Object-Oriented Analysis and Design with the Unified Process Figure A replicated and partitioned database server architecture for RMO

59Object-Oriented Analysis and Design with the Unified Process Database Design Within the UP  Primary factors for when and how to perform database design  Architecture ◘Integrate database design with network design, Web component services, and security decisions  Existing databases ◘Accommodate preexisting constraints  Domain class diagram ◘Related parts must be developed before database design

60Object-Oriented Analysis and Design with the Unified Process Summary  One of the key activities in design is developing a relational or object database schema  Schemas are developed from class diagrams  An object database stores data as a collection of related objects ◘Associations are represented by storing unique object identifiers in related objects  A relational database stores data in tables ◘Associations are represented with foreign keys

61Object-Oriented Analysis and Design with the Unified Process Summary (continued)  Architecture for multiple databases  Replicated ◘Multiple copies on different servers  Partitioned ◘Partial copies placed in proximity to user subsets  Federated ◘Multiple databases with a DBMS single point of access  Database design should be performed in an early iteration to minimize risk