<<

Goals of the Lecture UML Implementation Diagrams n Present UML Diagrams useful for implementation n Provide examples n Next Lecture Object-Oriented Analysis and Design Ð A variety of topics on mapping from design CSCI 6448 - Fall 1998 into implementation Kenneth M. Anderson ¥ translating associations into operations, scalability considerations, etc.

CSCI 6448 Kenneth M. Anderson

Overview Packages n Package Diagrams n A is a general-purpose mechanism Ð Systems and Subsystems for organizing elements into groups Ð Packages are rendered as tabbed folders n Component Diagrams Ð The visibility of elements can be specified n Deployment Diagrams Ð Elements are semantically related for a single purpose n Collaborations n Packages are thus conducive to providing groups which are highly cohesive, loosely coupled, and access tightly controlled

CSCI 6448 CSCI 6448 Kenneth M. Anderson Kenneth M. Anderson Package Example Information on Packages

Chimera n Packages can contain Ð packages, classes, interfaces, components, nodes, collaborations, use cases, etc. ChimeraServer API +csAPI n Containment is a composite relationship +hwsAPI Ð The element belongs to the package +hwmAPI ¥ Delete the package, you delete its elements Concept -eventGenerator

CSCI 6448 CSCI 6448 Kenneth M. Anderson Kenneth M. Anderson

More Information on Packages Accessing Package Elements ProductInfo Client n Each package defines a namespace + name «import» + OrderForm Ð Names of elements (of a particular type) must be + description + TrackingForm unique within a package + image - Order - GUI::Window ¥ e.g. you can have a class named Timer and an interface named Timer but you canÕt have two classes both named Import and Access specify that one Timer «access» package makes use of another. Ð its recommended that you keep all names unique GUI regardless of type, however Import brings the public elements of the target package into the source’s Ð Nested names use the following notation + Window namespace. + Form ¥ Chimera::API::csAPI These relationships are not transitive # EventHandler and only operate in one direction.

CSCI 6448 CSCI 6448 Kenneth M. Anderson Kenneth M. Anderson Generalization Generalization Example GUI n Generalization relationships are used to + Window + Form specify families of packages # EventHandler Ð All rules of inheritance apply ¥ Public and Protected members are available in children, and children can override members of WindowsGUI their parents and add new elements ¥ Substitutability can also be used; a child + GUI::Window package can be used in the place of one of its MacGUI + Form parents + VBForm

CSCI 6448 CSCI 6448 Kenneth M. Anderson Kenneth M. Anderson

Standard Package Stereotypes Systems and Subsystems n facade n A system is the thing being modeled and Ð A package that is a view onto some other package developed to accomplish some task n framework Ð It contains all its models such as classes, use cases, diagrams, etc. Ð A package consisting mainly of patterns n A subsystem is simply a part of a system n stub Ð used to decompose a complex system into nearly Ð A package that serves as a proxy for the public independent parts contents of another package Ð typically has high cohesion collecting everything n system, subsystem needed to accomplish a particular subtask or goal

CSCI 6448 CSCI 6448 Kenneth M. Anderson Kenneth M. Anderson Components Components vs. Classes n A is a physical and replaceable n Classes are logical abstractions part of a system that conforms to and Ð Components are physical objects that can be provides the realization of a set of interfaces deployed Ð Rendered as a rectangle with tabs n Classes may have attributes and operations n Example Components Ð Components typically only have operations Ð dynamically-linked libraries, jar files, database defined by their associated interfaces tables, software components (JavaBeans, n Components are at a different level of CORBA, and DCOM) abstraction; they represent the physical packaging of classes

CSCI 6448 CSCI 6448 Kenneth M. Anderson Kenneth M. Anderson

Components and Interfaces More on components

n image.class component.class Components are physical n Components are replaceable ImageObserver n Components are part of a system Ð They can be thought of as building blocks Component.class exports the interface, image.class imports it. n Components conform to and provide the A component can import and export many different interfaces. realization of a set of interfaces The interface breaks the between the two components; they can change independently as long as they maintain their obligations with respect to the interface. CSCI 6448 CSCI 6448 Kenneth M. Anderson Kenneth M. Anderson Standard Component Stereotypes Executable Component Example

dlog.dll animator.class n executable Ð can be executed on a n library Ð static or dynamic object library n table render.dll raytrce.dll wrfrme.dll Ð database table n file Ð source code or data n document Ð catch-all for other types of documents

CSCI 6448 CSCI 6448 Kenneth M. Anderson Kenneth M. Anderson

Deployment Diagrams Chimera Deployment n Document the nodes of a system bigtime hwmServer n A node is a physical element that represents hwsServer a computational resource Ð typically having memory and processing capability

Ð Nodes model the topology of the hardware used anchor by a system chimeraServer ¥ A node represents (typically) a processor or device jimage serl (sensor, modem, etc.) mySQL

CSCI 6448 CSCI 6448 Kenneth M. Anderson Kenneth M. Anderson Nodes vs. Components More information on Nodes n Components participate in the execution of a n Nodes (as well as components) can system participate in dependency, Ð Nodes are things that execute components generalization, and association n Components physically package logical relationships elements n Ð Nodes represent the physical deployment of They can be nested, have instances, components participate in interactions, etc. n Nodes can also have attributes and operations

CSCI 6448 CSCI 6448 Kenneth M. Anderson Kenneth M. Anderson

Common uses for Deployment Collaborations Diagrams n To model embedded systems n A collaboration is a society of classes, Ð Nodes can represent physical devices and show interfaces, and other elements that work how components access those devices together to provide a cooperative behavior n To model client/server systems Ð A collaboration consists of a structural part and a Ð See previous example behavioral part ¥ Class diagrams specify the former n To model fully distributed systems ¥ Interaction diagrams specify the latter Ð Including adaptive systems Ð Rendered as an ellipse with dashed lines ¥ for example, agents that migrate from node to node

CSCI 6448 CSCI 6448 Kenneth M. Anderson Kenneth M. Anderson Uses for collaborations Collaborations, continued n Modeling a mechanism n Elements can appear in multiple Ð Show me all the classes and activities collaborations involved with client-server communication Ð A collaboration can be thought of as a set n Modeling a of pointers into a systemÕs packages Ð Show me all the classes and interactions to Ð Sort of like the perspective mechanismÕs support the process order use case notion of a virtual copy n Modeling an operation Ð Show me how ray tracing is accomplished

CSCI 6448 CSCI 6448 Kenneth M. Anderson Kenneth M. Anderson

Example Structural Aspect client server chimeraServer * «» listener Communicate * with Other api handler Servers * * message

Client-Server Communication request reply CSCI 6448 CSCI 6448 Kenneth M. Anderson Kenneth M. Anderson Behavioral Aspect csAPI:api :listener csNativeHandler:handler «create» request

SendRequest(r) HandleRequest(r) «create» reply SendReply(r) SendReply(r)

CSCI 6448 Kenneth M. Anderson