Friday, May 20, 2011

Software Estimation

Being worn-out with just project estimation and re-estimation alone for the past few months, why not write some thing about software estimation though its not a small topic for me write few lines and finish off. So, here goes a very small snap-shot...

As like the saying, 'Don't fail to plan unless you plan to fail', a crystal clear planning is the basic necessity for successful execution of a project and estimation forms of the one important basics of the plan.

By Software estimation what we estimate on:
        1) Effort: Estimation of amount of work to be done. Eg: Number of Function Points involved or LOC to be developed.
        2) Time & Cost: Time needed to get the work done. Usually expressed in work-months/man-months/Person-weeks.
        3) Resource: Involves estimation of hardware (Well we can't develop a cloud management system with just 2 Desktop terminals!), software (Need to pay for MS products!), human resource (most important part: rightly skilled human resource availability), network infrastructure etc...

So, how are these estimations done and what are considered while estimating?
Input or factors to be considered:
        1) Historical data (Experience matters!!!)- Historical data from prior project on similar domain/technology/
        2) Complexity - Effort needed for developing a inventory management system and space shuttle monitoring system are not same. Complexity of the requirement matters!
        3) Resource Skill level - A very important factor, which leads to include training cost. In some cases, this is a deciding factor for project implementation platform too!
        4) Prior experience on similar projects - Lessons learned always helps in future!
        5) Tools - Usage of which can ease the job to fasten the implementation/test phases. There is difference in writing code in Eclipse and EditPlus.
        6) Process - Agile/XP/Waterfall too matters. (2hrs/day on Stand-up meetings will have impact on T&C!)
        7) Development platform - They say, its faster and easier to develop using Java/JEE.
        8) Of course Software requirement :) (We are not arrows with out target! But includes both FR and NFR)

So, how these estimated are done? There are lots and lots of estimations techniques: COCOMO, parametric model - Cost Driver based estimation, SDM, SLIM etc...

After doing all, should we rely on what was estimated during project initiation till project closure? A very important thing, estimate must be revised over the phases of the project at different stages. Requirement takes different image over the course of execution and as usual unexpected surprised welcomes every new day. Beyond everything, T&C requirements should be kept on track. Cost-over run project gets scrapped too! These mandates the revision of estimates at due intervals.

Reminds me of my S/W Engg Prof. iterating, "None of the Software projects completes on estimated cost and time".
After all, those are just estimates and not actuals! We need something under the term called, "Variance" too!

Wednesday, May 18, 2011

Back!

Can't stop again! Renewing my blogging habit after a long time, its been a long interval this time.
Can't imagine how I missed blogging while there were a lots happening around... Oracle Acquisition of SUN, Booming of Social Networks, UPA's second term, Introduction of CSAT, SCAM filled CWG.... in the personal front: moving back to Chennai, its unbearable climate ... a lot more.
But now, I pledge to continue non-stop over the hurdles.

Thursday, November 20, 2008

It's cloudy everywhere

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:










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:




But few more to muse about, "Women are still paid less than men", "Jobs go to China".

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());
}

}

CommandClient.java

. 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();
}
}
}

Invoker.java

. 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--;
}
}

Receiver.java

. 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();
}

Command.java


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();
}

}

IncrementCommand.java


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();
}

}

DecrementCommand.java

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).