Modeling- Object, Dynamic and Functional

Post on 24-Apr-2015

1.440 views 2 download

description

Give details about OOPS concept and Modeling concept "How to design system". Also it gives breif on layered architecture and reverse engineering.

Transcript of Modeling- Object, Dynamic and Functional

1

Modeling- Object and Dynamic Modeling

Rajani Bhandari

Senior Project Manager

HCL Technologies

2

Topics will be covered

What is an Object What is Object Oriented Programming Why Modeling Required Modeling techniques Object Modeling Dynamic Modeling Functional ModelingLayered Architecture

3

What is Object

Object : An object is a real life example of material thing which can be seen and felt. The object have specific behavior and attributes

Example any real life thing. Some of them as followsStudentCarBanking systemBody

Object can be categorized, described, organized, combined, manipulated and created.

4

Example of Objects

BookTitle

Author

Publisher

Open ()

Close()

Read()

PersonName

Address

Phone

ChangeName()

ChangeAddress()

ChangePhone()

Book

Physics

Book

Biology

Person 1

Ramesh

Objects of Book or person

Person 2

Suresh

5

What is Object Oriented Programming

6

Object Oriented Programming

Four main object-oriented programming concepts.Data AbstractionEncapsulationInheritancePolymorphism

OOPS revolves around objects and classesClass may be seen as Structures and functions

7

Shape

Rectangle

Square

Circle

Eclipse

Showing inheritance Specialization

Abstract class

Specialized class

8

Vehicle Example Showing inheritance generalization

Vehicle

Car

Petrol Electric

Truck Bus

9

Why Modeling Required

10

Why modeling

Before constructing a building, a designer first build a model. To test a physical entity before actually building it. To set the stage for communication between customers and developers. For visualization i.e. for finding alternative representations. For reduction of complexity in order to understand it.

11

Why Model

c lie n t ,u s e rs

a rc h ite c t d e v e lo p e rs

a p p e a ra n c e ,b e h a v io u r

c o n s tru c t io n ,c o -o p e ra t io n

a rc h ite c tu ra ld e s ig n

v is u a lis e s p re s c r ib e s

re q u ire m e n ts s o lu t io n s

c re a te sa s s e s s a s s e s s

12

Advantage of Modeling

A model provides a means for conceptualization and communication of ideas in a precise and unambiguous form.

A model is an abstraction for the purpose of understanding it before building it.

So a model is an abstraction that hides the non-essential characteristics of a system and highlights those characteristics, which are pertinent to understand it.

13

Modeling Techniques

14

OMT stages and Models

Analysis - Model of real-world situation

- What ?

System Design - Overall architecture (sub-systems)

Object Design - Refinement of Design

- Algorithms/data structures to implement each class

Implementation - Translation of object classes and

relationships to a particular object-oriented language

time

System

Ob

ject M

od

el

- Sta

tic structure of o

bjects and

their re

latio

nships (ob

ject dia

gram

)

Dyn

amic M

od

el

- Co

ntrol aspects o

f the system

(state diagra

ms)

Fu

nctio

nal M

od

el- D

ata value

transfo

ramtio

ns (da

taflow dia

gram

s)

15

Types of Model

Object model The object model represents the static and most stable phenomena in the modeled domain. Main concepts are classes and associations, with attributes and operations. Aggregation and generalization (with multiple inheritance) are predefined relationships.

Dynamic model The dynamic model represents a state/transition view on the model. Main concepts are states, transitions between states, and events to trigger transitions. Actions can be modeled as occurring within states.

Functional model The functional model represents flow of values from external inputs, through operations and internal data stores, to external outputs.

16

Object Modeling

17

Object Modeling

The object model provides the framework into which the other models are placed.

Build an Object Model: Identify object classes. Develop a data dictionary for classes, attributes, and associations. Add associations between classes. Add attributes for objects and links. Organize and simplify object classes using inheritance. Group classes into modules, based on close coupling and related function.

18

Object and Class

A class is defined as Collection of similar objects. It is a template where basic characteristics of set of objects is defined.

Defines attributes and Operations i.e. member variables and functions.

Defining a class does not define any object, but it only creates a template.

For creating object basically create instance of class.

19

Association relation

Professor

Ramesh

Book

Physics

Wrote Department

ScienceCourses

Offers

One to one relation

Person

RameshPassport

1 0..1Airplane Passengers

1 *

One to many relationBinary

20

Association relation with Qualifier

Bank Account No Person

21

Aggregation

If two parts are linked but they have their individuality then its association and if two parts have whole-part relationship then it is aggregation.

Like of whole is affected part will be affected

22

Document

Paragraph

Sentence

Word Character

Aggregation Example

23

Aggregation Example

ATM

Cash Dispenser Deposit Slot

PPT

Slide

24

Modeling of Library System

First we create object Model Identify class Identify its relationship Its attributes and behavior

25

ATM Machine designing

Screen Transaction

Keypad ATMCash

Dispenser

Withdrawal

Deposit

Slots

Deposit

Bank

Database

Balance

Inquiry

