Friday, May 6, 2011

Web services are Self Service

In my college days ... There used to be a techno fest. It is completely organised by students starting form event planning, marketing and execution. All students were contributing in some way. With some friends I had planned to put a food stall in the college for event. The college campus was 20km away from city, and in the event normal canteen service is shutdown. So food stall is hot cash business in that situation. We wanted to make some money by creating some value.But we had no idea how to manage a restaurant for two days. We decided to buy foods from a restaurant from the city and we will serve the same food in our stall with some higher price.
And the idea worked we made some handsome profit. And the students also appreciated the food quality.....

Some time to provide some service to end user the service provider need to consume some other service. In this scenario a system need to use service/resource of another system. If it happens on web (www) then it is called web service. It is a standard way how two system can interact. Normally one system host some service the other consume. At the end of the day user get the complete service :)

Monday, March 21, 2011

Spring king of all season

Most of the developer worked in Java is aware of spring frame work. And who doesn't know anything about Spring framework can think about experienced spring season. Like many other frame works available Spring also serve as container. It creates the java object/component run time and manage them. The application developer can concentrate on business logic and really forget about managing objects. When people talk about Spring two terms dependency injection and inversion of controller always comes. Let me also write about these... When there is a situation a object use another object (association).
Lets have an example:
Class Orchestra                  
{
     Dancer  dancer = new Dancer();
     Singer   singer = new Singer();
     perform()
       {
           dancer.dance();
           singer.sing();
       }
}

Here Orchestra class use Dancer and Singer to perform the job.  Well tomorrow we need some modern dancing and some different kind of Song we have to change the Orchestra class.
In Spring way we can re write some thing like below.

Class Orchestra                   
{
     IDancer  dancer;
     ISinger   singer;
     perform()
       {
           dancer.dance();
       singer.sing();
       }
}

Interface IDancer
{
   dance();
}

Interface ISinger
{
   sing();
}

BreakDancer implements IDancer
{
  dance()
   {
     ----
     ----
   }
}
RockSinger implements ISinger
{
  sing()
   {
     ----
     ----
   }
}

In Runtime we can inject the dancer and Singer to Orchestra using Spring. Well here with singer and dancer we are injecting the dependency to Orchestra. And Orchestra gave the control which kind of dancer and singer is going to perform. This is something called inversion of control.  We can do both xml based or annotation based configuration in Spring. Here is the xml version
<bean id="orchestra" class="com.action.Orchestra">
     <property name="singer"><ref bean="rockSinger"/></property>
    <property name="dancer"><ref bean="breakDancer"/></property>
</bean>
<bean id="rockSinger">
    <property name="target">
            <bean class="com.action.RockSinger" />
        </property>
</bean>
<bean id="breakDancer">
    <property name="target">
            <bean class="com.action.BreakDancer" />
        </property>
</bean>         


So spring gives such a environment where  we have all the freedom to configure anything up to any level.
Have a nice time in Spring :)

Thursday, March 10, 2011

Don't Own.Rent and Use



Its always a trade off whether to own or take it on rent. Like some time its very difficult to buy a luxury house but you can take it for rent. Actually its not applicable to only house we can extend it to car, furniture even girl friend also :p The advantage of taking on rent is as we don't own it we only pay as we use. The trend is slowly moving towards pay for usage of software also. For example to write this blog i don't have to own a blogging site, I can use google service with all other users. Certainly I can customize it . I agree i cant customize it to the extend if i own it. But it is really economical. Well the idea can be roll into all possible s/w. Lets think a scenario when the SAP will host all its enterprise solution in its server and all the company will use through web. Well it has challenge like security, customization according to user ... But i feel the industry is mature enough and ready to take this challenges. Infact TCS is already started with iON for small scale and mid scale industry.It reduces the software cost dramatically and can be accessible to lots. People say it software as service, software on cloud....Its just renting software... So before all the big player enter to the game lets rent some thing :P