1 Based on slides by Gitit Amihud. 2 The Person class String firstName String lastName Date birthDate Address home setFirstName(String) String getFirstName()

Slides:



Advertisements
Similar presentations
When is Orientated Programming NOT? Mike Fitzpatrick.
Advertisements

Adempiere Technical Training Day 5. Processes prepare method for getting the parameters into variables – Record_ID just work for buttons doIt method for.
Remote Procedure Call Design issues Implementation RPC programming
 Both System.out and System.err are streams—a sequence of bytes.  System.out (the standard output stream) displays output  System.err (the standard.
Synchronization of Distributed Objects ICS280: Distributed System Middleware Xia Zhao
Object Oriented Programming Chapter 7 Programming Languages by Ravi Sethi.
SWE 4743 Strategy Patterns Richard Gesick. CSE Strategy Pattern the strategy pattern (also known as the policy pattern) is a software design.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 4 Defining Your Own Classes.
Road Map Introduction to object oriented programming. Classes
Chapter 3 Data Abstraction: The Walls. © 2005 Pearson Addison-Wesley. All rights reserved3-2 Abstract Data Types Modularity –Keeps the complexity of a.
Dynamic Object-Oriented Programming with Smalltalk 1. Introduction Prof. O. Nierstrasz Summer Semester 2006.
© 2006 Pearson Addison-Wesley. All rights reserved4-1 Chapter 4 Data Abstraction: The Walls.
Inter Process Communication:  It is an essential aspect of process management. By allowing processes to communicate with each other: 1.We can synchronize.
Aspect-Oriented Software Development (AOSD) Tutorial #8 Composition Filters.
Creating Packages. 2 home back first prev next last What Will I Learn? Describe the reasons for using a package Describe the two components of a package:
Feb. 23, 2004CS WPI1 CS 509 Design of Software Systems Lecture #5 Monday, Feb. 23, 2004.
Bellevue University CIS 205: Introduction to Programming Using C++ Lecture 7: Methods.
Aspect-Oriented Software Development (AOSD) Additional Tutorial.
Guide To UNIX Using Linux Third Edition
Chapter 10 Classes Continued
Polymorphism. Lecture Objectives To understand the concept of polymorphism To understand the concept of static or early binding To understand the concept.
Distributed Systems Tutorial 3 -.NET Remoting – Crossing Application Boundaries.
© 2001 TRESE Group, University of Twente TRESE e-tutorial series 02Software the evolution problems using CF Solving the evolution problems using Composition.
C++ fundamentals.
Client/Server Software Architectures Yonglei Tao.
Object Oriented Software Development
Comparison of OO Programming Languages © Jason Voegele, 2003.
CSM-Java Programming-I Spring,2005 Introduction to Objects and Classes Lesson - 1.
Object-Oriented Software Testing. C-S 5462 Object-Oriented Software Testing Research confirms that testing methods proposed for procedural approach are.
An analogy to Composition Filters Mehmet Aksit TRESE Group, Department of Computer.
Sun Certified Java Programmer, ©2004 Gary Lance, Chapter 5, page 1 Sun Certified Java 1.4 Programmer Chapter 5 Notes Gary Lance
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 13 Introduction to Classes.
Client Call Back Client Call Back is useful for multiple clients to keep up to date about changes on the server Example: One auction server and several.
ADTs and C++ Classes Classes and Members Constructors The header file and the implementation file Classes and Parameters Operator Overloading.
Data Structures Using C++ 2E1 Inheritance An “is-a” relationship –Example: “every employee is a person” Allows new class creation from existing classes.
Topic 1 Object Oriented Programming. 1-2 Objectives To review the concepts and terminology of object-oriented programming To discuss some features of.
Distribution and components. 2 What is the problem? Enterprise computing is Large scale & complex: It supports large scale and complex organisations Spanning.
Chapter 10 Defining Classes. The Internal Structure of Classes and Objects Object – collection of data and operations, in which the data can be accessed.
Chapter 6 Introduction to Defining Classes. Objectives: Design and implement a simple class from user requirements. Organize a program in terms of a view.
© 2001 TRESE Group, University of Twente TRESE e-tutorial series 01Software evolution problems Mehmet Aksit and Lodewijk Bergmans TRESE Group Department.
Chapter 5 Introduction to Defining Classes
Object Oriented Programming
Testing OO software. State Based Testing State machine: implementation-independent specification (model) of the dynamic behaviour of the system State:
Object-Oriented Programming © 2013 Goodrich, Tamassia, Goldwasser1Object-Oriented Programming.
Composition Filter – Part 2 איתי בן אליעזר נובמבר 2004.
© 2001 TRESE Group, University of Twente TRESE e-tutorial series 02Software the evolution problems using CF Solving the evolution problems using Composition.
Introduction to Object-Oriented Programming Lesson 2.
Chapter 5 Classes and Methods II Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition) by S.N. Kamin, D. Mickunas, E.
Passing Parameters. 2 home back first prev next last What Will I Learn? List the types of parameter modes Create a procedure that passes parameters Identify.
1 WSDL Web Services Description Language. 2 Goals of WSDL Describes the formats and protocols of a Web Service in a standard way –The operations the service.
Topic 1 Object Oriented Programming. 1-2 Objectives To review the concepts and terminology of object-oriented programming To discuss some features of.
Chapter 7 Classes and Methods III: Static Methods and Variables Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition)
Fusion Design Overview Object Interaction Graph Visibility Graph Class Descriptions Inheritance Graphs Fusion: Design The overall goal of Design is to.
1 An SDL Tutorial Two primary elements: –Structure –Identifies the various components of the system, and the communication paths among them. –Components:
Patterns Protect from Change Rule: if something is going to change, make it an object. Strategy: make algorithm an object so it can change State: make.
Chapter 5 Introduction to Defining Classes Fundamentals of Java.
Smalltalk Meta-Programming Programming Languages HUJI 2010 Yardena Meymann.
Sections Inheritance and Abstract Classes
Multi-Methods in Cecil
Inheritance and Polymorphism
Chapter 3: Using Methods, Classes, and Objects
Presented by Gitit Amihud
6 Delegate and Lambda Expressions
Object Oriented Programming
Chapter 11: Classes, Instances, and Message-Handlers
Defining Classes and Methods
Defining Classes and Methods
Java Statements B.Ramamurthy CS114A, CS504 4/23/2019 BR.
Defining Classes and Methods
Presentation transcript:

