Subscribe to Java/SCJP        RSS Feed
- - - - -

Prototype Pattern

Icon Leave Comment
The prototype pattern is used in cases where the cost of creating a new object is much more than simply editing the attributes of an already existing object. So this pattern should be used when one has the privileges to modify the desired attributes of the object.
In java, the prototype of an object can be got by using the clone method. The method...
- - - - -

Object Pool

Icon Leave Comment
Connection pooling is the process of maintaining a pool of connection and reusing them each time some statement is to be executed in the database. It is a general concept which can be applied in any programming language, but here we will implement it in Java programming language.

Design:
A class will maintain all the connections in a vector...
- - - - -

Singleton Pattern

Icon 1 Comments
The Singleton pattern is used for classes which should have only one instance in the application. The other classes can't invoke the constructor directly because it is declared private and some public static method is provided which returns the single instance. This pattern makes the instance available globaly and thus should be used...
- - - - -

Builder pattern

Icon Leave Comment
On the one hand, factory method is concerned about what is made but the builder pattern is concerned about how to make.
A builder pattern implementation will have:
1)an abstract builder
2)some concrete builders
3)a director
4)a product/object
5)a requester

The requester uses the director to build the product/object.
The builder constructs the...
- - - - -

Abstract Factory Method Pattern

Icon Leave Comment
The Abstract factory pattern goes one level above in abstraction than Factory pattern. Here a concrete factory is provided for each concrete class and these concrete factories implement an abstract factory class. The advantage is that a single reference to abstract factory can be used to reference the concrete factories. This way all concrete...
- - - - -

Factory Method Pattern

Icon Leave Comment
Obect instatiation is a critical part of any application. If a class is creating an instance of other then it has to know the way to get the instance. The instatiation can be decoupled using the factory class. The factory class is responsible for returning an instance to the requester class. Usually it is the constructor that returns the instance...

Page 1 of 1

May 2013

S M T W T F S
      1234
567891011
12131415161718
192021 22 232425
262728293031 

Recent Entries

Recent Comments

Search My Blog

0 user(s) viewing

0 Guests
0 member(s)
0 anonymous member(s)