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

22
Design CIS 4800 Kannan Mohan Department of CIS Zicklin School of Business, Baruch College Copyright © 2009 John Wiley & Sons, Copyright © 2008 Course Technology Copyright © 2009 Kannan Mohan

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

Page 1: Design CIS 4800 Kannan Mohan Department of CIS Zicklin School of Business, Baruch College Copyright © 2009 John Wiley & Sons, Inc. Copyright © 2008 Course.

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

Page 2: Design CIS 4800 Kannan Mohan Department of CIS Zicklin School of Business, Baruch College Copyright © 2009 John Wiley & Sons, Inc. Copyright © 2008 Course.

Learning Objectives

• Explain verification and validation of the analysis models.

• Transition from analysis to design.

• Use package diagrams to organize your model.

Page 3: Design CIS 4800 Kannan Mohan Department of CIS Zicklin School of Business, Baruch College Copyright © 2009 John Wiley & Sons, Inc. Copyright © 2008 Course.

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

Page 4: Design CIS 4800 Kannan Mohan Department of CIS Zicklin School of Business, Baruch College Copyright © 2009 John Wiley & Sons, Inc. Copyright © 2008 Course.

Components Requiring Systems Design

Page 5: Design CIS 4800 Kannan Mohan Department of CIS Zicklin School of Business, Baruch College Copyright © 2009 John Wiley & Sons, Inc. Copyright © 2008 Course.

Object-Oriented Event-Driven Program Flow

Page 6: Design CIS 4800 Kannan Mohan Department of CIS Zicklin School of Business, Baruch College Copyright © 2009 John Wiley & Sons, Inc. Copyright © 2008 Course.

Analysis and Design Models

Page 7: Design CIS 4800 Kannan Mohan Department of CIS Zicklin School of Business, Baruch College Copyright © 2009 John Wiley & Sons, Inc. Copyright © 2008 Course.

Sources of Classes

Problemdomain

Solutiondomain

Analysisclasses

Designclasses

Page 8: Design CIS 4800 Kannan Mohan Department of CIS Zicklin School of Business, Baruch College Copyright © 2009 John Wiley & Sons, Inc. Copyright © 2008 Course.

Stereotypes for Design Classes

Page 9: Design CIS 4800 Kannan Mohan Department of CIS Zicklin School of Business, Baruch College Copyright © 2009 John Wiley & Sons, Inc. Copyright © 2008 Course.

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

Page 10: Design CIS 4800 Kannan Mohan Department of CIS Zicklin School of Business, Baruch College Copyright © 2009 John Wiley & Sons, Inc. Copyright © 2008 Course.

Three Tier Architecture

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

– View – Presentation

– Controller – Application logic

Page 11: Design CIS 4800 Kannan Mohan Department of CIS Zicklin School of Business, Baruch College Copyright © 2009 John Wiley & Sons, Inc. Copyright © 2008 Course.

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

Page 12: Design CIS 4800 Kannan Mohan Department of CIS Zicklin School of Business, Baruch College Copyright © 2009 John Wiley & Sons, Inc. Copyright © 2008 Course.

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

Page 13: Design CIS 4800 Kannan Mohan Department of CIS Zicklin School of Business, Baruch College Copyright © 2009 John Wiley & Sons, Inc. Copyright © 2008 Course.

Partial Design of a Three-Layer

Package Diagram –

Order Management

System Example

Page 14: Design CIS 4800 Kannan Mohan Department of CIS Zicklin School of Business, Baruch College Copyright © 2009 John Wiley & Sons, Inc. Copyright © 2008 Course.

Example Continued…

Page 15: Design CIS 4800 Kannan Mohan Department of CIS Zicklin School of Business, Baruch College Copyright © 2009 John Wiley & Sons, Inc. Copyright © 2008 Course.

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

Page 16: Design CIS 4800 Kannan Mohan Department of CIS Zicklin School of Business, Baruch College Copyright © 2009 John Wiley & Sons, Inc. Copyright © 2008 Course.

Getting Inheritance RightEmployee

Manager Programmer

• Can an employee – – Switch between jobs?

– Have multiple jobs?

Vs.

Management Programming

Employee Job

0..*0..*

performs

0..*0..*

Page 17: Design CIS 4800 Kannan Mohan Department of CIS Zicklin School of Business, Baruch College Copyright © 2009 John Wiley & Sons, Inc. Copyright © 2008 Course.

Multiple Inheritance vs. Aggregation

Vehicle

LandVehicle WaterVehicle

AmphibiousVehicle

Vehicle

LandVehicle

AmphibiousVehicle

WaterVehicle

Page 18: Design CIS 4800 Kannan Mohan Department of CIS Zicklin School of Business, Baruch College Copyright © 2009 John Wiley & Sons, Inc. Copyright © 2008 Course.

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

Page 19: Design CIS 4800 Kannan Mohan Department of CIS Zicklin School of Business, Baruch College Copyright © 2009 John Wiley & Sons, Inc. Copyright © 2008 Course.

Implementing Association Classes

Page 20: Design CIS 4800 Kannan Mohan Department of CIS Zicklin School of Business, Baruch College Copyright © 2009 John Wiley & Sons, Inc. Copyright © 2008 Course.

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

Page 21: Design CIS 4800 Kannan Mohan Department of CIS Zicklin School of Business, Baruch College Copyright © 2009 John Wiley & Sons, Inc. Copyright © 2008 Course.

An Interface Example• Login interface defines public methods that are

implemented in Authentication class

• Design by contract

Page 22: Design CIS 4800 Kannan Mohan Department of CIS Zicklin School of Business, Baruch College Copyright © 2009 John Wiley & Sons, Inc. Copyright © 2008 Course.

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