Browse Prior Art Database

Dynamic binding between Java classes by double binding maps for application configuration, and Factory pattern.

IP.com Disclosure Number: IPCOM000015309D
Original Publication Date: 2002-Apr-01
Included in the Prior Art Database: 2003-Jun-20
Document File: 5 page(s) / 154K

Publishing Venue

IBM

Abstract

To create modules on loosely-coupling basis,dynamic binding mechanism is required. This idea provides design policy to solve the dynamic binding mechanism for loosely -coupled Java classes. Factory pattern and Abstract Factory pattern of Gof improves reusability of components by separating instanciation codes from components(Fig.1).Programming codes for the instanciation of other classes can be removed from "Class A" using Factory pattern. It seems that "Class A" comes to be more loosely coupled with other classes like "Class B" and "Class C" by introducing Factory pattern.Surely "Class A" is not directly concerned with other classes.But they are tightly coupled each other via Factory classes as it is because each factory classes exist on instanciated class basis.Dynamic binding mechanism cannot be implemented by Factory pattern only.

This text was extracted from a PDF file.
At least one non-text object (such as an image or picture) has been suppressed.
This is the abbreviated version, containing approximately 36% of the total text.

Page 1 of 5

  Dynamic binding between Java classes by double binding maps for application configuration, and Factory pattern.

To create modules on loosely-coupling basis,dynamic binding mechanism is required. This idea provides design policy to solve the dynamic binding mechanism for loosely -coupled Java classes. Factory pattern and Abstract Factory pattern of Gof improves reusability of components by separating instanciation codes from components(Fig.1).Programming codes for the instanciation of other classes can be removed from "Class A" using Factory pattern. It seems that "Class A" comes to be more loosely coupled with other classes like "Class B" and "Class C" by introducing Factory pattern.Surely "Class A" is not directly concerned with other classes.But they are tightly coupled each other via Factory classes as it is because each factory classes exist on instanciated class basis.Dynamic binding mechanism cannot be implemented by Factory pattern only.

Factory Interface

Class_A

............

1.

Set an concrete Factory class Factory ............

............

Instanciated a class by the concrete Factory class Invokes a method of an instance ............

2.

3.

  B_Factory class (can instanciate

B class)

  C_Factory class (can instanciate

C class)

new(Instanciation)

 B CObjectObject

<Behaviour>
1.Choose an concrete Factory class
2.The choosenconcrete Factory class instanciates an object of a class.
3.Invoke the object created by Factory.

Figure 1. The basic behaviour of Factory pattern

1

[This page contains 3 pictures or other non-text objects]

Page 2 of 5

Unit of Factory class,say one Factory class by one instanciated class,is one of causes which make dynamic binding unable.To accomplish dynamic binding, Factory class should be designed as a integrated common class for instanciation of all classes,then. "Instanciation by class name" function of Java is useful to implement the common Factory
class."Instanciation by class name" is be expressed as follows;

     Object o = Class.forName(String className).newInstance(); If you specify a name of class as a parameter of forName() method, you can get an instance of the class as a return value of newInstance() method.It makes Factory class an integrated common Factory to make use of this function as the implementation of create method of

Factory class.

A class name should not be specified as a parameter of create method of Factory class,because class names depend on application requirement.Class names aren't adequate to common Factory's parameter.Instead,you sould specify an abstract ID like Application ID for a parameter of create method.At this time, it is necessary to convert from an ID to a class name on create method.The binding map for application configuration holds binding between IDs and class names, and is used for this conversion.Figure 2 expresses scenario of dynamic binding by Factory class and the binding map for application configuration.

2

Page 3 of 5

AppServer(JVM process)

DB or XML file

ApplID Cl...