1 Based on slides by Gitit Amihud

2 The Person class String firstName String lastName Date birthDate Address home setFirstName(String) String getFirstName() setLastName(String) String getLasttName(). We want to add method getPresent(Thing). but we want to enable calling it only on the Person’s birthday. we want to control the use of this method, depends on the state of the object

3 The solution:

4  Characteristics  The Principle of message filtering  the filter structure  Filter elements  Filters types  The Interface  Pseudo variables  Examples Topics:

5 The Composition Filter model The composition-filters object model extends the kernel object model. The extension is at the interface level and includes input and output filters. The Input filters deal with the messages that are received by the object, whereas output filters deal with the messages that are sent by the object.

6 methods Instance Variables The extension of the object model

7 Characteristics of the Composition Filter model Modular extension - filter can be attached to a class without modifying the definition of that class. Orthogonal extension – each filter extension to a class is independent from other filter extension. it allows easy composition of multiple filters. Declarative – A filter specification describes what it means but not how it is implemented.

8 The Principle of message filtering

9 The Filter structure Each filter consists of an ordered set of filter elements. A filter element consists of three parts: Condition => {matching part} {substitution part} Filter name : filter type = { Filter elements {

10 Filter element Condition => {matching part} {substitution part} o Condition - specifies a necessary condition to be fulfilled in order to continue the evaluation of a filter element: if the condition evaluates to false, usually the filter will reject the message and continue according to the rejection behavior if the condition evaluates to true the filter proceeds (sometimes it means sending error…). the default condition is True.

11 Filter element (cont) Condition => {matching part} {substitution part} o the enable operator => – causes the acceptance of every message that matches the matching part. the exclusion operator ~> - causes the acceptance of any message except for the massages that matches the matching part. the default operator is the enable operator o A matching part - the evaluated message is matched against a pattern consisting of a message selector and a target specification (Target.Selector). the target and the selector can be replaced by wild cards if there are several patterns, t he message is applied to each of them, from left to right, until a match has occurred.

12 Filter element (cont) Condition => {matching part} {substitution part} o A substitution part - specifies replacement values for the target and selector of the message. If the substitution part is a wild card, the target and selector remain unchanged. for example: IsBirthday => *.getPresent *.*

13 Filter types Error filter Dispatch filter Substitution filter Send filter Wait filter Meta filter (later)

14 Filter types (cont) Error filter Used for:restriction of class interface. This filter can be used to implement pre conditions and view partitioning. Used in: Input/Output filter set. Accept handler: The accepted message proceeds to the next filter. Reject handler: The rejected message is regarded as illegal and the program raises an exception stating where the exception occurred. parameters:none. When the condition holds, accept only messages in the list when condition is not true, proceed, otherwise accept only matching for example: select: Error = { IsBirthday =>[*.getPresent] *.*} “On birthday, accept only getPresent”

15 Filter types (cont) Dispatch filter Used for: initiation of a message execution. The dispatch filter introduces ‘inheritance’ by delegation. Used in: input filter set. Accept handler: The accepted message is delegated to the target object, or executed if target object is inner. Reject handler: The rejected message continues to the next filter. Parameters:none. for example: disp: Dispatch = {True => inner.*, someclass.* };

16 Filter types (cont) substitution filter Used for: substitution of the target, selector or target and selector of the message. Used in: Input/Output filter set. Accept handler: The accepted message is substituted by the target and selector specified in the parameter (substitution) part. Reject handler: The rejected message continues to the next filter. Parameters: the new target and/or selector.

17 Filter types (cont) Send filter Used for:initiation of a message delegation. Used in: Output filter set. Accept handler: The accepted message is passed to another object outside the sending object. Reject handler: The rejected message continues to the next filter. Parameters:none.

18 Filter types (cont) Wait filter Used for: concurrency control and synchronization. Used in: Input/Output filter set. Accept handler: The accepted message continues to the next filter. Reject handler: The rejected message is blocked until one or more conditions are satisfied. The message is then re- evaluated by the wait filter. Parameters:none.

19 The interface Class Example interface Internals Externals Conditions Methods Input filters Output filters End;

20 The interface (cont) Internals Fully encapsulated objects, used to compose the behavior of the cf object. they are created when their encapsulating object is created. Externals objects that exist outside the composition filter object, such as global objects. since they lay outside the object in which they are declared, they have to be passed to the cf object when it is created. Conditions typically represent an object’s state, used in a filter to test whether a message should be accepted or rejected. condition are methods without parameters, return boolean and should be free of side effects.

21 The interface (cont) Methods the name of the methods that are available to other objects (visible on the interface). Input filters filters for inspecting and manipulating incoming messages. Output filters filters for inspecting and manipulating outgoing messages.

22 Composition Filter model

23 The Person class class Person interface /* no internals */ /* no externals */ conditions isBirthday; isLocal; methods getFullName(Boolean) returns String getPresent(Thing) returns Nil inputfilters select: Error = { True => [*. getFullName]*.*, IsBirthday =>[*.getPresent]*.*}, disp: Dispatch = {inner.* }; /* no outputfilters */ end ;

24 Filter specification of class USViewMail class USViewMail interface internals mail: ; /* no externals */ conditions userView; systemView; methods … … … inputfilters multipleViews: Error = { userView => {putOriginator, putReceiver, putContent, getContent, send, reply}, systemView => {approve, putRoute, deliver}, True => {getOriginator, getReceiver, isApproved, getRoute, isDelivered} } ; invoke: Dispatch = { True=> inner.*, mail.* }; /* no outputfilters */ end ;

25 Pseudo variables Sender Server Self Inner Message

26 Sender the object that was responsible for sending the current executed message. Server the original receiver of the message that caused the current execution. Self the object that executes the current method. Pseudo variables (cont)

27 Inner the kernel, implementation part of the current object. Message the message that caused the current execution. Pseudo variables (cont)

28

29 Pseudo variables (cont) 1-sender 2-server 3-self 4-inner 5-message

30 class Secretary interface internals work : Employee; private : Spouse; conditions WorkHours; OffTime; methods schedule(Appointment) returns Boolean; Inputfilters dynInh : Dispatch = {WorkHours=>inner.*, OffTime=>private.*, WorkHours=>work.*}; end Dynamic inheritance Designate a mechanism that allows for enabling and disabling an inheritance relation with a superclass at runtime

31 Multiple views class Clerk interface internals empl : Employee; externals administrator : Secretary; conditions SentByManager begin return sender.isSubTypeOf(Manager); end; SentBySecretary begin return sender=administrator; end; methods getWorkingHours returns WorkingHours setWorkingHours(WorkingHours) returns Nil inputfilters select : Error = { SentByManager=>putTask, {SentByManager, SentBySecretary}=>getWorkingHours, True~>{putTask, getWorkingHours} }; delegate : Dispatch = { inner.*, empl.*, administrator.schedule }; end

32 Filter types: Meta filter Meta filter Used for: reflection on object interactions. Used in: Input/Output filter set. Accept handler: The accepted message is reified (converted to an instance of class Message and then passed as an argument ) and delegated to a meta object. Reject handler: The rejected message continues to the next filter. Parameters:the target meta object and the selector of the function to be called.

33 class LoggedClerk interface internals clerk : Clerk; // inherit from clerk externals bigBrother : LogACT; // this declares an external ACT object inputfilters reifyIn : Meta = { [*.*]bigBrother.logMessage }; // reify and send message to the ACT inherit : Dispatch = { clerk.* }; outputfilters reifyOut : Meta = { [*.*]bigBrother.logMessage }; // reify and send message to the ACT end Filter types: Meta filter (cont)

34 class LogACT interface comment "this class logs all the received meta-messages, and fires them again" ; methods logMessage(Message) returns Nil; Inputfilters disp : Dispatch = {inner.* }; end; Filter types: Meta filter (cont)

35 Filter types: Meta filter (cont) class LogACT implementation instvars log : OrderedCollection; methods logMessage(mess : Message) returns Nil begin log.addLast(mess); mess.fire; end; end; // class LogACT implementation

36 Lodewijk Bergmans, The composition Filters object model Lodewijk Bergmans & Mehmet Aksit.Composing multiple concerns using Composition Filters Mehmet Aksit & Bedir Tekinerdogan. Solving the modeling problems of object-oriented languages by composing multiple aspects using Composition Filters.