1 CS 691z / 791z Topics on Software Engineering Chapter 17: Interfaces and Subsystems [Arlow &...

19
1 CS 691z / 791z Topics on Software Engineering Chapter 17: Interfaces and Subsystems [Arlow & Neustadt, 2002] March 6, 2007
  • 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 &...

Page 1: 1 CS 691z / 791z Topics on Software Engineering Chapter 17: Interfaces and Subsystems [Arlow & Neustadt, 2002] March 6, 2007.

11

CS 691z / 791zTopics on Software

EngineeringChapter 17: Interfaces and

Subsystems [Arlow & Neustadt, 2002]

March 6, 2007

Page 2: 1 CS 691z / 791z Topics on Software Engineering Chapter 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

Page 3: 1 CS 691z / 791z Topics on Software Engineering Chapter 17: Interfaces and Subsystems [Arlow & Neustadt, 2002] March 6, 2007.

33

Interfaces: Introduction…

Chapter 17 roadmap, Fig. 17.1 [Arlow & Neustadt, 2002]

Page 4: 1 CS 691z / 791z Topics on Software Engineering Chapter 17: Interfaces and Subsystems [Arlow & Neustadt, 2002] March 6, 2007.

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

Page 5: 1 CS 691z / 791z Topics on Software Engineering Chapter 17: Interfaces and Subsystems [Arlow & Neustadt, 2002] March 6, 2007.

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

Page 6: 1 CS 691z / 791z Topics on Software Engineering Chapter 17: Interfaces and Subsystems [Arlow & Neustadt, 2002] March 6, 2007.

66

Interfaces: …Introduction

UML interface syntax, Fig. 17.2 [Arlow & Neustadt, 2002]

Page 7: 1 CS 691z / 791z Topics on Software Engineering Chapter 17: Interfaces and Subsystems [Arlow & Neustadt, 2002] March 6, 2007.

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

Page 8: 1 CS 691z / 791z Topics on Software Engineering Chapter 17: Interfaces and Subsystems [Arlow & Neustadt, 2002] March 6, 2007.

88

.Interfaces and Component-based Development…

Example of interface, Fig. 17.3 [Arlow & Neustadt, 2002]

Page 9: 1 CS 691z / 791z Topics on Software Engineering Chapter 17: Interfaces and Subsystems [Arlow & Neustadt, 2002] March 6, 2007.

99

..Interfaces and Component-based Development..

Example of interfaces

and subsystems Fig. 17.4 [Arlow & Neustadt,2002]

Page 10: 1 CS 691z / 791z Topics on Software Engineering Chapter 17: Interfaces and Subsystems [Arlow & Neustadt, 2002] March 6, 2007.

1010

…Interfaces and Component-based Development.

Another example of interface, Fig. 17.5 [Arlow & Neustadt, 2002]

Page 11: 1 CS 691z / 791z Topics on Software Engineering Chapter 17: Interfaces and Subsystems [Arlow & Neustadt, 2002] March 6, 2007.

1111

…. Interfaces and Component-based Development

Interfaces in Java: the

collection classesFig. 17.6 [Arlow &

Neustadt,2002]

Page 12: 1 CS 691z / 791z Topics on Software Engineering Chapter 17: Interfaces and Subsystems [Arlow & Neustadt, 2002] March 6, 2007.

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

Page 13: 1 CS 691z / 791z Topics on Software Engineering Chapter 17: Interfaces and Subsystems [Arlow & Neustadt, 2002] March 6, 2007.

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

Page 14: 1 CS 691z / 791z Topics on Software Engineering Chapter 17: Interfaces and Subsystems [Arlow & Neustadt, 2002] March 6, 2007.

1414

.Subsystems.

Alternatives for drawing subsystems Fig. 17.7 [Arlow & Neustadt, 2002]

Page 15: 1 CS 691z / 791z Topics on Software Engineering Chapter 17: Interfaces and Subsystems [Arlow & Neustadt, 2002] March 6, 2007.

1515

..Subsystems

More detailed representation of a subsystemFig. 17.8 [Arlow & Neustadt, 2002]

Page 16: 1 CS 691z / 791z Topics on Software Engineering Chapter 17: Interfaces and Subsystems [Arlow & Neustadt, 2002] March 6, 2007.

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

Page 17: 1 CS 691z / 791z Topics on Software Engineering Chapter 17: Interfaces and Subsystems [Arlow & Neustadt, 2002] March 6, 2007.

1717

.Subsystems and Interfaces.

Example of subsystems that realize interfaces Fig. 17.9 [Arlow & Neustadt, 2002]

Page 18: 1 CS 691z / 791z Topics on Software Engineering Chapter 17: Interfaces and Subsystems [Arlow & Neustadt, 2002] March 6, 2007.

1818

..Subsystems and InterfacesPhysical architecture and the layering pattern, Fig. 17.10[Arlow & Neustadt, 2002]

Page 19: 1 CS 691z / 791z Topics on Software Engineering Chapter 17: Interfaces and Subsystems [Arlow & Neustadt, 2002] March 6, 2007.

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