Chap 9 - From Design to Implementation

download Chap 9 - From Design to Implementation

of 25

Transcript of Chap 9 - From Design to Implementation

  • 8/8/2019 Chap 9 - From Design to Implementation

    1/25

    Object Oriented Analysis and Design 1

    Chapter 9 From Design to ImplementationImplementation Model

    Forward, Reverse, and Round-TripEngineeringMapping Designs to Code

    Test-Driven Development

  • 8/8/2019 Chap 9 - From Design to Implementation

    2/25

    Object Oriented Analysis and Design 2

    Implementation Model

  • 8/8/2019 Chap 9 - From Design to Implementation

    3/25

    Object Oriented Analysis and Design 3

    9.1 Implementation ModelCo ncept of Com po nentCom po nent Diagra mCo ncept of No deDepl o ym ent Diagra m

  • 8/8/2019 Chap 9 - From Design to Implementation

    4/25

    Object Oriented Analysis and Design 4

    Concept of Componenta component is a physical and replaceable

    part of a syste m that c o n fo r m s t o and pr ov idesthe realizati o n of a set of inter f aces.G raphically, a c om po nent is rendered as arectangle with tabs, usually including o nly its

    na m e.

    Login.dll

  • 8/8/2019 Chap 9 - From Design to Implementation

    5/25

    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.

    ComponentsInterfacesDependency relationships

  • 8/8/2019 Chap 9 - From Design to Implementation

    6/25

    Object Oriented Analysis and Design 6

    Component DiagramC aptures the physical structure of the

    im ple m entati o nBuilt as part of architectural speci f icati o nPurp o se

    Organize s o urce c o deCo nstruct an executable releaseSpeci f y a physical database

    De v elo ped by architects and pr o gra mm ers

  • 8/8/2019 Chap 9 - From Design to Implementation

    7/25

    Object Oriented Analysis and Design 7

    Component Diagram - Example

  • 8/8/2019 Chap 9 - From Design to Implementation

    8/25

    Object Oriented Analysis and Design 8

    Component Diagram - Example

  • 8/8/2019 Chap 9 - From Design to Implementation

    9/25

    Object Oriented Analysis and Design 9

    What is Node?a node is a physical ele m ent that exists at run ti m e

    and represents a c om putati o nal res o urce, generallyha v ing at least s om e m e mo ry and, of ten, pr o cessingcapability.

    A set of com po nents m ay reside o n a n o de and m ay

    als o m igrate f r om no de t o no de.G raphically, a n o de is rendered as a cube, usuallyincluding o nly its na m e.

    Node #1>

  • 8/8/2019 Chap 9 - From Design to Implementation

    10/25

    Object Oriented Analysis and Design 10

    What Is a Connection? A c o nnecti o n represents a:

    Comm unicati o n m echanis mPhysical m ediu m

    S of tware pr o to co l

    S erver

    Co nne ctio n

    Co nsole

    K iosk

  • 8/8/2019 Chap 9 - From Design to Implementation

    11/25

    Object Oriented Analysis and Design 11

    Deployment DiagramA deployment diagram is a diagram that shows

    the configuration of run time processing nodesand the components that live on them.Captures the topology of a systems hardwareBuilt as part of architectural specification

    PurposeSpeci f y the distributi o n of com po nentsIdenti f y per fo r m ance b o ttlenecks

    Developed by architects, networking engineers,

    and system engineers

  • 8/8/2019 Chap 9 - From Design to Implementation

    12/25

    Object Oriented Analysis and Design 12

    Deployment Diagram - Example

    CourseCatalog

    RegistrationS erver

    Desktop PC Desktop PC

    BillingS ystem

  • 8/8/2019 Chap 9 - From Design to Implementation

    13/25

    Object Oriented Analysis and Design 13

    Deployment Diagram -Example

  • 8/8/2019 Chap 9 - From Design to Implementation

    14/25

    Object Oriented Analysis and Design 14

    Deployment Diagram -Example

  • 8/8/2019 Chap 9 - From Design to Implementation

    15/25

    Object Oriented Analysis and Design 15

    9.2 Forward, Reverse, and Round-Trip EngineeringF o rward Engineering

    Re v erse EngineeringRo und-Trip Engineering

  • 8/8/2019 Chap 9 - From Design to Implementation

    16/25

    Object Oriented Analysis and Design 16

    Forward EngineeringF o rward engineering m eans the generati o n of co de

    f r om

    UML diagram

    sMany of the t oo ls can o nly d o the static mo dels:They can generate class diagra m s f r om co de, but can'tgenerate interacti o n diagra m s.F o r fo rward engineering, they can generate the basic (e.g.,Ja v a) class de f initio n f r om a class diagra m , but n o t them eth o d b o dies f r om interacti o n diagra m s.

    De mo

  • 8/8/2019 Chap 9 - From Design to Implementation

    17/25

    Object Oriented Analysis and Design 17

    Reverse EngineeringRe v erse engineering m eans generati o n of UML

    diagram

    sf r om

    co

    deDe mo

  • 8/8/2019 Chap 9 - From Design to Implementation

    18/25

    Object Oriented Analysis and Design 18

    Round-Trip EngineeringRo und-trip engineering cl o ses the l oo p

    the t oo l supp o rts generati o n in either directi o n and cansynchr o nize between UML diagra m s and c o de, ideallyaut om atically and i mm ediately as either is changed.

    De mo

  • 8/8/2019 Chap 9 - From Design to Implementation

    19/25

    Object Oriented Analysis and Design 19

    9.3 Mapping Designs to CodeCreating Class Definitions from Class Diagram

    Creating Methods from Interaction DiagramsCollection Classes in Code

  • 8/8/2019 Chap 9 - From Design to Implementation

    20/25

    Object Oriented Analysis and Design 20

    Creating Class Definitions from Class DiagramDefining a Class with Method Signatures and

    A ttributes

  • 8/8/2019 Chap 9 - From Design to Implementation

    21/25

    Object Oriented Analysis and Design 21

    Creating Methods from Interaction Diagrams

  • 8/8/2019 Chap 9 - From Design to Implementation

    22/25

    Object Oriented Analysis and Design 22

    Collection Classes in Code

  • 8/8/2019 Chap 9 - From Design to Implementation

    23/25

    Object Oriented Analysis and Design 23

    9.4 Test-Driven Development and RefactoringTest-Driven Development

    Refactoring

  • 8/8/2019 Chap 9 - From Design to Implementation

    24/25

    Object Oriented Analysis and Design 24

    Test-Driven Development An excellent practice pr omo ted by the iterati v e andagile XP m eth o d,and applicable t o the UP, is test-driv en de v elo pm ent (TDD).

    It is als o kn o wn as test- f irst de v elo pm ent

    In OO unit testing TDD-style, test c o de is writtenbe fo re the class t o be tested,

    and the de v elo per writes unit testing c o de fo r nearly allpr o ducti o n c o de.

    Unit testing f ra m ew o rkThe mo st p o pular unit testing f ra m ew o rk is the xUnit f a m ily(fo r m any languages)F o r Ja v a, the p o pular v ersi o n is JUnit.There's als o an NUnit fo r .NET,

    Exa m ple

  • 8/8/2019 Chap 9 - From Design to Implementation

    25/25

    Object Oriented Analysis and Design 25

    RefactoringRe f act o ring is a structured, disciplined m eth o d t o

    rewrite o r restructure existing c o de with o ut changingits external beha v io r,

    applying s m all trans fo r m atio n steps c om bined with re-executing tests each step.

    Co ntinu o usly re f act o ring c o de is an o ther XP practiceand applicable t o all iterati v e m eth o dsCo de that's been well-re f act o red is sh o rt, tight, clear,

    and with o ut duplicati o nit loo ks like the w o rk of am aster pr o gra mm er.

    Co de that d o esn't ha v e these qualities s m ells bad o r hasco de s m ells .