Composition filters

Short description: Model in software development

The composition filters model denotes a modular extension to the conventional object model. It provides a solution for a wide range of problems in the construction of large and complex applications. Most notably, one implementation of composition filters provides an abstraction layer for message-passing systems.

Composition filters work by changing the behavior of an object through the manipulation of incoming and outgoing messages. This is done with the help of input and output filters which are controlled by conditions.

## Contents

* 1 History and motivation
* 2 Design
* 2.1 Implementation part
* 2.1.1 Instance variables
* 2.1.2 Methods
* 2.1.2.1 Initial method
* 2.1.3 Conditions
* 2.2 Interface part
* 2.2.1 Filters
* 2.2.1.1 Filter design
* 2.2.2 Internals
* 2.2.3 Externals
* 3 SINA programming language
* 4 Applications
* 4.1 Abstract communication types
* 4.2 Database integration model
* 4.3 Other implementations
* 5 See also
* 6 References
* 7 External links

## History and motivation

In concurrent and distributed computing, there are many problems such as scattering and tangling of code, which were difficult to handle using traditional object-oriented models. A need arose to develop a new software development model which addressed these concerns and this resulted in the formation of the Aspect-oriented software development paradigm. Several models in this paradigm were developed concurrently, and one of them is the Composition Filters Object Model. The creators of this model were Mehmet Aksit and various PhD students (Lodewijk Bergmans, Jan Bosch, Bedir Tekinerdogan) and many MSc. students from the TRESE Group at the University of Twente in the Netherlands. It was based on the Sina language [1][2] which was developed by Mehmet Aksit in his PhD thesis. Many advancements have been made in the model since then.[3][4]

## Design

The design of the composition filters model is an extension of the design of the kernel object model. The design consists of two major parts – the kernel (implementation part), and the outer layer (interface part). The extensions are made in the interface part to produce the composition filters model from the traditional kernel object model.[5]

### Implementation part

The implementation part or the kernel consists of a single layer with three types of components:

1. Instance variables
2. Methods
3. Conditions

It also consists of an encapsulation boundary which separates the implementation and the interface layers.

#### Instance variables

The Instance Variables are the only components of the kernel which are fully encapsulated. It is not possible to access these variables from outside the boundary. In this model, the Instance Variables can be of any type. Primitive data types such as integers, characters and user-defined data types such as classes and enumerations are all considered to be Instance Variables.

#### Methods

The behavior of an object is implemented through its methods. The method consists of two parts – the method body and the method declaration. The actions that an object is expected to perform on being invoked is defined in the method body. The method declaration consists of the method name, the name and type of the parameters and the return type. Methods are not completely encapsulated in the kernel and can be used in the interface part.

##### Initial method

The initial method is a special method whose function is similar to that of the constructors in other object oriented models.

#### Conditions

A method which has a Boolean return type and an empty parameter list is called a condition. Conditions can be used to provide information about the current state of an object. Similar to methods, conditions too can be used in the interface part and most of the usage of the conditions is outside the implementation part.

### Interface part

The interface part of the composition filters object model consists of two major components – the input and output filters. It also contains two supporting components – the internals and the externals. Moreover, the methods and conditions from the implementation part can also be accessed from the interface part.

#### Filters

The input and output filters are similar in design but vary in functionality. The input filters are tasked with dealing with the messages which are sent to the object, while output filters do so for messages being sent by the object. The main function of the filters is to manipulate the messages which arrive and pass them to the next layer. Filters are designed in layers, a message has to pass through one layer to reach the next. Each layer may consist of different filters. Each filter specifies a particular pattern. The pattern defines a syntax which an incoming or outgoing message must conform to. When a message arrives, two possibilities exist – the message is rejected by the filter or is manipulated by the filter. The way in which a message is rejected or manipulated depends upon the type of the filter.

##### Filter design

A filter is designed using a set of filter element. This set is ordered since each message is applied from left to right. This continues till a match occurs.

Each filter element consists of three components – a condition, a matching part and a substitution part.

* Condition – The necessary state which the element has to be in to continue the evaluation of the message.
* Matching part – The part where the evaluated message is matched against a pattern.
* Substitution part – The part where the replacement values are specified for a message which has been matched earlier.

#### Internals

Internals are nested objects which reference to the input filters. They are completely encapsulated in the interface part. They are automatically created during the creation of an object.

#### Externals

Externals are nested objects which reference to the output filters. They are used to declare objects which lie outside the composition filters model but are still within its scope. An example of such objects are global variables.

## SINA programming language

The SINA programming language is an object oriented programming language which was designed to implement the features of composition filters object model. Each SINA program is a collection of classes, each of which can be separated into the implementation and the interface. The first implementation of SINA was for the Smalltalk and ran only in that environment.[6]

## Applications

### Abstract communication types

