Structured Design and Modeling

Post on 01-Jan-2016

28 views 3 download

Tags:

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

Transcript of Structured Design and Modeling

Structured Designand Modeling

CS 123/CS 231

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

ERDs

Entity-Relationship DiagramsUsed to produce a data model for an

enterpriseDatabase Design

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

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

The Notation

Rectangles - EntitiesEllipses - AttributesDiamonds - RelationshipsLinksLabels

Example: The University Setting

DescriptionStudents enroll in classes. Each class is

a section of a particular course.Entities

Student, Section, Course

Student

id number

name addressyear

qca

Student enrolls Section

Course has

M M

M

1

grade

index roomsched

cat numtitle

desc

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

Student borrows BookM M

Student borrows Copy

Book has

M M

M

1

Exercise: Complete Diagram by filling in attributes

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

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

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

University Setting Example

Studentid number, name, address, year, qca

Sectionindex, room, sched, cat num

Coursecat num, title, desc

Enrollid number, index, grade

DFDs

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

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

Notation

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

1BorrowBook

Student Copy Borrow

id num, copy num borrow confirmation

DFD Levels

A process may involve sub-processesprovides detail about the process

DFD levels emergeProcess hierarchy also depicted

using a structure chart

1.1Check

StudentStatus

id num borrower status

copy num copy status1.2

CheckBook Copy

Status

Student

Copy

1.3RecordBorrow

id num, copy num

Borrow

borrower status, copy status

borrow confirmation

Copy

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

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