More Model Elements
Templates Two alternate ways of instantiating a template Type/Class, n : int Two alternate ways of instantiating a template Array <<bind>> <Color,50> Array <Car, 100> Color Array
Interface An interface is defined as an abstract class with no specific implementation Contains signatures of abstract operations Concrete classes choose to use the interface by implementing the abstract operations defined in the interface Example: Java interface called “Runnable” defines an abstract operation “void run()”. A Clock class can implement the interface by redefining the “run()” operation.
Defining the interface Runnable {abstract} <<interface>> Comparable {abstract} + run() : void {abstract} +compareTo (object) : int {abstract} Defined with the keyword <<interface>> in the name box. All interfaces are defined as abstract classes. THE ATTRIBUTES BOX SHOULD BE EMPTY.
Implementing and Using the interface Class B Class A Runnable Class A implements the interface ‘Runnable’ and class B uses that interface Class E Runnable Class D Class F Comparable Class D implements the interfaces ‘Runnable’ and ‘Comparable’
Package A grouping mechanism A package may have public and private components No strict semantics associated – user choice Packaging for convenience Library package No instances of a package
Package A contains packages B, C, D and F Dependencies Package names Specialization F
<<import>> B A <<import>> C <<access>> <<import>> D Package C imports all public components of package A and private components of package B. Package D imports all public components of C.
is equivalent to (see next slide) F G A A a : int c: char B C m1() m2() <<merge>> <<merge>> H D A is equivalent to (see next slide)
H A B a : int c : char D m1() m2() C
Component A component is a self-contained unit that encapsulates the state and behavior of a set of model elements Components are generally meant for reuse Ideal notation to represent a library The contents of a component are always hidden and therefore are not visible Components are accessed via interfaces Components communicate via interfaces
Notations for a component Component’s Name <<component>> A <<delegate>> B External View of a Component <<delegate>> Internal View of a Component
Artifact Synonym for “File/Folder” Used to show the physical representation of a component Also used in deployment diagrams (to be shown shortly) to show the physical location of an artifact Two types of artifacts Source artifact (includes programs and documents) Executable artifact
A component and an artifact <<manifest>> Manifest file, contains information about the files packaged in a JAR file. mathLib.jar
Deployment diagram Shows the physical runtime architecture of devices, execution environments and artifacts Useful for managing storages, allocating team work and other managerial activities
UW-L server : Server Server Type of a node Instance of a node Server <<device>> UW-L server : Server Server Type of a node Instance of a node <<device>> Server <<execution environment>> <<execution environment>> Web Server DB server
Client A : PC with Windows <<TCP/IP>> Application Server: Web Server Client B : PC with Linux <<TCP/IP>> Database : DB Server <<LocalNet>>
Application Server : Web Server <<artifact>> Shopping Application <<artifact>> <<artifact>> Order.jar ShoppingCart.jar one of many kinds of tangible byproducts produced during the development of software Build tools often refer to source code compiled for testing as an artifact, because the executable is necessary to carrying out the testing plan. Artifacts are significant from a project management perspective as deliverables. The deliverables of a software project are likely to be the same as its artifacts with the addition of the software itself. In UML 2.0, artifacts are the physical entities that are deployed on Nodes, Devices, and Execution Environments. Other UML elements such as classes and components are first manifested into artifacts and instances of these artifacts are then deployed. Artifacts can also be composed of other artifacts. <<deployment spec>> PurchasingRules.xml