Introduction to UML
Interface and packages
即時與嵌入式系統實驗試
李榮華
1
Outline

Interface
1.Define
2.Why Interface
3.Example

Packages
1.Define
2.Why package
3.Example
2
Interface

An Interface is a collection of operations
that are used to specify a service of a
class or a component.
ISpell
Wordsmith.dll
IUnknown
IThesaurus
3
Why Interface

To build systems with a clear separation of concerns
so that,as the system evolves,changes in one part of
the system don’t ripple through,rending other parts of
the system.
Tracker
TargetTracker
observer
4
Another representation for Interface
If it’s important for your understanding of
current model,you can render an interface
as a stereotyped class.

5
Interface Specifier
 As the figure shows,you can explicitly
show the type of role using the syntax
rolename:iname,where iname is some
interface of the other classifier.
6
Package


A package is general-purpose mechanism for
organizing elements into groups.Graphically,a
package is rendered as a tabbed folder.
A package may own other elements,including
classes,interface,components,nodes,collaborations,u
se cases,diagrams,and even other packages.
NewPackage
Sensors::Vision
7
Why Packages

Organize the elements.
 Control the seams in your system’
Architecture.
User Services
Business
Services
Data Services
8
Generalization

Packages involved in generalization
relationship follow the same principle of
substitutability as do classes.
9
To model architectural views

Identify the set of architectural views.
 Pace the elements.
 Group these elements into their own
packages.
Use Case View
Logical View
Component
View
Deployment
View
10