November 24th, 2009
Vinay
1. Intercepting Filter:
Problem : Preprocessing and post-processing of a client Web request and response are required.When a request enters a Web application, it often must pass several entrance tests prior to the main processing stage. For example,
Has the client been authenticated?
Does the client have a valid session?
Is the client’s IP address from a trusted network?
Does the request path violate any constraints?
What encoding does the client use to send the data?
Do we support the browser type of the client? Read more…
November 24th, 2009
Vinay
The following table shows the kinds of UML relationships between classes, their notation, and what they mean
Association : When two classes are connected to each other in any way, an association relation is established. For example A “student studies in a college” association can be shown as:

association Relationhsip
Read more…
September 14th, 2009
Vinay
Abstract Factory: This is a Creational pattern.
It provides an interface for creating families of related or dependent objects (products) without specifying their concrete classes.
J2EE technology uses this pattern for the EJB Home interface, which creates new EJB objects.
It isolates concrete classes.
It makes exchanging product families easy.
It promotes consistency among products.
Supporting new kinds of products is difficult
Factory Method : This pattern defines an interface for creating an object, but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses.
J2EE technology uses this pattern for the EJB Home interface, which creates new EJB objects.
Eliminates the need to bind application-specific classes into your code.
Gives subclasses a hook for providing an extended version of an object being constructed.
Difference between Factory and Abstract Factory
The Factory Method pattern is for creating a single object type. It provides a generic interface for client objects, and defers instantiation to subclasses that implement the generic interface.
The Abstract Factory pattern is for creating multiple, related objects, and defers instantiation to subclasses that implement the generic interface of the factory object
When studying UML , one of the most important questions which comes to mid of a programmer is , What is the difference between Aggregation and Composition ?
Composition and Aggregation are types of associations. They are very closely related and in terms of programming there does not appear much difference. I will try to explain the difference between these two by java code examples
Aggregation: the object exists outside the other, is created outside, so it is passed as an argument (for example) to the construtor. Ex: People – car. The car is create in a different context and than becomes a person property.
Composition: the object only exists, or only makes sense inside the other, as a part of the other. Ex: People – heart. You don’t create a heart and than passes it to a person.
Code example for aggregation:
// WebServer is aggregated of a HttpListener and a RequestProcessor
public class WebServer {
private HttpListener listener;
private RequestProcessor processor;
public WebServer(HttpListener listener, RequestProcessor processor) {
this.listener = listener;
this.processor = processor;
}
}
Code example for composition
// WebServer is an composition of HttpListener and RequestProcessor and controls their lifecycle
public class WebServer {
private HttpListener listener;
private RequestProcessor processor;
public WebServer() {
this.listener = new HttpListener(80);
this.processor = new RequestProcessor(“/www/root”);
}
}
In composition, whole has responsibility of preventing garbage collection of part.