Title: CS 691z / 791z Topics on Software Engineering
1CS 691z / 791zTopics on Software Engineering
- Chapter 17 Interfaces and Subsystems
- Arlow Neustadt, 2002
-
- March 6, 2007
2Outline
- Interfaces and subsystems
- Introduction
- Interfaces and component-based development
- Finding interfaces
- Subsystems and interfaces
- Advantages and disadvantages of interfaces
3Interfaces Introduction
- Chapter 17 roadmap, Fig. 17.1 Arlow Neustadt,
2002
4Interfaces .Introduction..
- An interface specifies a named set of operations
- It defines a contract to be implemented by a
classifier - It also separates specification from
implementation - If the classifier that realizes (implements) the
interface is physically packaged in a subsystem
or component and the interface is public in this
subsystem or component, then the subsystem or
component also realizes the interface
5Interfaces ..Introduction.
- Interfaces allow design to contract as compared
to design to implementation supported by
classes - Each operation in an interface must have a
complete operation signature (name, types of all
parameters, and return type), semantics (recorded
as text or pseudo-code) and, optionally, a
stereotype and set of constraints - Interfaces may not have
- Attributes
- Operation implementations
- Relationships navigable from the interface
6Interfaces Introduction
- UML interface syntax, Fig. 17.2 Arlow
Neustadt, 2002
7Interfaces and Component-based Development.
- Interfaces are key elements for component-based
development - They allow addition of plug-in parts (with
varied implementations) without changing the
specification - Both with components and subsystems, interfaces
support low coupling and provide high
architectural flexibility
8.Interfaces and Component-based Development
- Example of interface, Fig. 17.3 Arlow
Neustadt, 2002
9..Interfaces and Component-based Development..
- Example of interfaces
- and subsystems
- Fig. 17.4 Arlow
- Neustadt,2002
10Interfaces and Component-based Development.
- Another example of interface, Fig. 17.5 Arlow
Neustadt, 2002
11. Interfaces and Component-based Development
- Interfaces in Java the
- collection classes
- Fig. 17.6
- Arlow Neustadt,2002
12Finding Interfaces
- Techniques for finding interfaces in a designed
system or subsystem - Challenge each association
- Challenge each message sent
- Factor out groups of operations reusable
elsewhere - Factor out sets of operations that repeat in
classes - Look at classes that have similar roles in the
system - Consider future extensions
-
13Subsystems..
- Subsystems are packages stereotyped ltltsubsystemgtgt
- They are used both in design and implementation
- Design subsystems contain
- Design classes and interfaces
- Use case realizations
- Other subsystems
- Specification elements such as use cases
- Subsystems are used to
- Separate design concerns
- Represent large-grained components
- Wrap legacy systems
-
14.Subsystems.
- Alternatives for drawing subsystems
- Fig. 17.7 Arlow Neustadt, 2002
15..Subsystems
- More detailed representation of a subsystem
- Fig. 17.8 Arlow Neustadt, 2002
16Subsystems and Interfaces..
- By introducing public interfaces in subsystems
many of the classes in the subsystems could be
hidden. As such subsystems could act as black
boxes. - Using interfaces in a subsystem is different from
listing subsystem operations (see Figure 17.8).
In the latter case, public classes must realize
the operations. - When a class of a subsystem realizes an
interface, the subsystem realizes that interface - A subsystem that provides a set of services by
realizing one or more interfaces can be seen as a
component
17.Subsystems and Interfaces.
- Example of subsystems that realize interfaces
- Fig. 17.9 Arlow Neustadt, 2002
18..Subsystems and Interfaces
- Physical architecture and the layering pattern,
Fig. 17.10 - Arlow Neustadt, 2002
19Advantages and disadvantages of interfaces
- Designing with interfaces increases flexibility
and extensibility - Also, using interfaces supports low coupling by
reducing the number of dependencies between
classes, subsystems and components - With interfaces, a model can be neatly separated
in cohesive subsystems - Drawbacks of interfaces relate to added
complexity and increased performance costs - As a guideline, use interfaces for the more
fluid parts of the system and dispense of them
for the more stable parts of the system