Your browser doesn't support the features required by impress.js, so you are presented with a simplified version of this presentation.

For the best experience please use the latest Chrome, Safari or Firefox browser.

Component Interfaces

Prof. Cesare Pautasso
http://www.pautasso.info
cesare.pautasso@usi.ch
@pautasso

Software Component

Component Interface

Provided Interface

Required Interface

Information Hiding

Which part is easier to change?

Information Hiding

D. Parnas

Effective Encapsulation

G. Fairbanks and D. Parnas

Example

What details are hidden behind this interface?

Describing Interfaces

Interface Description Languages

IDL Example: Java/RMI

import java.rmi.*; 
public interface Adder extends Remote
{
public int sum(int x, int y) throws RemoteException;
}

IDL Example: C/RPC

interface adder { 
  const long ARRAY_SIZE = 10; 
  typedef long array_long[ARRAY_SIZE]; 
  long sum([in] long a, [in] long b); 
  void array_sum([in] array_long a,
                 [in] array_long b, 
                 [out] array_long c);
}

Parameter direction: [in] Input, [out] Output,
[in, out] Input and Output

Working With IDL

Reusable Interfaces

Usability vs. Reusability

Ian Sommerville

Performance vs. Reusability

Ian Sommerville

API

What is an API?

Is it really API?

Rule of Threes (Will Tracz)

123

Many Applications

API Examples

API Design

Where to start?

Explicit Interfaces Principle

Bertrand Meyer

Small Interfaces Principle

Bertrand Meyer

Uniform Access Principle

Bertrand Meyer

Few Interfaces Principle

Bertrand Meyer

DRY

Do not Repeat Yourself

Clear Interfaces Principle

Bertrand Meyer

YAGNI

You ain't gonna need it

Design Advice

API Evolution

Only one chance...

...to get the design right:

API Evolution

API Compatibility

1435mm Standard Gauge
1668mm Iberian Gauge
1524mm Russian Gauge
1000mm RhB (Swiss Alps)

Compatible Interfaces

Adapter

Wrapper

References

Use a spacebar or arrow keys to navigate