25
Structured Design and Modeling CS 123/CS 231

Structured Design and Modeling

Embed Size (px)

DESCRIPTION

Structured Design and Modeling. CS 123/CS 231. Design Models Revisited. UML: Modeling Language for OO Systems For the Procedural (Structured) Paradigm Data and processes are separately considered Data Model: Entity-Relationship Diagram Process Model: Data-Flow Diagram - PowerPoint PPT Presentation

Citation preview

Page 1: Structured Design and Modeling

Structured Designand Modeling

CS 123/CS 231

Page 2: Structured Design and Modeling

Design Models Revisited

UML: Modeling Language for OO SystemsFor the Procedural (Structured) Paradigm

Data and processes are separately consideredData Model: Entity-Relationship DiagramProcess Model: Data-Flow Diagram

Some modeling techniques apply to both paradigmse.g., use case diagram and state diagrams

Page 3: Structured Design and Modeling

ERDs

Entity-Relationship DiagramsUsed to produce a data model for an

enterpriseDatabase Design

Page 4: Structured Design and Modeling

Entities and Attributes

Entitything, person, placeexamples: Book, Sales Invoice, Student,

Customer, Employee, Department, AirportAttribute

feature of an entityexamples: Name, Address, Age, QCA,

Title, Author, Amount, City

Page 5: Structured Design and Modeling

Relationships

Relationshipan association between (at least) two entitiesexamples: student borrows a book

CardinalityOne-to-one, one-to-many, many-to-many

Intersection Dataattribute resulting from relationshipexample: date-borrowed

Page 6: Structured Design and Modeling

The Notation

Rectangles - EntitiesEllipses - AttributesDiamonds - RelationshipsLinksLabels

Page 7: Structured Design and Modeling

Example: The University Setting

DescriptionStudents enroll in classes. Each class is

a section of a particular course.Entities

Student, Section, Course

Page 8: Structured Design and Modeling

Student

id number

name addressyear

qca

Page 9: Structured Design and Modeling

Student enrolls Section

Course has

M M

M

1

grade

index roomsched

cat numtitle

desc

Page 10: Structured Design and Modeling

Example 2: Library

Student borrows bookmany to many relationship between

students and bookssee first diagram

Further analysis reveals there could be several copies of a bookstudent borrows copy, book has copysee second diagram

Page 11: Structured Design and Modeling

Student borrows BookM M

Page 12: Structured Design and Modeling

Student borrows Copy

Book has

M M

M

1

Exercise: Complete Diagram by filling in attributes

Page 13: Structured Design and Modeling

ERDs and the Software Life Cycle

Used at the design phase of the software life cycle for database systems, although it is often used as early as the analysis phase

In design, it precedes table definition

Page 14: Structured Design and Modeling

From ERD to Tables

Create a table for each entityattributes associated to entity are

columns of the table (a primary key should exist per table)

For each 1:M relationshipadd the primary key of the “1”

participant as an attribute of the “M” participant (foreign key); intersection data is also added to the “M” participant

Page 15: Structured Design and Modeling

ERD to Tables, continued

For each 1:1 relationshipadd primary key of one table plus

intersection data to the other tableFor each M:M relationship

create a new tableattributes are the primary keys of the

participants plus intersection data

Page 16: Structured Design and Modeling

University Setting Example

Studentid number, name, address, year, qca

Sectionindex, room, sched, cat num

Coursecat num, title, desc

Enrollid number, index, grade

Page 17: Structured Design and Modeling

DFDs

Data Flow DiagramsModels Operations (Processes)Also used in analysis and design

Page 18: Structured Design and Modeling

Processes

An operation or function in a systemexample: Borrow Book

Involvesdata flow (input and results)data sources and sinksExample: student and book-copy info are

data that flow into the process; results stored in borrow table

Page 19: Structured Design and Modeling

Notation

Circle (Bubble) - ProcessArrows - Data FlowsRectangles - Sources and SinksLabels

Page 20: Structured Design and Modeling

1BorrowBook

Student Copy Borrow

id num, copy num borrow confirmation

Page 21: Structured Design and Modeling

DFD Levels

A process may involve sub-processesprovides detail about the process

DFD levels emergeProcess hierarchy also depicted

using a structure chart

Page 22: Structured Design and Modeling

1.1Check

StudentStatus

id num borrower status

copy num copy status1.2

CheckBook Copy

Status

Student

Copy

Page 23: Structured Design and Modeling

1.3RecordBorrow

id num, copy num

Borrow

borrower status, copy status

borrow confirmation

Copy

Page 24: Structured Design and Modeling

About DFDs

Data flows should “balance” between levels

Number label format X.X.X provides level information

Context DiagramLevel 0 (or system-level) DFD

Notational Variations

Page 25: Structured Design and Modeling

Summary

Modeling techniques and notation needed in analysis and designmodels data and processes of a system

Other techniques and notationstate diagrams, structure charts,

flowcharts, document flow diagrams, more...

Structured vs OO Paradigmsome techniques specific to the paradigm