25
Object Oriented Analysis and Design 1 Chapter 9 From Design to Implementation Implementation Model Forward, Reverse, and Round-Trip Engineering Mapping Designs to Code Test-Driven Development

Object Oriented Analysis and Design 1 Chapter 9 From Design to Implementation Implementation Model Forward, Reverse, and Round-Trip Engineering Mapping

Embed Size (px)

Citation preview

Page 1: Object Oriented Analysis and Design 1 Chapter 9 From Design to Implementation  Implementation Model  Forward, Reverse, and Round-Trip Engineering  Mapping

Object Oriented Analysis and Design 1

Chapter 9 From Design to Implementation Implementation Model Forward, Reverse, and Round-Trip

Engineering Mapping Designs to Code Test-Driven Development

Page 2: Object Oriented Analysis and Design 1 Chapter 9 From Design to Implementation  Implementation Model  Forward, Reverse, and Round-Trip Engineering  Mapping

Object Oriented Analysis and Design 2

Implementation Model

Page 3: Object Oriented Analysis and Design 1 Chapter 9 From Design to Implementation  Implementation Model  Forward, Reverse, and Round-Trip Engineering  Mapping

Object Oriented Analysis and Design 3

9.1 Implementation Model Concept of Component Component Diagram Concept of Node Deployment Diagram

Page 4: Object Oriented Analysis and Design 1 Chapter 9 From Design to Implementation  Implementation Model  Forward, Reverse, and Round-Trip Engineering  Mapping

Object Oriented Analysis and Design 4

Concept of Component a component is a physical and replaceable

part of a system that conforms to and provides the realization of a set of interfaces.

Graphically, a component is rendered as a rectangle with tabs, usually including only its name.

Login.dll

Page 5: Object Oriented Analysis and Design 1 Chapter 9 From Design to Implementation  Implementation Model  Forward, Reverse, and Round-Trip Engineering  Mapping

Object Oriented Analysis and Design 5

Component Diagram

component.javaImageObserver

image.java

A component diagram shows the organizations and dependencies among software components, including source code components, binary code components, and executable components.

Component diagrams contain: Component packages. Components Interfaces Dependency relationships

Page 6: Object Oriented Analysis and Design 1 Chapter 9 From Design to Implementation  Implementation Model  Forward, Reverse, and Round-Trip Engineering  Mapping

Object Oriented Analysis and Design 6

Component Diagram Captures the physical structure of the

implementation Built as part of architectural specification Purpose

Organize source code Construct an executable release Specify a physical database

Developed by architects and programmers

Page 7: Object Oriented Analysis and Design 1 Chapter 9 From Design to Implementation  Implementation Model  Forward, Reverse, and Round-Trip Engineering  Mapping

Object Oriented Analysis and Design 7

Component Diagram - Example

Page 8: Object Oriented Analysis and Design 1 Chapter 9 From Design to Implementation  Implementation Model  Forward, Reverse, and Round-Trip Engineering  Mapping

Object Oriented Analysis and Design 8

Component Diagram - Example

Page 9: Object Oriented Analysis and Design 1 Chapter 9 From Design to Implementation  Implementation Model  Forward, Reverse, and Round-Trip Engineering  Mapping

Object Oriented Analysis and Design 9

What is Node? a node is a physical element that exists at run time

and represents a computational resource, generally having at least some memory and, often, processing capability.

A set of components may reside on a node and may also migrate from node to node.

Graphically, a node is rendered as a cube, usually including only its name.

Node #1

<<Node>>

Page 10: Object Oriented Analysis and Design 1 Chapter 9 From Design to Implementation  Implementation Model  Forward, Reverse, and Round-Trip Engineering  Mapping

Object Oriented Analysis and Design 10

What Is a Connection? A connection represents a:

Communication mechanism

• Physical medium• Software protocol

Server<<Processor>>

<<RS-232>>

<<10-T Ethernet>>

Connection

Console

Kiosk

Page 11: Object Oriented Analysis and Design 1 Chapter 9 From Design to Implementation  Implementation Model  Forward, Reverse, and Round-Trip Engineering  Mapping

Object Oriented Analysis and Design 11

Deployment Diagram A deployment diagram is a diagram that shows

the configuration of run time processing nodes and the components that live on them.

Captures the topology of a system’s hardware Built as part of architectural specification Purpose

Specify the distribution of components Identify performance bottlenecks

Developed by architects, networking engineers, and system engineers

Page 12: Object Oriented Analysis and Design 1 Chapter 9 From Design to Implementation  Implementation Model  Forward, Reverse, and Round-Trip Engineering  Mapping

Object Oriented Analysis and Design 12

Deployment Diagram - Example

Course Catalog

<<legacy>>

<<Campus LAN>> <<Campus LAN>>

<<Campus LAN>><<Campus LAN>>

Registration Server

