Subscribe by Email

Monday, December 10, 2012

What is Object Proxy Mechanism in IBM Rational Functional Tester?

The proxy pattern is recognized as a pattern for software designing in the field of computer science. In the most general term, the proxy can be defined as a class which functions as an interface to some other program or application. 

Where is Proxy used?

- A proxy can be used as an interface to anything such as the following:
  1. A network connection
  2. A large object present in the memory
  3. A file
- Or in other words, we can say that it can be used for any resource that is quite expensive and it is not affordable to duplicate it.
- An example of the proxy can be given by a reference counting pointer object. 
- There are situations where it is required to have multiple copies of a complex object. In such situations proxy pattern comes to play a big role. 
- It is adapted for incorporating the fly weight pattern for reducing the memory foot print of the application. 
- In typical situations, the instance created for a complex object is only one in count and multiple proxy objects are created. 
- All these proxy objects consist of a reference to an original object that is both single and complex. 
- The operations that are performed in a proxy object are carried forward to the original object. 
- If all the instances created for the proxy lose their scope, the memory of the complex object is de–allocated for that particular instance. 
- A virtual proxy pattern is used in java. 
- A proxy class can be used to access the remote methods. 

About Object Proxy Mechanism

- Firstly, an interface is created against which the rational functional tester creates the classes using the proxy patterns. 
- An interface may consist of many methods. 
- These methods need to be coded by all the classes which are to implement those particular methods. 
- If a proxy class is running on some other system rather than the original class, then the proxy class can represent its real image itself over there. 
- All the information regarding the image is obtained from the disk. 
- The multiple loading of the image can be avoided by using the proxy pattern with the code of the image. 
- This happens so because the image is accessed in a memory saving manner from some other system. 
- The primary purpose of the proxy object is to act as an intermediate object between the accessible object and the client. 
- The proxy object then serves the purpose of monitoring the life span of the object that is accessible. 
- Also, if the accessible object is not destroyed, all the calls are forwarded to it. - The proxy object checks for the availability of the accessible objects whenever a client makes calls to its accessible properties for getting some info. - If the object is found to be available, the client’s call is passed on to that accessible object. 
- If the case is opposite i.e., if the object is unavailable, an error is returned by the proxy object. 
- Returning of an error message by the proxy object is an indication that the destruction of the object has taken place and this indication is recommended.
The error returned is “CO E OBJNOTCONNECTED”.
- The COM or the component object model returns this error after CoDisconnectObject is called by the server. 
- A transparency is maintained between the client and the proxy object. 
Whenever client calls an accessible object, a pointer to the interface of that object is returned to the client. 
- In turn when this pointer is used by the client to call any of the object’s properties or methods, the execution of the code takes place within proxy object. 
- It is important for the rational functional tester to understand the interface of a given object in order to interact with it. 
- Usually, it is easy to interact with objects such as buttons, list boxes etc, however there are some custom objects in an application for which a proxy needs to be created.

No comments:

Facebook activity