An abstract communication type object abstracts communication and interactions among objects. The objectives of an ACT is to improve the reusability throughout the application, to hide the implementation details in separate modules and reducing the complexity of modeling layered communications architectures.

Experts[who?] believe that conventional object-oriented models are too low-level because the semantics of communication between two objects cannot be easily extended to other objects. Therefore, there was a need for a high level language mechanism that can be used to model layered system architectures in which each system in a layer exchanges data with its adjacent layers. Mechanisms such as inheritance only provide abstraction at the object level, but fail in abstraction of communication among objects.

Composition filters model were applied to abstract communications among objects. The object module is extended by introducing input and output filters which determine what needs to be done with received and sent messages.

Notable ACT advantages include:

* ACTs can be used for intercepting and manipulating messages both of which is achieved by input and output filters
* ACTs reduce the complexity of programs by hiding the interaction code (communication details) in separate modules. Programmers can apply object oriented mechanisms to reuse these components.[7]

### Database integration model

Composition filters can be used to incorporate database features such as persistent dynamic data structures, data sharing, transactions, multiple views and associative access into an object-oriented language. The basic object-oriented mechanisms such as inheritance and delegation are also provided by composition filters. In the database integration model, database operations such as union, intersect, exclude, and select are developed using composition filters without disintegrating object oriented mechanisms such as data abstraction, encapsulation, message passing and inheritance.[8]

### Other implementations

Many implementations of composition filters exist (including SmallTalk and Java implementations). The advantage of existing implementations is that there is no difference between the conceptual and implementation model, which makes it easier to understand the implementation of certain features. The drawback, however, is that these implementations are slow and have a lot of overhead. One implementation in Java, namely ComposeJ, addressed this problem by using a compile-time oriented source modification approach.[9]

## See also

* Aspect-oriented programming
* Aspect-oriented software development
* AspectJ

## References

1. ↑ Aksit, Mehmet (1989-03-23). "On the Design of the Object-Oriented Language Sina". University of Twente Research Information. http://eprints.eemcs.utwente.nl/10162/.
2. ↑ Aksit, Mehmet (1988). "Data Abstraction Mechanisms in Sina/st". ACM SIGPLAN Notices (ACM Press. ISSN 0362-1340) 23 (11): 267–275. doi:10.1145/62084.62107. http://eprints.eemcs.utwente.nl/10147/.
3. ↑ Aksit, Mehmet (1992). "An Object-Oriented Language-Database Integration Model: The Composition-Filters Approach". ECOOP '92 European Conference on Object-Oriented Programming. Lecture Notes in Computer Science. 615. Springer Verlag, Berlin. pp. 372–395. doi:10.1007/BFb0053047. ISBN 3-540-55668-0. http://eprints.eemcs.utwente.nl/13385/.
4. ↑ Aksit, Mehmet (1992). "Obstacles in Object-Oriented Software Development". ACM SIGPLAN Notices 27 (10): 341–358. doi:10.1145/141937.141965. https://research.utwente.nl/files/6477832/AksitBergmans1992.pdf.
5. ↑ "The Composition Filters Object Model". http://trese.cs.utwente.nl/oldhtml/publications/paperinfo/cf.pi.top.htm.
6. ↑ Ziring, Neal. "Dictionary of Programming Languages". http://cgibin.erols.com/ziring/cgi-bin/cep/cep.pl?_key=Sina.
7. ↑ Mehmet Aksit, Ken Wakita, Jan Bosch, Lodewijk Bergmans and Akinori Yonezawa, "Abstracting Object Interactions Using Composition Filters", University of Twente, University of Tokyo and Tokyo Institute of Technology
8. ↑ Mehmet Aksit, Lodewijk Bergmans and Sinan Vural, "An Object-Oriented Language-Database Integration Model: The Composition-Filters Approach", Computer Science Department, University of Twente
9. ↑ Johannes Cornelis Wichman, "ComposeJ – The development of a preprocessor to facilitate Composition Filters in the Java Language", University of Twente

## External links

* The Composition Filter Homepage
* Composition Filters Implementation
* http://trese.cs.utwente.nl/oldhtml/publications/papers/CF_superimposition_bergmans_aksit.pdf
* Filters - History
* SINA Programming Language
* \- Composition Filters in C++

* v
* t
* e

Aspect-oriented software development

Concepts|

* Advice
* Aspect
* Aspect-oriented programming
* Aspect weaver
* Cross-cutting concerns
* Join point
* Pointcut

Languages|

* AspectC++
* AspectJ
* AspectWerkz

0.00

(0 votes)

Original source: https://en.wikipedia.org/wiki/Composition filters. Read more

|

Retrieved from "https://handwiki.org/wiki/index.php?title=Composition_filters&oldid=4158178"
*[v]: View this template
*[t]: Discuss this template
*[e]: Edit this template