Slide 19.1 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. An Introduction to Object-Oriented Systems Analysis and Design with UML and the Unified Process McGraw-Hill, 2004 Stephen R. Schach [email protected]
Dec 21, 2015
Slide 19.1
Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved.
An Introduction toObject-Oriented
Systems Analysis and Design with UML and
the Unified Process
McGraw-Hill, 2004
Stephen R. Schach
Slide 19.2
Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved.
CHAPTER 19
INTRODUCTION TO DATABASE MANAGEMENT SYSTEMS
Slide 19.3
Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved.
Chapter Overview
Files and Their Problems Tables Traditional Database Systems Object-Oriented Database Systems Database Design and the Unified Process The Future of Object-Oriented Database
Management Systems
Slide 19.4
Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved.
Definitions
Database– A collection of data records organized to facilitate the
storage and retrieval of the data by information systems
Database management system– The software that runs a database
Slide 19.5
Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved.
Files and Their Problems
The mailing list for STAMbury Philatelic Society (STAMPS)
Version 1: Typewriter– Data are volatile– This approach is totally unacceptable
Slide 19.6
Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved.
Files and Their Problems (contd)
Version 2: Computer files
Two independent programs– Program A: Writes name and address data to disk– Program B: Prints mailing labels from the file data
Slide 19.7
Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved.
Files and Their Problems (contd)
Deployment diagram of a computer and its disk
Slide 19.8
Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved.
Files and Their Problems (contd)
Version 3: Program A needs to be modified– Members resign– Members change their names and addresses, – New members join
Program A needs to be a CRUD program– Create– Read– Update and – Delete
Program B is unchanged
Slide 19.9
Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved.
Files and Their Problems (contd)
Statechart for Version 3
Slide 19.10
Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved.
Files and Their Problems (contd)
Typical data used by Program B
Slide 19.11
Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved.
Files and Their Problems (contd)
Topical (or thematic) stamp collectors– Collect stamps relating to a specific topic
STAMPS members collect stamps that depict– Chess games– Fictional detectives– Elephants
Slide 19.12
Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved.
Files and Their Problems (contd)
Version 4: STAMPS now wants to send out separate mailings to members of the three topical groups
Alternative 1:– Program A is changed to incorporate topical interests– Program B is modified accordingly
Slide 19.13
Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved.
Files and Their Problems (contd)
The topical collecting interests of six members of STAMPS
Slide 19.14
Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved.
Files and Their Problems (contd)
Alternative 2:– Do not change Program A or Program B– Divide the data file into three separate files,one for each
topical group
Slide 19.15
Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved.
Files and Their Problems (contd)
Separate files for each topical group
Slide 19.16
Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved.
Files and Their Problems (contd)
Problem 1:– A mailing to all members of stamps can lead to duplication
or triplication» Example: Ngaio Alleyn
– Redundant information
Slide 19.17
Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved.
Files and Their Problems (contd)
Problem 2:– A change of address may require changes to more than
one file» Example: Ngaio Alleyn
– Update anomaly
Slide 19.18
Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved.
Files and Their Problems (contd)
Problem 3:– Deletion from a topical group may result in removal from
the STAMPS database» Example: Dorothy Wimsey
– Deletion anomaly
Slide 19.19
Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved.
Tables
Membership list table incorporating membership number
Slide 19.20
Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved.
Tables (contd)
Membership tables for the three topical groups
Slide 19.21
Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved.
Tables (contd)
This solves all three problems
Problem 1: – To send a mailing to all members, extract (unique) data
from the membership list table– Program B requires minor changes to handle membership
numbers
Slide 19.22
Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved.
Tables (contd)
Problem 2: – A change of address is made to the (unique) entry in the
membership list table
Slide 19.23
Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved.
Tables (contd)
Problem 3: – A deletion from the membership table of a topical group
does not change the membership list table entry
Slide 19.24
Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved.
Tables (contd)
To print mailing labels for just the members of one topical group, modify Program B to – Read each membership number from the membership list
of that topical group, and– Look up the corresponding name and address in the
membership list table
Slide 19.25
Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved.
Tables (contd)
The information system can be extended to incorporate additional information
Slide 19.26
Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved.
Traditional Database Systems
Almost all traditional database management systems are relational– Data are stored in tables– The primary key labels primary records– The primary key can be used to label records in other
tables—foreign key
Slide 19.27
Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved.
Traditional Database Systems (contd)
The software of the STAMPS information system is explicitly written to manage the data– Program A and Program B
Slide 19.28
Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved.
Traditional Database Systems (contd)
Information systems use a database management system for– Writing of data to disk and – Retrieval of data from the disk
Examples:– Mainframe: DB2, Oracle, Informix, Sybase– Personal computers: Microsoft Access
Slide 19.29
Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved.
Traditional Database Systems (contd)
Database instructions are embedded within the source code, frequently written in COBOL
Slide 19.30
Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved.
Traditional Database Systems (contd)
Finding the address of policyholder Joe Soap can be achieved with the database instruction
retrieve address of policyHolder
where firstName of policyHolder is "Joe"
and lastName of policyHolder is "Soap"
Slide 19.31
Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved.
Traditional Database Systems (contd)
The COBOL code first passes through a precompiler – To convert the instructions to the database management
system into COBOL
The resulting all-COBOL program is then compiled, linked, and run in the usual way
When the database instruction is executed– The database management system searches the
database for Joe Soap, and– Returns his address to the COBOL program
Slide 19.32
Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved.
Traditional Database Systems (contd)
Execution of the database instruction
Slide 19.33
Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved.
Traditional Database Systems (contd)
Database instructions can be embedded within many traditional programming languages– Including C and COBOL
Typical database instructions include – Retrieve– Insert– Delete, and– Update
Slide 19.34
Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved.
Traditional Database Systems (contd)
The database management system manages the database itself
The programmer writes code to– Invoke the database management system, and – Provide it with data it needs
Slide 19.35
Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved.
Object-Oriented Database Systems
A company with a traditional database management system is unlikely to use object-oriented database management systems for some time
They are still too complex– An extensive background in object-oriented database
theory is needed
Slide 19.36
Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved.
Object-Oriented Database Systems (contd)
When an existing database is converted into an object-oriented database– The existing traditional information systems cannot access
the new database– They have to be totally rewritten, at enormous cost
Slide 19.37
Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved.
Object-Oriented Database Systems (contd)
Solution 1: Two databases– The one traditional, and– The other object-oriented
Slide 19.38
Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved.
Object-Oriented Database Systems (contd)
However, a major reason for using a database is to have just one copy of each record
Two databases means having– Two copies of all data, and– Two versions of every new information system
This is totally ridiculous
Slide 19.39
Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved.
Object-Oriented Database Systems (contd)
Solution 2: A hybrid system– An object-oriented information system interfacing with a
traditional database management system– Instructions are embedded in C++ or Java code
Slide 19.40
Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved.
Object-Oriented Database Systems (contd)
The database management system must– Manage the database (as before), and– Perform conversions from traditional to object-oriented
systems, and vice versa
Slide 19.41
Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved.
Object-Oriented Database Systems (contd)
When writing data to the traditional database it must– Extract the data from an object– Convert the data into a record, and– Write the record to the traditional database
After retrieving a record from the traditional database, it must– Insert the record into an object
Slide 19.42
Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved.
Database Design and the Unified Process
Using a database management system is easy, but
Designing a database requires specialized skills– Including detailed knowledge of the theory of databases
Slide 19.43
Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved.
Database Design and the Unified Process
The Information Systems curriculum usually includes at least one course on databases– This material is not included in the Systems Analysis and
Design course
Similarly– The Unified Process does not include database design
Slide 19.44
Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved.
Future of O-O Database Management Systems
Object-oriented database management systems will become as easy to use as traditional database management systems
It will still be too expensive to convert existing databases and information systems to the object-oriented paradigm– However, new information systems will be written using
the object-oriented paradigm, but will interface with the traditional database
Slide 19.45
Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved.
Future of O-O Database Management Systems
New companies will use the object-oriented paradigm for both – Its information systems, and– Its database management system
Slide 19.46
Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved.
Object-Oriented Database Systems (contd)
Legacy systems are the biggest obstacle to the widespread utilization of object-oriented database management systems– Just as they are to object-oriented information systems in
general
Slide 19.47
Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved.
Object-Oriented Database Systems (contd)
The object-oriented paradigm is the current choice for the development of new information systems– This will lead to the adoption of object-oriented database
systems in the future