Top Banner
An analogy to Composition Filters Mehmet Aksit ([email protected] http:// trese . cs . utwente . nl TRESE Group, Department of Computer Science University of Twente Postbox 217, 7500 AE Enschede, The Netherlands TRESE e-tutorial series 03
31

An analogy to Composition Filters Mehmet Aksit ([email protected] ://trese.cs.utwente.nl TRESE Group, Department of Computer.

Dec 30, 2015

Download

Documents

George Simmons
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: An analogy to Composition Filters Mehmet Aksit (aksit@cs.utwente.nl ://trese.cs.utwente.nl TRESE Group, Department of Computer.

An analogy toComposition Filters

Mehmet Aksit

([email protected] http://trese.cs.utwente.nl

TRESE Group, Department of Computer Science

University of Twente

Postbox 217, 7500 AE

Enschede, The Netherlands

TRESE e-tutorial series 03

Page 2: An analogy to Composition Filters Mehmet Aksit (aksit@cs.utwente.nl ://trese.cs.utwente.nl TRESE Group, Department of Computer.

2/31© 2001 TRESE Group, University of Twente

trese.cs.utwente.nl

Copyright statement

You are not allowed to use part or whole of the tutorial material for any commercial purpose unless a written permission has been given by the TRESE group;

If you use part or whole of the material for a non-commercial purpose, then you have to make a reference to our web-site "taken from http://trese.cs.utwente.nl" and always include these two copyright conditions.

Page 3: An analogy to Composition Filters Mehmet Aksit (aksit@cs.utwente.nl ://trese.cs.utwente.nl TRESE Group, Department of Computer.

3/31© 2001 TRESE Group, University of Twente

trese.cs.utwente.nl

Table of contents

An analogy

References

Filters

Page 4: An analogy to Composition Filters Mehmet Aksit (aksit@cs.utwente.nl ://trese.cs.utwente.nl TRESE Group, Department of Computer.

4/31© 2001 TRESE Group, University of Twente

trese.cs.utwente.nl

Explain meplease what the

important characteristicsof Composition Filters

are?With pleasure!

I will try to explain you by making ananalogy between Composition Filters

and a real world example.

An analogy to Composition Filters

Page 5: An analogy to Composition Filters Mehmet Aksit (aksit@cs.utwente.nl ://trese.cs.utwente.nl TRESE Group, Department of Computer.

5/31© 2001 TRESE Group, University of Twente

trese.cs.utwente.nl

Objective: taking a picture

Assume that wewant to take apicture of this

beautiful flower!

Page 6: An analogy to Composition Filters Mehmet Aksit (aksit@cs.utwente.nl ://trese.cs.utwente.nl TRESE Group, Department of Computer.

6/31© 2001 TRESE Group, University of Twente

trese.cs.utwente.nl

Objective: taking a picture (cont’ed)

This is the camerawhat we have!

Page 7: An analogy to Composition Filters Mehmet Aksit (aksit@cs.utwente.nl ://trese.cs.utwente.nl TRESE Group, Department of Computer.

7/31© 2001 TRESE Group, University of Twente

trese.cs.utwente.nl

Problem (1): camera cannot focus

This is thepicture we get!

d < min focus

Unfortunatelythe camera

cannotfocus on the

image.The camera is

too close!

Page 8: An analogy to Composition Filters Mehmet Aksit (aksit@cs.utwente.nl ://trese.cs.utwente.nl TRESE Group, Department of Computer.

8/31© 2001 TRESE Group, University of Twente

trese.cs.utwente.nl

We can builda new dedicatedcamera for this

problem

Sir!Can you build acamera for me

that cantake picturesfrom 2 cm.

A dedicated solution (1)

I am a cameramanufacturer!

$ $

With pleasurewe make a camerafor you, but:$$$$$

Page 9: An analogy to Composition Filters Mehmet Aksit (aksit@cs.utwente.nl ://trese.cs.utwente.nl TRESE Group, Department of Computer.

9/31© 2001 TRESE Group, University of Twente

trese.cs.utwente.nl

Problem (2): light is not suitable

We solve thefocusing problem!

Lets turn the light on!

Unfortunatelythe light is not

suitable forthe film!

Page 10: An analogy to Composition Filters Mehmet Aksit (aksit@cs.utwente.nl ://trese.cs.utwente.nl TRESE Group, Department of Computer.

10/31© 2001 TRESE Group, University of Twente

trese.cs.utwente.nl

We can builda new dedicatedcamera for this

lighting!

We neednow a camera

which cantake pictures

with thislighting!

A dedicated solution (2)

No problem!

$ $

With pleasurewe make a camerafor you, but:$$$$$

Page 11: An analogy to Composition Filters Mehmet Aksit (aksit@cs.utwente.nl ://trese.cs.utwente.nl TRESE Group, Department of Computer.

11/31© 2001 TRESE Group, University of Twente

trese.cs.utwente.nl

Problem (3): not sufficient light intensity

Unfortunately, sometimeswe do not have a

possibility of extra lighting.We must be able to

takea picture in

darkness. Do we needa special camera

which can intensify images?

Page 12: An analogy to Composition Filters Mehmet Aksit (aksit@cs.utwente.nl ://trese.cs.utwente.nl TRESE Group, Department of Computer.

12/31© 2001 TRESE Group, University of Twente

trese.cs.utwente.nl

Each time a problemis experienced,

a new camera hadto be built.

This is too expensive!

Finding a dedicated solutionfor every problem is not

economical.

We must also be sure that

the solutionsare able to work

together.

Dedicated solutions

Page 13: An analogy to Composition Filters Mehmet Aksit (aksit@cs.utwente.nl ://trese.cs.utwente.nl TRESE Group, Department of Computer.

13/31© 2001 TRESE Group, University of Twente

trese.cs.utwente.nl

Using modular extensions

May be we should not build adedicated camera each time we

have a new problem!Wait a minute! Why not use

a close up lens as an extension?

I have now a sharp picture. A modular extension is an

economical solution

Page 14: An analogy to Composition Filters Mehmet Aksit (aksit@cs.utwente.nl ://trese.cs.utwente.nl TRESE Group, Department of Computer.

14/31© 2001 TRESE Group, University of Twente

trese.cs.utwente.nl

Using independent extensions

What if we experience a lightingproblem?

We can use a color filter! We solved the second

problemas well. These extensions

arerather independent from

each other!

Page 15: An analogy to Composition Filters Mehmet Aksit (aksit@cs.utwente.nl ://trese.cs.utwente.nl TRESE Group, Department of Computer.

15/31© 2001 TRESE Group, University of Twente

trese.cs.utwente.nl

Open ended solutions

If we experience newproblems, such as

image intensification,we may add additional

extensions

Page 16: An analogy to Composition Filters Mehmet Aksit (aksit@cs.utwente.nl ://trese.cs.utwente.nl TRESE Group, Department of Computer.

16/31© 2001 TRESE Group, University of Twente

trese.cs.utwente.nl

Well-defined semantics

Each extensionmust address a single concern

and have awell-definedsemantics!

extensionsfactory

Our extensionsare certified!

Page 17: An analogy to Composition Filters Mehmet Aksit (aksit@cs.utwente.nl ://trese.cs.utwente.nl TRESE Group, Department of Computer.

17/31© 2001 TRESE Group, University of Twente

trese.cs.utwente.nl

Run-time solutions

I think there are differentkinds of photographers!Professionals would like

to choose the rightsolution whenever

they need to

“extensions at run-time”

Page 18: An analogy to Composition Filters Mehmet Aksit (aksit@cs.utwente.nl ://trese.cs.utwente.nl TRESE Group, Department of Computer.

18/31© 2001 TRESE Group, University of Twente

trese.cs.utwente.nl

Compile-time solutions

Amateur photographers, however, may prefer

pre-installed solutions.For them, cameras must be

manufactured at thefactory!

“extensions at compile-time”

Page 19: An analogy to Composition Filters Mehmet Aksit (aksit@cs.utwente.nl ://trese.cs.utwente.nl TRESE Group, Department of Computer.

19/31© 2001 TRESE Group, University of Twente

trese.cs.utwente.nl

Flexibility in selecting run-time or compile-time solutions

It must be easy toswitch between

run-timeor compile-time

solutions!

Page 20: An analogy to Composition Filters Mehmet Aksit (aksit@cs.utwente.nl ://trese.cs.utwente.nl TRESE Group, Department of Computer.

20/31© 2001 TRESE Group, University of Twente

trese.cs.utwente.nl

Summary of the solution strategy

Modular extensions;

Independent extensions;

Open-ended solutions;

Well-defined semantics;

Switching between run-time or compile-time solutions.

Let me summarizethe characteristics

of my solution:

Actually, these are alsothe characteristics

of Composition Filters!

Page 21: An analogy to Composition Filters Mehmet Aksit (aksit@cs.utwente.nl ://trese.cs.utwente.nl TRESE Group, Department of Computer.

21/31© 2001 TRESE Group, University of Twente

trese.cs.utwente.nl

Problems of current OO programs

If the requirementsevolve, current object-oriented programs may

require excessivenumber of

re-definitions.See for exampleour e-tutorial 01

“Evolution problems inObject Oriented Modeling”

Page 22: An analogy to Composition Filters Mehmet Aksit (aksit@cs.utwente.nl ://trese.cs.utwente.nl TRESE Group, Department of Computer.

22/31© 2001 TRESE Group, University of Twente

trese.cs.utwente.nl

Evolution problems

It looks like that if softwareincorporates non-trivial code,for example, multiple views,

history sensitivity,synchronization, real-time,

constraints, dynamic behavior,it does not evolve easily.

Page 23: An analogy to Composition Filters Mehmet Aksit (aksit@cs.utwente.nl ://trese.cs.utwente.nl TRESE Group, Department of Computer.

23/31© 2001 TRESE Group, University of Twente

trese.cs.utwente.nl

Filters are modular extensions

Instead of providingdedicated solutions

by modifyingclass descriptions, Composition Filters

offers modular extensions toclass abstractions

expressed in languages likeJava, C++ and Smalltalk.

a filter

A modularextensiona class

Page 24: An analogy to Composition Filters Mehmet Aksit (aksit@cs.utwente.nl ://trese.cs.utwente.nl TRESE Group, Department of Computer.

24/31© 2001 TRESE Group, University of Twente

trese.cs.utwente.nl

Filters are independent extensions

In case more than one concernhas to be expressed, multiple

filters can be used.

Modular &independentextensions

a class

filter1

filter2

filter3

filter4

Each filter transforms incomingand/or outgoing messages

to/from object.

message

Filters are independent ofeach other!

Page 25: An analogy to Composition Filters Mehmet Aksit (aksit@cs.utwente.nl ://trese.cs.utwente.nl TRESE Group, Department of Computer.

25/31© 2001 TRESE Group, University of Twente

trese.cs.utwente.nl

Filters are open-ended

New filter types can bedefined by programmers or

may be provided as libraries.However, filter definitions must

be carried out carefully.

Page 26: An analogy to Composition Filters Mehmet Aksit (aksit@cs.utwente.nl ://trese.cs.utwente.nl TRESE Group, Department of Computer.

26/31© 2001 TRESE Group, University of Twente

trese.cs.utwente.nl

Well-defined semantics

Filters have well-definedsemantics.

For example we havedefined the following filters:

Concern Filter typePre-post conditions ErrorMultiple views ErrorDynamic inheritance DispatchDelegation DispatchLayered architecture MetaHistory sensitivity Meta + history classProtocol Meta + protocol classSynchronization WaitReal time RealTime

Page 27: An analogy to Composition Filters Mehmet Aksit (aksit@cs.utwente.nl ://trese.cs.utwente.nl TRESE Group, Department of Computer.

27/31© 2001 TRESE Group, University of Twente

trese.cs.utwente.nl

Declarative specifications

Filters are expressed usingdeclarative specifications.

a filter specification

interpreter compiler

run-time solution compile-time solution

Filters can be interpreted,providing run-time solutions,

or they may be compiled,providing faster solutions.

Page 28: An analogy to Composition Filters Mehmet Aksit (aksit@cs.utwente.nl ://trese.cs.utwente.nl TRESE Group, Department of Computer.

28/31© 2001 TRESE Group, University of Twente

trese.cs.utwente.nl

Monitoring

DynamicMail

LockingMail

These characteristics enhanceobject-oriented programs.

For example, in E-tutorial 01,I presented an evolution

scenario. Classes Email andUSViewMail were extended by

the following classes:

Warning2Mail

ORViewMail

USViewMail

EMailWarning2Mail,

LockingMail,DynamicMail

ORViewMail,

Here the concerns aremultiple views, history

sensitivity, synchronizationand dynamic protocols.

Evolution scenario

& monitoring

Page 29: An analogy to Composition Filters Mehmet Aksit (aksit@cs.utwente.nl ://trese.cs.utwente.nl TRESE Group, Department of Computer.

29/31© 2001 TRESE Group, University of Twente

trese.cs.utwente.nl

Evolution scenario

To know more about implementation of the scenariousing Composition Filters please refer to:

http://trese.cs.utwente.nl/courses/e_tutorials/evolution_cf.ppt

Page 30: An analogy to Composition Filters Mehmet Aksit (aksit@cs.utwente.nl ://trese.cs.utwente.nl TRESE Group, Department of Computer.

30/31© 2001 TRESE Group, University of Twente

trese.cs.utwente.nl

References

For more information please refer to:

1. Composition Filters homepage

2. Publications on Composition Filters

2. Implementations of Composition Filters

3. A historical perspective on Composition Filters

4. e-tutorial 01 “Evolution problems in OO modeling”

5. e-tutorial 02 “Solving the evolution problems using Composition Filters”

Do you havereferences?

Page 31: An analogy to Composition Filters Mehmet Aksit (aksit@cs.utwente.nl ://trese.cs.utwente.nl TRESE Group, Department of Computer.

31/31© 2001 TRESE Group, University of Twente

trese.cs.utwente.nl

More information?

If you want to have moreinformation, just send an email:

Mehmet Aksit: [email protected] Bergmans: [email protected]