RelativeResourceManager;JSESSIONIDVISTA=QvvKLT2DppK118vsTX2Q5gyXRmW5v0SlTTtH2S639ZklQDcNJlk7!693841702!Vistanoded.coventry.ac.Uk!80! 1! 84013352!Vistanodea.coventry.ac

Embed Size (px)

Citation preview

  • 8/8/2019 RelativeResourceManager;JSESSIONIDVISTA=QvvKLT2DppK118vsTX2Q5gyXRmW5v0SlTTtH2S639ZklQDcNJlk7!69384

    http:///reader/full/relativeresourcemanagerjsessionidvistaqvvklt2dppk118vstx2q5gyxrmw5v0slttth2s639zklqdcnjlk7 1/2

    1

    260CT_lect10 @Dr Hong Guo & Coventry University 1

    !

    260CT_lect10 @Dr Hong Guo & Coventry University 2

    Introduction

    Conceptual Analysis v Design

    Notation

    Adding Methods

    Type information

    Associations

    Example

    Reading: chapter 16, Applying UML and Patterns (3/e), Craig Larman

    260CT_lect10 @Dr Hong Guo & Coventry University 3

    In contrast with the conceptual domain model, a design

    class diagram shows definitions forsoftware entities

    rather thanreal world concepts.

    Also referred to in UML simply as a class diagram

    The Notation is basically the same as for the

    Domain (Conceptual) Model.

    260CT_lect10 @Dr Hong Guo & Coventry University 4

    Class diagrams contain software definitions

    Classes can be identified from the domain model, Use Cases

    (fully dressed), and/or interaction diagrams

    Including the methods

    Some concepts will not be present in the design

    Actors, may be included in later cycles

    Design Class Diagrams are usually created in parallel with

    interaction diagrams (e.g. Sequence Diagrams,

    Collaboration Diagrams)

    260CT_lect10 @Dr Hong Guo & Coventry University 5

    Analyze use cases (fully dressed) and/or interaction diagrams for

    classes

    Draw them in a class diagram

    Duplicate the attributes from the associated concepts in the domainmodel.

    Attributes are usually assumed private if no visibility is given

    Add method names by cross-referencing to interaction diagrams

    Add type information to attributes & methods

    Add directional associations between classes to support attributevisibility

    Add dependency relationship lines

    260CT_lect10 @Dr Hong Guo & Coventry University 6

    ClassNameattributeattribute: typeATTRIBUTE : type = initial value

    /derivedAttribute- privateAttribute+ publicAttribute# protectedAttributeclass attribute

    method1()method2(parameter list ) : return typeabstractMethod()+ publicMethod()- privateMethod()# protectedMethod()

    class method()

  • 8/8/2019 RelativeResourceManager;JSESSIONIDVISTA=QvvKLT2DppK118vsTX2Q5gyXRmW5v0SlTTtH2S639ZklQDcNJlk7!69384

    http:///reader/full/relativeresourcemanagerjsessionidvistaqvvklt2dppk118vstx2q5gyxrmw5v0slttth2s639zklqdcnjlk7 2/2

    2

    260CT_lect10 @Dr Hong Guo & Coventry University 7

    The methods of each class are identified from the use cases or

    from the collaboration diagrams Can be automatically generated by CASE tool

    Some methods can be omitted

    Create methods, e.g. constructor methods in Java or C++

    Attribute accessor & mutator functions

    Methods on multiobjects (i.e. a collection class)

    Interpret as a message to the container

    Containers add noise with little new information so

    usually excluded

    260CT_lect10 @Dr Hong Guo & Coventry University 8

    If using a CASE tool with code generation

    All type details are required but not necessarilyshown

    For Software Developers

    Exhaustive detail may affect noise-to-value ratio

    260CT_lect10 @Dr Hong Guo & Coventry University 9

    Associations on a Design Class Diagram are derived from theDomain Model and/or collaboration diagrams

    Use arrowheads to indicate navigability

    Navigability indicates attribute visibilityfrom a source to a target objectclass

    Rolename only at the target end implies the attribute name inimplementation

    Example:

    Domain Model conceptual perspective show association name & multiplicity but avoid navigation arrow &

    role name

    Project

    code : StringAllocated-to1 1

    Student

    id : int

    260CT_lect10 @Dr Hong Guo & Coventry University 10

    Design Model software perspective

    show navigation arrow & role name often exclude the association name

    1

    myProject

    Student

    id : int

    Project

    code : String

    To be clear, the Student has twoattributes:

    Using the navigabilityarrow to indicate

    Student has a referenceto one Project instance

    public class Student {private int id;private Project myProject;

    public void setProject(Project p) {myProject = p;

    }

    }

    Student

    id : intmyProject : Project

    260CT_lect10 @Dr Hong Guo & Coventry University 11

    A dependency relationship indicates

    that one element has knowledge of

    another element.

    In class diagrams this means

    Parameter visibility

    Global visibility

    Locally declared visibility

    Student

    - id : int

    + notePresentation(Presentation)

    Project

    - code : String

    myProject

    1

    Presentation- time : DateTime- venue : Room

    speaker1

    Room

    - number : String

    + getNumber() : String

    venue1

    Example: the Student has parametervisibility to Presentation, the methodnoteP invokes getNumber on a Room

    260CT_lect10 @Dr Hong Guo & Coventry University 12

    public class Student {private int id;private Project myProject;

    public void setProject(Project p) {myProject = p;

    }

    public void notePresentation( Presentation p) {Room r = p.getRoom() ; //r is a local variableSystem.out.println(Room: + r.getNumber() );System.out.println(Time: + p.getTime() );

    }

    }

    Student

    - id : int- myProject : Project

    + setProject(Project p)+ notePresentation(Presentation p)

    Objects communicatevia sending messages