* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download An Introduction to Object-Oriented Systems Analysis and
Survey
Document related concepts
Transcript
Slide 19.1 An Introduction to Object-Oriented Systems Analysis and Design with UML and the Unified Process McGraw-Hill, 2004 Stephen R. Schach [email protected] Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. CHAPTER 19 Slide 19.2 INTRODUCTION TO DATABASE MANAGEMENT SYSTEMS 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 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Slide 19.3 Definitions Slide 19.4 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 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 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Slide 19.5 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 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Slide 19.6 Files and Their Problems (contd) Slide 19.7 Deployment diagram of a computer and its disk 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 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Slide 19.8 Files and Their Problems (contd) Statechart for Version 3 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Slide 19.9 Files and Their Problems (contd) Typical data used by Program B Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Slide 19.10 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 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Slide 19.11 Files and Their Problems (contd) Slide 19.12 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 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Files and Their Problems (contd) Slide 19.13 The topical collecting interests of six members of STAMPS Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Files and Their Problems (contd) Slide 19.14 Alternative 2: – Do not change Program A or Program B – Divide the data file into three separate files,one for each topical group Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Files and Their Problems (contd) Separate files for each topical group Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Slide 19.15 Files and Their Problems (contd) Slide 19.16 Problem 1: – A mailing to all members of stamps can lead to duplication or triplication » Example: Ngaio Alleyn – Redundant information Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Files and Their Problems (contd) Slide 19.17 Problem 2: – A change of address may require changes to more than one file » Example: Ngaio Alleyn – Update anomaly Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Files and Their Problems (contd) Slide 19.18 Problem 3: – Deletion from a topical group may result in removal from the STAMPS database » Example: Dorothy Wimsey – Deletion anomaly Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Tables Slide 19.19 Membership list table incorporating membership number Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Tables (contd) Membership tables for the three topical groups Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Slide 19.20 Tables (contd) This solves all three problems Problem 1: Slide 19.21 – To send a mailing to all members, extract (unique) data from the membership list table – Program B requires minor changes to handle membership numbers Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Tables (contd) Slide 19.22 Problem 2: – A change of address is made to the (unique) entry in the membership list table Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Tables (contd) Slide 19.23 Problem 3: – A deletion from the membership table of a topical group does not change the membership list table entry Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Tables (contd) Slide 19.24 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 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Tables (contd) The information system can be extended to incorporate additional information Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Slide 19.25 Traditional Database Systems Slide 19.26 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 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Traditional Database Systems (contd) Slide 19.27 The software of the STAMPS information system is explicitly written to manage the data – Program A and Program B 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 Slide 19.28 Examples: – Mainframe: DB2, Oracle, Informix, Sybase – Personal computers: Microsoft Access 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 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Slide 19.29 Traditional Database Systems (contd) Slide 19.30 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" Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Traditional Database Systems (contd) Slide 19.31 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 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Traditional Database Systems (contd) Execution of the database instruction Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Slide 19.32 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 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Slide 19.33 Traditional Database Systems (contd) Slide 19.34 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 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Object-Oriented Database Systems Slide 19.35 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 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Object-Oriented Database Systems (contd) Slide 19.36 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 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Object-Oriented Database Systems (contd) Slide 19.37 Solution 1: Two databases – The one traditional, and – The other object-oriented Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Object-Oriented Database Systems (contd) Slide 19.38 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 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Object-Oriented Database Systems (contd) Slide 19.39 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 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Object-Oriented Database Systems (contd) Slide 19.40 The database management system must – Manage the database (as before), and – Perform conversions from traditional to object-oriented systems, and vice versa Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Object-Oriented Database Systems (contd) Slide 19.41 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 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Database Design and the Unified Process Slide 19.42 Using a database management system is easy, but Designing a database requires specialized skills – Including detailed knowledge of the theory of databases Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Database Design and the Unified Process Slide 19.43 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 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Future of O-O Database Management Systems Slide 19.44 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 objectoriented paradigm – However, new information systems will be written using the object-oriented paradigm, but will interface with the traditional database Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Future of O-O Database Management Systems Slide 19.45 New companies will use the object-oriented paradigm for both – Its information systems, and – Its database management system Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Object-Oriented Database Systems (contd) Slide 19.46 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 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Object-Oriented Database Systems (contd) Slide 19.47 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 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved.