Wednesday, June 22, 2005

Inversion of Control Design Pattern for light weight Java

devx Article
Assume Class A has a relationship with Class B: it wants to use the services of Class B. The usual way to establish this relationship is to instantiate Class B inside Class A. Though this approach works, it creates tight coupling between the classes. You can't easily change Class B without modifying Class A. To eliminate the coupling, you can have a Configurator inject the instance of Class B (Object "b") to the instance of Class A (Object "a"). If you want to change the implementation of Class B later on, you simply change the Configurator object. So, the control of how Object "a" gets the reference of Object "b" is inverted. Object "a" is not responsible for getting the reference to Object "b". Instead, the Configurator is responsible for it. This is the basis for the IoC design pattern.

PicoContainer - Inversion of Control: "Simply put, a component designed according to IoC does not go off and get other components that it needs in order to do its job. It instead declares these dependencies, and the container supplies them. Thus the name IoC/DIP/Hollywood Principle. The control of the dependencies for a given component is inverted. It is no longer the component itself that establishes its own dependencies, but something on the outside. That something could be a container like PicoContainer, but could easily be normal code instantiating the component in an embedded sense.
Examples

Here is the simplest possible IoC component :

public interface Orange {
// methods
}
public class AppleImpl implements Apple {
private Orange orange;
public AppleImpl(Orange orange) {
this.orange = orange;
}
// other methods
}

"

Martin Flower

Thursday, June 16, 2005

Accept-Encoding :gzip to compress information in http

Information send by the server can be zipped to reduce size; Server should support compression and browser should support decompression. Most browsers do support this feature using the Accept-Encoding :gzip. Every server should have a setting that enables/disables this feature.

For IIS


From w3

The Accept-Encoding request-header field is similar to Accept, but restricts the content-codings (section 3.5) that are acceptable in the response.

       Accept-Encoding  = "Accept-Encoding" ":"
                          1#( codings [ ";" "q" "=" qvalue ] )
codings = ( content-coding | "*" )

Examples of its use are:

       Accept-Encoding: compress, gzip
Accept-Encoding:
Accept-Encoding: *
Accept-Encoding: compress;q=0.5, gzip;q=1.0
Accept-Encoding: gzip;q=1.0, identity; q=0.5, *;q=0

Thursday, June 09, 2005

Amaya w3c Browser and Authoring tool

Amaya

Amaya is a Web client that acts both as a browser and as an authoring tool. It has been designed by W3C with the primary purpose of demonstrating new Web technologies in a What You See Is What You Get (WYSIWYG) environment. The current version implements the Hypertext Markup Language (HTML), Extensible Hypertext Markup Language (XHTML), Mathematical Markup Language (MathML), Scalable Vector Graphics (SVG), the animation module of Synchronized Multimedia (SMIL Animation), Cascading Style Sheets (CSS), and Hypertext Transfer Protocol (HTTP).