Account

26

ATM objects Relationship

Screen

Transaction

Keypad

ATM

Cash

Dispenser

Withdrawal

Deposit

Slots

Deposit

Bank

Database Balance

Inquiry

AccountAuthenticate

User

1

1

Modifies

0…*

0…*

1

1

1

1

111

0…*

1

1

0…*

27

Library System Class

Books

User

Publisher

Librarian

Student Faculty

Reference

Books

General

Books

0..*+1

Author 1Issues

Orders

+1

+1…*

RequestsManages

+1

+1…*

28

Dynamic Modeling

29

Dynamic Model

Build a Dynamic Model: Prepare scenarios of typical interaction sequences. Identify events between objects and prepare an event trace for each

scenario. Prepare an event flow diagram for the system. Develop a state diagram for each class that has important dynamic behavior. Check for consistency and completeness of events shared among the state

diagrams.

30

Identify Use Cases for library class

Inquiry for Membership

Search Book

Request for book issue

Request for book return Pay Fine

31

Identify use case for library class

Issue member card

Cancel membership

Issue Book

Return Book

Maintain Book Record

Update member card

Update Book

Remove

Book

Add Book

32

ATM define Class attributes and behaviour

Screen

Display Message()

Deposit

Double: Amount

Execute()

Withdrawal

Double: Amount

Execute()

Balance Enquiry

Execute()

Bank database

Authenticate User()

getBalance()

Credit()Debit()

Keypad

GetInput()

Transaction

Int:Account Number

Execute()

getAccountNumber()

Account

Int: Account NumberInt PinDouble:Balance

validatePin()getBalance()Credit()Debit()

Cash dipenser

Int: amount

DispenseCash()IsCashAvailable()

33

Define classes attributes and Behavior

Book

ID: IntName: CharAuthor: CharYear of Publication: CharPrice: CharStatus: CharChar: Category

Add New Books()DeleteBooks()UpdateBookDetails()DisplayBookDetails()UpdateStatus()

Librarian

ID: IntName: Char

IssueBooks()ReturnBooks()SearchBooks()VerifyMember()PayBills()OrderBooks()IssueIDCards()ManageBookReecord

Publisher

Int :Publisher IDChar : Publisher NameChar : Publisher AddressInt: Publisher No.

AddPub()ModifyPub()DeletePub()OrderStatus()

User

Int :User IDChar : User NameChar : User AddressInt: Phone No.

IssueBooks()ReturnBooks()PayFine()AddNewUser()DeleteUser()UpdateDetails()

34

ATM state machine

35

State Machine

Issued

Issue

process()

Search

Book()

Book Can have following states: AvailableIssuedReturnedMissing

Request

[Book

Available]

Cancelled

Request

36

Member Librarian Book

Issue Book

[status == true]

Search Book

Book

Found

Set Status

SetStatus

Issued(book iD)Book

Issued

Sequence Model

37

Function Modeling

38

Functional Modeling

Build a Functional Model: Identify input and output values. Use data flow diagrams as needed to show functional dependencies. Describe what each function does. Identify constraints. Specify optimization criteria.

39

Function Modeling

Data Flow Diagrams are composed of the four basic symbols – external entities, processes, data stores and data flow - as discussed below.

The External Entity symbol represents sources of data to the system or destinations of data from the system.

The Process symbol represents an activity that transforms or manipulates the data (combines, reorders, converts, etc.).

The Data Store symbol represents data that is not moving (delayed data at rest).

The Data Flow symbol represents movement of data.

40

DFD for issuing pay check

DFD for a system that pays to worker:Input Data Flow: Timesheet Hours(Source is Worker)Basic Output: Pay checkProcess: Employee's record is retrieved, using the employee ID, which is contained in the timesheet. From the employee record, the rate of payment and overtime are obtained.

41

Layered Architecture

42

Layered Architecture

UI layer

(Forms or view displayed at front end)

Business Layer

(Contains business logic)

Data Layer

(Manages DB, or File operation)

DB File

Send Reqeust

Receive Response

Set/Get Data Output Data/ reesponse

43

Advantages of Layered Architecture

Reduced complexityEasy to add or modify functionalityEasy to Debug and Test Increase Reusability

44

Reverse Engineering

45

Reverse Engineering

It is a technique to understand through analysis of its structure, Function and operation.

The concept behind reverse-engineering—breaking something down in order to understand it, build a copy or improve it.

It is easy to learn by putting things apart and rejoining that Helps in Estimate costs.Reverse Engg is done because documentation is not available

46

Forward vs Reverse Engineering

Analysis

Design

Implementation

Reverse engineering

Forward

engineering

Documentation

Debugging is important

factor in RE

47

Benefits for RE

Understand existing designQuality improvementSoftware reuse No need to start from scratchTo examin how product works , what components it consists ,

estimate costs.Reverse Engg is done because documentation is not available

48

Out Come of reverse engineering

Document explaining: Code structure – classes, structures and its relation Functionality – Understanding functionality of module Input for Estimation Improvement points

52

Questions ???

53

Thanks