The Architecting Phase Class diagrams are further refined

  • Slides: 24
Download presentation
The Architecting Phase • Class diagrams are further refined in this phase of development

The Architecting Phase • Class diagrams are further refined in this phase of development • Object diagrams are created • Interaction diagrams are created • Class skeletons are created to embody all analysis and design information created to this point in the development process Computer Science CS 425/CS 625 1

Class Skeletons • We will preview class skeletons to better understand the objectives of

Class Skeletons • We will preview class skeletons to better understand the objectives of design • Class skeletons are partial class definitions • Class skeletons should be heavily commented, so that the purpose of all attributes, methods, and constructors is clear • Class skeletons are the basis for the implementation phase of development Computer Science CS 425/CS 625 2

Contents of Class Skeletons • A list of the roles the class plays within

Contents of Class Skeletons • A list of the roles the class plays within the system • Information concerning when objects of the class are created and deleted (information maintenance) • For each role, the semantics of the class • All attributes with access modifiers, types, names, and semantics • For all constructors and methods, their signature, semantics, preconditions and CS 425/CS 625 3 Computer Science postconditions

LMS Class Skeleton Computer Science CS 425/CS 625 4

LMS Class Skeleton Computer Science CS 425/CS 625 4

System Decomposition • Adds detail to the previous system representation • Can be done

System Decomposition • Adds detail to the previous system representation • Can be done iteratively or in a traditional, waterfall manner • Each phase in the system development decomposes the system further • Leads to a blueprint for implementation Computer Science CS 425/CS 625 5

More UML • Access Modifiers + means public - means private # means protected

More UML • Access Modifiers + means public - means private # means protected • Constraints (restriction on the class) { } E. g {Students may check out at most 25 items} • Tagged values also use { } E. g. {Requirement #5} Computer Science CS 425/CS 625 6

More UML: Multiplicity Patron 0. . 1 checks out Borrower 0. . * Resource

More UML: Multiplicity Patron 0. . 1 checks out Borrower 0. . * Resource • Multiplicity or cardinality is represented above by the 0. . 1 and 0. . * • The above diagram indicates that a resource is checked out by 0 or 1 patrons and that each patron may check out 0 to many resources Computer Science CS 425/CS 625 7

More UML: Aggregation Patron Overdue form letter Resource • The solid diamond indicates that

More UML: Aggregation Patron Overdue form letter Resource • The solid diamond indicates that the Overdue form letter class consists of Patron and Resource objects. Solid diamond indicates that Patron and Resource classes exist in their own right Computer Science CS 425/CS 625 8

Aggregation • Example from LMS where classes do not exist independent from aggregating class?

Aggregation • Example from LMS where classes do not exist independent from aggregating class? Computer Science CS 425/CS 625 9

Interaction Diagrams • Interaction diagrams model dynamic aspects of the system by specifying the

Interaction Diagrams • Interaction diagrams model dynamic aspects of the system by specifying the interaction among objects to produce a particular behavior • Two types of interaction diagrams are defined in UML – Collaboration diagrams, which emphasize the structural organization of objects that send and receive messages – Sequence diagrams, which emphasize the time ordering of the messages passed between objects Computer Science CS 425/CS 625 10

Notational Elements of Interaction Diagrams Object: class Link Message method(parameters) • The object name

Notational Elements of Interaction Diagrams Object: class Link Message method(parameters) • The object name is optional in the depiction of an object in UML notation • An object is distinguished from a class in UML notation by the colon and underlining of the class name CS 425/CS 625 11 Computer Science

LMS: Collaboration Diagram ge ) e t a t. R eso ) : Library

