ArticleslgStudy

computer science

Composition filters

Composition filters is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Composition filters rather than just read about it. In short: 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.

Key takeaways

  • Composition filters belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Composition filters to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Composition filters from memory before moving on to harder problems.

Reference excerpt

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.

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 which was developed by Mehmet Aksit in his PhD thesis. Many advancements have been made in the model since then.

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.

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

Instance variables Methods 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.

Applications

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Composition filters

Start with the simplest possible case. Write down what Composition filters claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Composition filters before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Composition filters ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Composition filters

In research
Composition filters appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Composition filters in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Composition filters is common in secondary-school and first-year university syllabi. It links to neighbouring topics Object models, Software design patterns, so understanding it makes those chapters shorter.
In everyday life
Look for Composition filters outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Composition filters” →

How to study Composition filters in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Composition filters means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Composition filters out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Composition filters in simple terms?

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.

Why does Composition filters matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Composition filters?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Composition filters.

Tags

  • Object models
  • Software design patterns

Keep exploring