Message Forwarding Semi-automatic proxy delegation.

Slides:



Advertisements
Similar presentations
Message Passing Vs Distributed Objects
Advertisements

SUMMARY: abstract classes and interfaces 1 Make a class abstract so instances of it cannot be created. Make a method abstract so it must be overridden.
METHOD OVERRIDING 1.Sub class can override the methods defined by the super class. 2.Overridden Methods in the sub classes should have same name, same.
Portability and Safety Mahdi Milani Fard Dec, 2006 Java.
Remote Method Invocation
Remote Object Invocation
CS 4800 By Brandon Andrews.  Specifications  Goals  Applications  Design Steps  Testing.
Netprog CORBA Intro1 CORBA Common Object Request Broker Architecture Based partially on Notes by D. Hollinger and Java Network Programming and Distributed.
C#.NET C# language. C# A modern, general-purpose object-oriented language Part of the.NET family of languages ECMA standard Based on C and C++
Stéphane Ducasse6.1 Essential Concepts Why OO? What is OO? What are the benefits? What are the KEY concepts? Basis for all the lectures.
1 Java (vs. C++). 2 Object-oriented Programming Java and C++ are the most popular object-oriented programming languages Java Sun Microsystems in 1990.
How Does Remote Method Invocation Work? –Systems that use RMI for communication typically are divided into two categories: clients and servers. A server.
Communication in Distributed Systems –Part 2
OOP in Java Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
A Framework for Smart Proxies and Interceptors in RMI Nuno Santos P. Marques, L. Silva CISUC, University of Coimbra, Portugal
OOP Languages: Java vs C++
Programming Languages and Paradigms Object-Oriented Programming.
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 2: Modelling.
220 FINAL TEST REVIEW SESSION Omar Abdelwahab. INHERITANCE AND POLYMORPHISM Suppose you have a class FunClass with public methods show, tell, and smile.
CSM-Java Programming-I Spring,2005 Objects and Classes Overview Lesson - 1.
Introduction to Object Oriented Programming. Object Oriented Programming Technique used to develop programs revolving around the real world entities In.
CPSC 410.  Build on previous Connector lectures  Learn how to implement flexible connector implementations  Learn the Dependency Injection pattern.
CSCI 6962: Server-side Design and Programming Web Services.
Polymorphism, Inheritance Pt. 1 COMP 401, Fall 2014 Lecture 7 9/9/2014.
CS 390- Unix Programming Environment CS 390 Unix Programming Environment Topics to be covered: Distributed Computing Fundamentals.
Chapter 21 Generics 1. Generics - Overview Generic Methods specify a set of related methods Generic classes specify a set of related types Software reuse.
Features of Object Oriented Programming Lec.4. ABSTRACTION AND ENCAPSULATION Computer programs can be very complex, perhaps the most complicated artifact.
Factory Method A Creational Design Pattern. Factory Method Key Features  Defines an interface for creating objects without needing to know each object’s.
 OOPLs  Help companies reduce complexity  Increase competition in open markets  Speeds up development  Improves maintenance, resusability, modifiability.