LMS: Collaboration Diagram ge ) e t a t. R eso ) : Library System D e I ge urc e M c t ( r Pa e (R n u o o t r ron eso es at P R ( Pa t( urc te a u d o t ron e. ID k li c a e v ID ) Ch ) update(Patron) : Patron : Library. Database m. D create(Library. Database) Computer Science CS 425/CS 625 12

Steps for Creating Collaboration Diagrams • Identify a behavior to model • Identify participating

Steps for Creating Collaboration Diagrams • Identify a behavior to model • Identify participating class and their relevant interrelationships • Identify a specific scenario to model • determine necessary message passing to carry out the behavior • Introduce solution for object persistence, if needed Computer Science CS 425/CS 625 13

Sequence Diagrams • Like collaboration diagrams, sequence diagrams model dynamic aspects of the system

Sequence Diagrams • Like collaboration diagrams, sequence diagrams model dynamic aspects of the system by specifying the interaction among objects to produce a particular behavior • Sequence diagrams specify the time ordering of messages • Sequence diagrams show the life span of each object Computer Science CS 425/CS 625 14

Check out resource Sequence Diagram : Library System : Patron : Library. Database get.

Check out resource Sequence Diagram : Library System : Patron : Library. Database get. Resource(Resource. ID) get. Patron(Patron. ID) create(Library. Database) validate. Patron(Mem. Date) Computer Science CS 425/CS 625 15

Evaluating Design • Modeling software helps us produce correct, well - structured systems •

Evaluating Design • Modeling software helps us produce correct, well - structured systems • The resultant models can also be scrutinized for potential data integrity problems • For example, in the LMS system, having update methods execute separately for the Patron and Resource objects may result in data integrity errors if system failure occurs between the initiation of the first method and the termination of the second method Computer Science CS 425/CS 625 16

Object Diagrams • Models a set of objects and their interrelationships during a system

Object Diagrams • Models a set of objects and their interrelationships during a system snapshot • A system snapshot is the state of the software system at a selected moment of time • Object diagrams model another static perspective of the system • Unlike other diagrams, object diagrams may contain multiple instances of the same class Computer Science CS 425/CS 625 17

LMS Case Study: Object Diagram (partial) current. P: Student : Book name = “SOTY”

LMS Case Study: Object Diagram (partial) current. P: Student : Book name = “SOTY” author=“b. hooks” ISBN=. . . : List name=“Gert Stein” library. ID=6747632 homephone=5554321 workphone=5551234 membership=05011999 expire=05012002 Computer Science CS 425/CS 625 : Book name = “FOF” author=“Ehrenreich” ISBN=. . . 18

Steps for Creating Object Diagrams • Identify a system snapshot within a scenario to

Steps for Creating Object Diagrams • Identify a system snapshot within a scenario to model • Identify participating classes and their interrelationships • Identify allocated objects at the time of the snapshot • Show the state of each object in the snapshot • Determine all interobject links Computer Science CS 425/CS 625 19

Code Reuse • Collaboration diagrams are of particular use in pattern scavenging • Pattern

Code Reuse • Collaboration diagrams are of particular use in pattern scavenging • Pattern scavenging involves studying the various diagrams produced during analysis and class design to identify patterns of class interaction • Once such patterns are found, they should be evaluated to determine if they can be effectively reused Computer Science CS 425/CS 625 20

Reuse in LMS Resource Checkable Resource Book Computer Science Reserve Resource Electronic Media CS

Reuse in LMS Resource Checkable Resource Book Computer Science Reserve Resource Electronic Media CS 425/CS 625 21

Guidelines for Class Design • • Always keep data private Always initialize data in

Guidelines for Class Design • • Always keep data private Always initialize data in a constructor Do not use too many related primitives Not all attributes need individual accessor or mutator methods • Order elements comprising class definitions consistently • Break up overly complex classes into multiple classes • Name classes, methods and attributes 22 well CS 425/CS 625 Computer Science

Verification of the Class Design • All system requirements developed during analysis must be

Verification of the Class Design • All system requirements developed during analysis must be addressed during design – All design documents must cross reference requirements from the requirements specification • All required attributes and methods must be used properly – Eg data integrity of attributes must be enforced by update methods • The modules comprising the system must work together properly Computer Science CS 425/CS 625 23

Next • Distributed systems – Corba, Java-RMI • • • Design Documents – Reviews

Next • Distributed systems – Corba, Java-RMI • • • Design Documents – Reviews Implementation – Reviews Testing Integration Project Presentations Computer Science CS 425/CS 625 24