Cloud Computing !!! Cloud Computing !!! Cloud Computing!!!! - Its Cloud everywhere. So, whats that? Something like grid computing? Is it providing Hardware as a Service along with SaaS ?
Some interesting short videos which explains this, really interesting:
Thursday, November 20, 2008
It's cloudy everywhere
Friday, November 14, 2008
To be Java programmer is unfair??
"Employement agencies only need Java programmers" - Is it unfair?
Got the reference from a tweet of Sun, a choir from Finland:
Thursday, November 06, 2008
Obama Mania
TV, FM, News Paper, Net... it's OBAMA everywhere.
Conversation in a FM program here in Bangalore this morning:
FM : Who is the president of America?
Caller : Obama
(May not be a write answer as of now)
FM : Who is the president of India?
Caller : ????....gr####@@@@...
Wednesday, November 05, 2008
Atlast... it's announced
This not about the victory of Barack Hussein Obama... its about the announcement of the highest civilian award in one of the largest democracies of the world.
Bharat Ratna, the highest honor awarded for an Indian, has been trivialized with politicians, demanding the honor to be awarded to the party leaders, was last announced in 2001. In a nation where there were leaders who said NO to top awards for great genuine reasons, Bharath Ratna was not announced for the past 6 years just because of fierce politicking. Lots of names were on row: Atal Bihari Vajpayee, Jyoti Basu, Biju Patnaik, Kanshi Ram, Karpoori Thakur, Chaudhary Charan Singh, Jagjivan Ram, Jyotiba Phule ... a lot more.
Atlast on 4th of November 2008, they announced a non-politician: "The Hindustani classical music legend Pandit Bhimsen Joshi is chosen for the Bharat Rathna award".
Wednesday, October 29, 2008
Design Patterns - Command Pattern
As said in the last post, here I'm starting with my first post on Design Pattern implementation in Java.
A Small Intro On Core Design Patterns:
Many define Pattern with different statements. The most common one: pattern is a solution for common and reoccurring design issue.
The term Pattern was coined by Christopher Alexander in his book, "A Pattern Language: Towns, Buildings, and Construction".
GoF classified patterns based on Purpose and Scope.
Purpose criteria classifies patterns based on what the pattern does:
1)Creational patterns - dealts with object Creation
2)Structural patterns - composition of class and objects,
3)Behavioral patterns - responsibility of class and objects.
Scope classifies based on where it applies to : class or object.
Let me start my series on Design patterns with one of the object behavioral patterns: Command.
Command Pattern:
Command pattern, also called as Action or Transaction pattern deals with decoupling between the invoker and the receiver.
Necessity of Command Pattern occurs when it is needed to invoke a method without knowledge about the method or the object, which holds it. Here, the operation/action to be performed is encapsulated into an object.Command pattern is used to:
1) Decouple the object with invokes the operation from the object which performs the operation
2) Combine multiple command in to a Composite command (Macro Command)
Components of Command Pattern:
The key of command pattern is Command interface (or Abstract Class), which declares the abstract operations. The concrete command class provides implementation details for the operation declared in the Command interface.
UML diagram of Command Pattern:
Example:
A small description of each of the above elements with implementation details:
. Client: Responsible for creating the Command object and setting the receiver to it.
import pattern.command.*;
public class CommandClient {
public static void main(String[] args) {
Receiver receiver = new Receiver();
Command incCommand = new IncrementCommand(receiver);
Command decCommand = new DecrementCommand(receiver);
Invoker invoker = new Invoker();
invoker.setIncCommand(incCommand);
invoker.setDeccCommand(decCommand);
invoker.add();
invoker.add();
invoker.remove();
invoker.add();
invoker.undoAll();
System.out.println(receiver.getValue());
}
}
. Invoker: Invokes the execute method of the Command. For implementing undo action, this class keeps track of commands called and performs the undo operation accordingly.
package pattern.command;
import java.util.Stack;
public class Invoker {
Stack commands;
Command incCommand;
Command decCommand;
public Invoker(){
commands = new Stack();
}
public void setIncCommand(Command cmd){
this.incCommand = cmd;
}
public void setDeccCommand(Command cmd){
this.decCommand = cmd;
}
public void undo(){
if(!commands.empty()){
Command cmd = (Command)commands.pop();
cmd.undo();
}
}
public void add(){
incCommand.execute();
commands.add(incCommand);
}
public void remove(){
decCommand.execute();
commands.add(decCommand);
}
public void undoAll(){
Command cmd = null;
while(!commands.empty()){
cmd = (Command)commands.pop();
cmd.undo();
}
}
}
. Receiver: Class, which preforms the actual functionality.
package pattern.command;
public class Receiver {
private int value = 0;
public int getValue(){
return this.value;
}
public void increment(){
value++;
}
public void decrement(){
value--;
}
}
. Command: Represents the operation. Implements the execute method which invokes the corresponding operation in the receiver. Defines the binding between the Receiver and action.
package pattern.command;
public interface Command {
public void execute();
public void undo();
}
package pattern.command;
public class IncrementCommand implements Command {
private Receiver receiver;
public IncrementCommand(Receiver receiver){
this.receiver = receiver;
}
public void execute() {
receiver.increment();
}
public void undo() {
receiver.decrement();
}
}
package pattern.command;
public class DecrementCommand implements Command {
private Receiver receiver;
public DecrementCommand(Receiver receiver){
this.receiver = receiver;
}
public void execute() {
receiver.decrement();
}
public void undo() {
receiver.increment();
}
}
In Real-time:
The most common example of command pattern implementation is in Swing and Struts.
Command pattern in Swing: When a JButton in the application's window is clicked it invokes the corresponding method in the application code.
Here JButton, a component of Swing has its implementation with in Swings and its not aware of the application's implementation. But the method in the application specific code is called when it is clicked. This method invocation from framework's code to the application code uses command pattern.
Command pattern in Struts: Command pattern is used in the invocation of 'execute/perform' method of specific Action class by struts framework on a request submission from JSP.
During initial stages of development using JSP - Servlets, before the days the frameworks like struts, the Action Servlet / Controller Servlet will have a huge if block to identify each request and then perform the corresponding functionality/method.
Struts replace those if-blocks with command pattern. Struts uses command pattern for evaluation and execution of a method (execute/perform) in the receiver class (Action class).
Blogging on Technology
I thought of having my technical thoughts out of this and so created one for that long back. Tried to have it as a team blog and it didn't worked out. So back again here for my technical thoughts too.
Being in to yet another software servicing company in India, no need to say part of my work is in to AMS and some times in to ADM. As far I've witnessed so far in this AMS/ADM industry, people's curiosity to learn upcoming technology (especially in the open source area) dies day by day until and unless it is needed in their day-to-day work. That triggered me the thought of writing few things about what I know or which I learn or wish to learn.
A snap shot of my to-blog list:
1) Core design patterns implementation in Java
2) RMI and CORBA
3) Add-ONs used in basic Java application
4) Series on Hibernate
5) Series on JSF
It may be a long list when stepping into the insights of each, but I hope I can do a gud job in writing some useful stuff on each.
Sunday, October 19, 2008
Sachin & Sensex
Sachin and Sensex used to hit records together. Latest of Sachin: Highest scorer in test cricket and the latest in the Bombay Stock Exchange, sensex plunged below10K, both happened on the same day.Similarly when Sachin crossed 15K mark in his ODI career, Sensex too crossed 15K. On that day, TOI published the milestones in the front page: Most of time, its like when Sachin did well Sensex flattered, when Sachin slumped Sensex rocked.Hope this time, Sensex will catchup with Sachin soon!!