Richard E. Neustadt Preparing to Be President the Memos of Richard E. Neustadt 2000
1 CS 691z / 791z Topics on Software Engineering Chapter 17: Interfaces and Subsystems [Arlow &...
-
date post
21-Dec-2015 -
Category
Documents
-
view
212 -
download
0
Transcript of 1 CS 691z / 791z Topics on Software Engineering Chapter 17: Interfaces and Subsystems [Arlow &...
11
CS 691z / 791zTopics on Software
EngineeringChapter 17: Interfaces and
Subsystems [Arlow & Neustadt, 2002]
March 6, 2007
22
Outline
Interfaces and subsystems:IntroductionInterfaces and component-based development
Finding interfaces Subsystems and interfacesAdvantages and disadvantages of interfaces
33
Interfaces: Introduction…
Chapter 17 roadmap, Fig. 17.1 [Arlow & Neustadt, 2002]
44
Interfaces: .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
55
Interfaces: ..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
66
Interfaces: …Introduction
UML interface syntax, Fig. 17.2 [Arlow & Neustadt, 2002]
77
Interfaces 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
88
.Interfaces and Component-based Development…
Example of interface, Fig. 17.3 [Arlow & Neustadt, 2002]
99
..Interfaces and Component-based Development..
Example of interfaces
and subsystems Fig. 17.4 [Arlow & Neustadt,2002]
1010
…Interfaces and Component-based Development.
Another example of interface, Fig. 17.5 [Arlow & Neustadt, 2002]
1111
…. Interfaces and Component-based Development
Interfaces in Java: the
collection classesFig. 17.6 [Arlow &
Neustadt,2002]
1212
Finding Interfaces
Techniques for finding interfaces in a designed system or subsystem:Challenge each associationChallenge each message sentFactor 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
1313
Subsystems..
Subsystems are packages stereotyped <<subsystem>> 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
1414
.Subsystems.
Alternatives for drawing subsystems Fig. 17.7 [Arlow & Neustadt, 2002]
1515
..Subsystems
More detailed representation of a subsystemFig. 17.8 [Arlow & Neustadt, 2002]
1616
Subsystems 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
1717
.Subsystems and Interfaces.
Example of subsystems that realize interfaces Fig. 17.9 [Arlow & Neustadt, 2002]
1818
..Subsystems and InterfacesPhysical architecture and the layering pattern, Fig. 17.10[Arlow & Neustadt, 2002]
1919
Advantages 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