Design CIS 4800 Kannan Mohan Department of CIS Zicklin School of Business, Baruch College Copyright...

Post on 14-Dec-2015

216 views 0 download

Tags:

Transcript of Design CIS 4800 Kannan Mohan Department of CIS Zicklin School of Business, Baruch College Copyright...

Design

CIS 4800Kannan Mohan

Department of CISZicklin School of Business, Baruch College

Copyright © 2009 John Wiley & Sons, Inc.Copyright © 2008 Course TechnologyCopyright © 2009 Kannan Mohan

Learning Objectives

• Explain verification and validation of the analysis models.

• Transition from analysis to design.

• Use package diagrams to organize your model.

Overview

• Programmers use models to code the system

• Two most important models are – Design class diagrams

– Interaction diagrams (sequence diagrams and communication diagrams)

• Analysis class diagrams are further developed with design classes

Components Requiring Systems Design

Object-Oriented Event-Driven Program Flow

Analysis and Design Models

Sources of Classes

Problemdomain

Solutiondomain

Analysisclasses

Designclasses

Stereotypes for Design Classes

Standard Design Classes

• Entity – design identifier for problem domain class– Persistent class – models data that exist after system is shut

down or specific processes are completed

• Boundary – designed to live on system’s automation boundary– User interface classes

• Control – mediates between boundary and entity classes, between the view layer and domain layer

• Data access – retrieve from and send data to database

Three Tier Architecture

• MVC – Model View Controller– Model – data and associated rules

– View – Presentation

– Controller – Application logic

Three Tier/Client-Server Architecture

• Layers can reside on one processor or be distributed to multiple processors

• Data layer – manages stored data in databases

• Business logic layer – implements rules and procedures of business processing

• View layer – accepts user input and formats and displays processing results

Package

• A general construct that groups units together

• Used to reduce complexity of models

• A package diagram shows packages only

• So using packages we can group M, V, & C

Partial Design of a Three-Layer

Package Diagram –

Order Management

System Example

Example Continued…

High Cohesion, Low Coupling• High cohesion:

– Each class should have a set of operations that support the intent of the class, no more and no less

– Each class should model a single abstract concept

– If a class needs to have many responsibilities, then some of these should be implemented by “helper” classes. The class then delegates to its helpers

• Low coupling:– A particular class should be associated with ‘just enough’ other classes to allow

it to realise its responsibilities

– Associate classes only if there is a true semantic link between them

– Never form an association just to reuse a fragment of code in another class

– Use aggregation rather than inheritance

Getting Inheritance RightEmployee

Manager Programmer

• Can an employee – – Switch between jobs?

– Have multiple jobs?

Vs.

Management Programming

Employee Job

0..*0..*

performs

0..*0..*

Multiple Inheritance vs. Aggregation

Vehicle

LandVehicle WaterVehicle

AmphibiousVehicle

Vehicle

LandVehicle

AmphibiousVehicle

WaterVehicle

More on Relationships: From Analysis to Design…

• Association classes are not directly implementable

• Importance of role names

• Inheritance – some languages might not support this

• Importance of multiplicity

• Implementing aggregation

Implementing Association Classes

Interfaces• An interface specifies a named set of public features

• It separates the specification of functionality from its implementation

• An interface defines a contract that all realizing classifiers must conform to

Interface specifies Realizing classifier

operation Must have an operation with the same signature and semantics

attribute Must have public operations to set and get the value of the attribute. The realizing classifier is not required to actually have the attribute specified by the interface, but it must behave as though it has

association Must have an association to the target classifier. If an interface specifies an association to another interface, then the implementing classifiers of these interfaces must have an association between them

An Interface Example• Login interface defines public methods that are

implemented in Authentication class

• Design by contract

Summary• What are Design classes and where do they come

from?

• What is the three tier architecture?

• What are some of the characteristics of good design classes?

• Compare and contrast the use of inheritance with aggregation