Desktop PC Desktop PC

Billing System

<<legacy>>

Page 13: Object Oriented Analysis and Design 1 Chapter 9 From Design to Implementation  Implementation Model  Forward, Reverse, and Round-Trip Engineering  Mapping

Object Oriented Analysis and Design 13

Deployment Diagram -Example

Page 14: Object Oriented Analysis and Design 1 Chapter 9 From Design to Implementation  Implementation Model  Forward, Reverse, and Round-Trip Engineering  Mapping

Object Oriented Analysis and Design 14

Deployment Diagram -Example

Page 15: Object Oriented Analysis and Design 1 Chapter 9 From Design to Implementation  Implementation Model  Forward, Reverse, and Round-Trip Engineering  Mapping

Object Oriented Analysis and Design 15

9.2 Forward, Reverse, and Round-Trip Engineering Forward Engineering Reverse Engineering Round-Trip Engineering

Page 16: Object Oriented Analysis and Design 1 Chapter 9 From Design to Implementation  Implementation Model  Forward, Reverse, and Round-Trip Engineering  Mapping

Object Oriented Analysis and Design 16

Forward Engineering Forward engineering means the generation of code

from UML diagrams Many of the tools can only do the static models:

They can generate class diagrams from code, but can't generate interaction diagrams.

For forward engineering, they can generate the basic (e.g., Java) class definition from a class diagram, but not the method bodies from interaction diagrams.

DemoGenerate

Page 17: Object Oriented Analysis and Design 1 Chapter 9 From Design to Implementation  Implementation Model  Forward, Reverse, and Round-Trip Engineering  Mapping

Object Oriented Analysis and Design 17

Reverse Engineering Reverse engineering means generation of UML

diagrams from code Demo

Re-Engineer

Page 18: Object Oriented Analysis and Design 1 Chapter 9 From Design to Implementation  Implementation Model  Forward, Reverse, and Round-Trip Engineering  Mapping

Object Oriented Analysis and Design 18

Round-Trip Engineering Round-trip engineering closes the loop

the tool supports generation in either direction and can synchronize between UML diagrams and code, ideally automatically and immediately as either is changed.

Demo

Page 19: Object Oriented Analysis and Design 1 Chapter 9 From Design to Implementation  Implementation Model  Forward, Reverse, and Round-Trip Engineering  Mapping

Object Oriented Analysis and Design 19

9.3 Mapping Designs to Code Creating Class Definitions from Class Diagram Creating Methods from Interaction Diagrams Collection Classes in Code

Page 20: Object Oriented Analysis and Design 1 Chapter 9 From Design to Implementation  Implementation Model  Forward, Reverse, and Round-Trip Engineering  Mapping

Object Oriented Analysis and Design 20

Creating Class Definitions from Class Diagram Defining a Class with Method Signatures and

Attributes

Page 21: Object Oriented Analysis and Design 1 Chapter 9 From Design to Implementation  Implementation Model  Forward, Reverse, and Round-Trip Engineering  Mapping

Object Oriented Analysis and Design 21

Creating Methods from Interaction Diagrams

Page 22: Object Oriented Analysis and Design 1 Chapter 9 From Design to Implementation  Implementation Model  Forward, Reverse, and Round-Trip Engineering  Mapping

Object Oriented Analysis and Design 22

Collection Classes in Code

Page 23: Object Oriented Analysis and Design 1 Chapter 9 From Design to Implementation  Implementation Model  Forward, Reverse, and Round-Trip Engineering  Mapping

Object Oriented Analysis and Design 23

9.4 Test-Driven Development and Refactoring Test-Driven Development Refactoring

Page 24: Object Oriented Analysis and Design 1 Chapter 9 From Design to Implementation  Implementation Model  Forward, Reverse, and Round-Trip Engineering  Mapping

Object Oriented Analysis and Design 24

Test-Driven Development An excellent practice promoted by the iterative and agile

XP method,and applicable to the UP, is test-driven development (TDD). It is also known as test-first development

In OO unit testing TDD-style, test code is written before the class to be tested, and the developer writes unit testing code for nearly all production

code. Unit testing framework

The most popular unit testing framework is the xUnit family (for many languages)

For Java, the popular version is JUnit. There's also an NUnit for .NET,

Example

Page 25: Object Oriented Analysis and Design 1 Chapter 9 From Design to Implementation  Implementation Model  Forward, Reverse, and Round-Trip Engineering  Mapping

Object Oriented Analysis and Design 25

Refactoring Refactoring is a structured, disciplined method to

rewrite or restructure existing code without changing its external behavior, applying small transformation steps combined with re-

executing tests each step. Continuously refactoring code is another XP practice

and applicable to all iterative methods Code that's been well-refactored is short, tight, clear,

and without duplicationit looks like the work of a master programmer. Code that doesn't have these qualities smells bad or has

code smells.