Presentation is loading. Please wait.

Presentation is loading. Please wait.

Some Simple Design Modeling Techniques

Similar presentations


Presentation on theme: "Some Simple Design Modeling Techniques"— Presentation transcript:

1 Some Simple Design Modeling Techniques
State Transition Diagram to model the functional and execution (dynamic) aspects of the software system Entity-Relation Diagram to model the data, data attributes and data relationships UML’s Sequence Diagram to model object interactions.

2 State Transition Diagram for Detail Design
State Transition Diagrams were heavily used in compiler design (strings that are acceptable) automata theory (machine states) State Transition diagram depicts a machine (system) composed of a (1) set of states, S, and (2)a set of alphabet (inputs) or stimulants, I, an (3) initial and (4) a final state and (5) a set of transition rules, R such that the following depicts the state transitions r (s1, a) = s where s1, s2 are members of S (states) and a is a member of I r is a transition rule in R

3 Simple State Transition Design
1 S1 So 1 - Define the initial and final states to be the same S0. - The transition rules are: r1: (S0, 0) = S1 r2: (S0, 1) = S0 r3: (S1, 0) = S1 r4: (S1, 1) = S0 A system that will accept all strings of 0’s and 1’s that end with 1

4 Self-Exercise Use State Transition diagram to depict a system that will accept strings made of 0’s and 1’s, but only those that have an even number of 0’s and 1’s.

5 One Answer S1 So 1 1 1 1 S3 S2

6 A More Design Oriented Representation of A Process Flow
Search again Display all flights Display all airlines with available seat Start ‘Available’ Flight Search Check seat availability Search flights to destination x by date Terminate search Terminate Flight Search function Note that this is a search only for flights with available seats, not a general flight search

7 Using State Transition Diagram for Design
Good for modeling the “states” and “transitions of states” of a system, of a component of a system, or a small segment of a component. In order to use this modeling technique one has to think of: All possible states: S’s All possible stimuli for change of state: I’s All the possible rules for transitions of states: R ( Ik,Si) -> Sj Initial or starting state of the system: S0 Terminating state may be used as a tool to “test” out the component: e.g error path

8 Entity Relationship Diagram (ERD)
ERD was introduced as a technique to model Data Conceptual Model about 20 years ago, before introduction of OO, when it was realized that both data and functionality need to be considered together. Description of Data Types: Relationship among Data Constraints on Relationship From the ERD diagram, the Next step is Logical Database Design where ERD is mapped into Database Schema. Besides DB, ERD May be used with OO techniques in designing Classes

9 Entity and Attributes Entity is a “thing” which may be of :
Physical Existence such as cars, employees, lumber, etc. Conceptual Existence such as company, project, payroll, etc. Attribute is a property that describes the Entity (such as an employee may have attributes of sex, age, address, etc.). An attribute may be : Simple or Composite : gender is simple where address is a composite Single or Multi Valued: gender is single valued where car-color may be multi-valued (e.g. green-and-white is multi-color) Stored or Derived: birth-date is stored where age may be derived (from today’s date minus birth-date) Null : not applicable or unknown as opposed to blank Also, an interesting design question.

10 Example of Entity and Attributes
- An Entity is represented as a rectangular box Employee - Attributes are represented as a) ovals attached to the entity or b) listed within the entity box (b) (a) Employee Employee -Name -Sex -Address - Street - City - State - Zip Name Address Sex Street City State Zip

11 Further Descriptions of Entities and Attributes
Entity Type represents a set of entities that have the same attributes. Note the similarity between Entity Type and Class and each entity and each object Entity Type is “Employee” - employee1(Joe, male, 43) - employee2(Tom,male, 32) . “Key” Attribute is an attribute which has a unique value and may be used as search index, and is represented with an underline. Employee Name Employee Number Address

12 Entity Relationships A Relationship, R, is an association between or among Entity Types. Employee R Project where R may be defined as “work on” Degree of Relationship defines the number of participating entity types for that relationship. Binary : Employee “works for” Customer Ternary : Equipment “supplies” Project and Employee “supplies” Project Works for Customer Employee Equipment Supplies Project Supplies Employee

13 Constraints on Relationship
Constraints are “limitations” put on the entities that participate in a relationship: Cardinality Modality Cardinality: specifies the number of occurrences of one entity that can be related to the number of occurrences of another entity: one-to-one : ( person to seat) where each person occupies a seat and each seat is occupied by one person one-to-many : (artist to paintings) where each artist can paint many paintings but each painting is painted by one artist man-to-many : (students to classes) where many students are enrolled in a class and a student may be enrolled in many classes

14 Constraints on Relationship (cont.)
Modality (or participation or existence) specifies whether the existence of an entity depends on its being related to another entity via the relationship: Total : Every entity of the entity type participates in the relationship Partial : Some of the entities of the entity type may participate in the relationship Author write Book act Stage play Actor Author, Actor (Partial) - because not all authors have written a book or actors played on stage Book, stage play (Total)- because every book is written by an author or every stage play is acted by actors

15 Cardinality and Modality Representation
1 m Writes Author Book Cardinality of 1 ( author) to (writes) many (books) Author Book (mandatory) (optional) Modality specifying that an author is mandatory for each book, but book is optional for author because some author never wrote a book

16 Represent Performance Requirement and Design (using UML Sequence Diagram as an example)
Object 1 Object 2 Object 3 Invokes an object 2 method Invokes an object 3 method A (B-A)<2sec. Return B This is the performance specification of 2 secs. in the detail design to satisfy some requirement


Download ppt "Some Simple Design Modeling Techniques"

Similar presentations


Ads by Google