Recitation 4 Abstract classes, Interfaces. A Little More Geometry! Abstract Classes Shape x ____ y ____ Triangle area() base____ height ____ Circle area()
LAB 1CSIS04021 Briefing on Assignment One & RMI Programming February 13, 2007.
1 Java RMI G53ACC Chris Greenhalgh. 2 Contents l Java RMI overview l A Java RMI example –Overview –Walk-through l Implementation notes –Argument passing.
Session 21 Chapter 10: Mechanisms for Software Reuse.
Programming With Java ICS201 University Of Hail1 Chapter 13 Interfaces.
Week 14 - Monday.  What did we talk about last time?  Introduction to C++  Input and output  Functions  Overloadable  Default parameters  Pass.
Chapter 18 Java Collections Framework
CORBA/IDL Common Object Resource Broker Architecture (CORBA) Interface Definition Language (IDL) Object Management Group (OMG) ( Specification.
Polymorphism. 3 main programming mechanisms that constitute OOP: 1. Encapsulation 2. Inheritance 3. Polymorphism.
Java Dynamic Proxy Bibliography: reflection/proxy.html
© Keren Kalif Advanced Java Topics Written by Keren Kalif, Edited by Liron Blecher.
Lecture 10 Concepts of Programming Languages Arne Kutzner Hanyang University / Seoul Korea.
 Objects versus Class  Three main concepts of OOP ◦ Encapsulation ◦ Inheritance ◦ Polymorphism  Method ◦ Parameterized ◦ Value-Returning.
OOPs Object oriented programming. Abstract data types  Representationof type and operations in a single unit  Available for other units to create variables.
What is a Servlet? Java Program that runs in a Java web server and conforms to the servlet api. A program that uses class library that decodes and encodes.
S.Ducasse Stéphane Ducasse 1 Essential OO Concepts Stéphane Ducasse.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
CSI 3125, Preliminaries, page 1 SERVLET. CSI 3125, Preliminaries, page 2 SERVLET A servlet is a server-side software program, written in Java code, that.
S Ramakrishnan1 Systems V & V, Quality and Standards Dr Sita Ramakrishnan School CSSE Monash University.
Interfaces and Inner Classes
Java Programming, Second Edition Chapter Twelve Advanced Inheritance Concepts.
Interfaces, Abstract Classes, and Polymorphism. What Is an Interface? An interface is the set of public methods in a class Java provides the syntax for.
Java RMI. RMI Any object whose methods can be invoked from another Java VM is called a remote object.
1 Lecture 15 Remote Method Invocation Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung Institute of Technology.
Distributed programming in Java Faculty:Nguyen Ngoc Tu Session 5 - RMI.
Mid-Year Review. Coding Problems In general, solve the coding problems by doing it piece by piece. Makes it easier to think about Break parts of code.
CEN6502, Spring Understanding the ORB: Client Side Structure of ORB (fig 4.1) Client requests may be passed to ORB via either SII or DII SII decide.
Distributed Computing & Embedded Systems Chapter 4: Remote Method Invocation Dr. Umair Ali Khan.
Topic 4: Distributed Objects Dr. Ayman Srour Faculty of Applied Engineering and Urban Planning University of Palestine.
 It is a pure oops language and a high level language.  It was developed at sun microsystems by James Gosling.
Design issues for Object-Oriented Languages
Remote Method Invocation
Object Oriented Programming in Java
Array Array is a variable which holds multiple values (elements) of similar data types. All the values are having their own index with an array. Index.
Programming Models for Distributed Application
7. Decorator, Façade Patterns
Lecture 4: RPC Remote Procedure Call Coulouris et al: Chapter 5
Lecture 4: RPC Remote Procedure Call CDK: Chapter 5
Copyright © 2001 Qusay H. Mahmoud
Java Remote Method Invocation
Subtype Substitution Principle
Presentation transcript:

Message Forwarding Semi-automatic proxy delegation

What is a proxy? An element that represents another element Example: –Proxy vote – slip that is sent to a central authority in lieu of appearing and voting in person. The proxy vote represents the vote of the individual. –proxy delegate – simpler interface to a complex system

Bridge Pattern client with an interface server that implements the interface a means of communicating between the client and the server. The Goal is to have transparent distributed applications. Key for using RMI.

What is message forwarding? A message is passed from one place to another. In OOP Message Forwarding means: –Taking a method invocation and forwarding it to another instance.

Example class Mammal { public boolean hasHair() { return true; }

Movable class class Movable { int x, int y; public void move(int _x, int _y) { x = _x; y = _y; }

MovableMammal class MovableMammal { Movable m; Mammal mm; MovableMammal(Movable _m, Mammal _mm) { m = _m; mm = _mm; }.....

MovableMammal... public void move(int x, int y) { m.move(x, y); } public boolean hasHair() { return mm.hasHair(); }

UML the proxy uses the implementation of another class uses delegator delegatee e.g., MovableMammal

What is a static proxy degation? Have method invocations that are checked at compile time. Adding methods to the delegatees does NOT mean that methods will appear in the proxy.

What is dynamic delegation? New methods in the delegatee automatically appear available in the proxy at run-time. New feature for JDK 1.3 Not type safe. Exceptions can be thrown. For example: using reflection to invoke a string on an instance.

Semi-automatic Static Delegation Compile-time checks for type safety. Delgatee changes are discovered using introspection and cause a resynthesis of the proxy code. process of Java source code synthesis that occurs at a pre-processing run-time.

A new Time design time (input instance to the synthesizer) generate time (output proxy code to a file) compile time (compile the new proxy) Linking time (dynamically link to the proxy and classes it uses) Run time (where invoke method in the proxy)

Why do semi-automatic static proxy delegation? Better interface to a complex system Better Code Reuse Easier than manual message forwarding Type safe Easier maintenance Alternative to inheritance

What is wrong with using Multiple Inheritance? No MI in Java! Less reliable –duplicate methods with the same signature then you must disambiguate –shadowing is decided at compile-time using some technique –topological sorting is an automatic means of disambiguating.

Example of MI Confusion class TrigRad { public double cos(double d) { return Math.cos(d);//in radians }

TrigDeg class TrigDeg { public double cos(double d) { return Math.cos(d * Math.PI/180.0); }

MI and Trig class Confusion extends TrigRad, TrigDeg { double d = cos(90); }// this is not allowed in Java but is // in C++ or Smalltalk. Or in ZetaLisp // Simula Ambiguity can exist for topological sorting in MI.

What is Diamond Inheritance? base class is sub-classed by two other classes that are in turn sub-classed by a 4 th class. Stream IS OS IOS

What is wrong with Diamond Inheritance? Has all the problems of multiple inheritance. More complex for linking stage. Overhead for each instance grows. Most of the overhead is in malloc or NEW memory is taken from the HEAP. Fragile base class (constant recompilation)

What is good about Diamond Inheritance? Automatic addition of features to a subclass. Single large class. Toolkits are easier to create