Getting started with IoC – A simplified tutorial

I had mentioned about Inversion of Control (IoC) in my earlier post Inversion of Control – for easy integration. In this post I will show you how you can actually make your integration easy with implementation of a mini application sample based on IoC.

Objective
The main objective of this mini tutorial is to highlight the implementation of an interface based Inversion of Control (IoC) architecture and to state how it could help in the integration and maintenance of the application.

For this mini application I will use the following set of classes

  1. Dependency – This is the interface which is implementation as per my application versions progress and which will be used by the View components in my application. In other words this is my Model component in a MVC architecture
  2. Dependent – This is my View component which uses the Model component to produce the results for displaying. As the name suggests the class is dependent on the Dependency implementation.
  3. Injector – This is most important class in the application and which introduces the aspect of Inversion Of Control into the applications. This class can also be referred as the configurator class.
  4. Finally there can a number of implementations of the Dependency interface according to the needs of the application.

Note: This mini tutorial is based on the concept of Interface based IOC. It also assumes that you import the required classed in your Classes when compiling them.

Lets start with our tutorial. Read the rest of this entry »

Inversion of Control – for easy integration

You may have witnessed some of the J2EE frameworks provide a technique to get dynamically bound plain objects by making them bind to some features of the framework outside of the plain objects. This technique is called as the IoC or Inversion of Control. If we have to know about the meaning of this term let us emphasize on what inversion depicts in aspect of implementing some features in plain objects.

Overview
Suppose I have some functionality of my J2EE application in my model which is nothing but a simple POJO. Now I want this POJO to be incorporated into a web tier which is an MVC (Model View Controller) Architecture. The last thing I would want to do is modify the source of the model, view or controller and put in some additional code which would do this integration. But suppose I choose a framework in such a way that I put what exactly is to be done by the POJO in the MVC architecture in a simple XML config file and then put the config file in the framework and the framework does the rest of the integration work. Read the rest of this entry »

Launch of TechTracer

Hi friends,
It bring me great pleasure to announce the launch of my new technology oriented site names TechTracer. The aim of this site would be to promote new technology related concepts and tools to help you in your daily activities.

The vision for this site is to bring into light important aspects related to J2EE, AJAX, Web Services and Java Certifications since I am working in these fields.

You can access TechTracer with the URL’s http://www.techtracer.com or http://techtracer.com

Hoping to have a nice jouney in the world of technology with all you who have been reading posts in this blog and supporting with your advices. Do leave your footprints out in TechTracer too.

🙂

Snapshot of TechTracer :

techtracer.jpg

SCDJWS – mission accomplished

The post has been moved here.

Edit: The author has moved to http://techtracer.com
All further posts will be published at the new location.

Microsoft Office Online and its weird strategy

I wanted to try out the Microsoft Office online as I think this is the first time Micorsoft is giving a try out facility for its office products online. Microsoft is so much succumbed to its propreitary theory that when you try out the office online demo in your Firefox browser, you are shown the message that, the demo can only be viewed only in Internet Explorer 6.0 or later version.

In order to use Microsoft Office Live, you will need to have Microsoft Internet Explorer 6 or later running on Microsoft Windows 2000, Windows XP, Windows Vista, or Microsoft Windows Server 2003. You can download the latest version of Internet Explorer from the Internet Explorer downloads page.

ms-error.jpg

Keen on seeing the demo I closed down Firefox and opened it in Internet Explorer and I was shocked to see what was in front of my eyes. Read the rest of this entry »

Method is better than Field

It’s always beneficial when you venture out in the open source community for designing some module or api which could be reused apart from yourself by the rest of the community to, learn some designing guidelines to make it a fully flexible, and backward compatible api. I always wanted to know how interface based design worked, the way Sun Microsystems implement their api’s and Netbeans.org provides some nice fundamentals for doing so.

It is better to use methods (usually getters and setters) to access fields than to expose them directly. The first reason is that a call to a method can do a lot of additional things, but in contrast an access to a field can only read or write the value. When using getters one can for example do lazy initialization, synchronize the access or compose the value using some computation algorithm. Setters on the other hand allow checks for correctness of assigned value or notification of listeners when the change happens.

read more | digg story

Posted in Java. 1 Comment »