Tuesday, April 29, 2008

Hats Off to Indian Space Research Organization (ISRO)

After achievements after achievements, finally ISRO delivered cluster of 10 satellites by using PSLV rocket to break all previous records in a single mission. This is world record because earlier former Soviet Union used 8 satellites in a single launch.

The following is from Space.com

"An Indian rocket lifts off successfully with two domestic and eight foreign satellites from Satish Dhawan Space Centre in Sriharikota, India.
The Polar Satellite Launch Vehicle launched without its usual six strap-on boosters and carried its heaviest payload yet in this configuration — roughly 1,800 pounds (823 kilograms). The rocket had previously carried a maximum of four satellites into space within a single launch, according to Indian Space Research Organization (IRSO).
Once the rocket reached an altitude of almost 400 miles up (637 kilometers), it released its main payload of the Indian CARTOSAT-2A satellite into orbit. The Indian Mini Satellite (IMS-1) followed 45 seconds later. Lastly, the eight nano satellites built by Canada, Japan, Denmark, Germany, and the Netherlands separated in sequence"

Hats off to ISRO engineers and scientists to make this happen.

Saturday, April 26, 2008

Inversion Of Control and Dependecy Injection.

Inversion of Control (IoC) is important pattern when we use frameworks to develop web development. Mainly Spring framework using IoC pattern explicitly and core of Spring framework mainly built on IoC for application context, bean factory. 

IoC is simply pushing configuration, objects, and other required resource to a class rather than class pulling all information to run flow.  This is very simple definition of IoC. When I started Spring framework for projects almost 3 years ago, First I confused with IoC and Dependency Injection. So many articles and books try to add more confusion. Until I read the Java development with the Spring Framework by Rod Johnson, Juergen Hoeller, Alef Arendsen, Thomas Risberg, and Colin Samplaeanu

Dependency Injection is a flavor of IoC. Spring using dependency injection to achieve IoC. Lets see a example, how to improve a code by using IoC.

Here is a simple class to construct a car.
public class Car {
   public void buildCar() {
       CarBody cBody = new CarBody("SUV");
        Engine engine = new Engine("honda");
        this.constructCar(cBoby, engine);
   }
}

After execution of buildCar method, we have a car object with SUV body, honda engine. Ok. All are good and now we need to construct GM car. We need to directly touch buildCar method to recreate it. Since car is a generic object, it is prone to constant changes. It is pain to change time buildCar method to create different cars. If you are asked to improve the above code, instantly we change buildCar method signature to parameterize body, engine, tire like

buildCar(CarBody body, Engine engine);

Thats starting of IoC pattern. The parameterize version of buildCar would solve almost all issues programmatically. But we can't customize a container or framework to call this parameterize buildCar method. We want to do one more level of externalizing. 

Dependency Injection can be done based on constructor, setter methods and interface. But most of developers preferred to use setter methods. So we are going to add all setter methods for engine, body and tire.

public void setBody(String body)
public void setEngine(String engine)

Now our Car class exposed it's important components to others including a container mainly we can call this setters from a configuration files. Thats exactly the goal of IoC.

Wednesday, April 23, 2008

2008 - Not good so far. But how to beat it?

Since this year started we are not hearing any good news. All are bad and negative news from around the world. All are temporary and will be good after some time.

1. US housing market meltdown
2. Banking loan system break down in US and around world.
3. Rising Oil price and subsequent rise of all essential commodity price.
4. Food crisis and warning about "silent Tsunami". 

So how to stay positive in this all negative environment?

1. Stay away from TV channels such as CNN, CNBC, MSNBC, FOX. Media always hype everything, specially this news channels are worst. Just watch good sitcoms like According to Jim, Two and half man, Talk shows etc.

2. Watch as much as sports events, NBA playoff, Baseball, NHL etc. at least there is one winner from sports events.

3. Plan for weekend trips in weekdays, there are lot of sites to search good places to visit in weekends, so that we don't browse any news sites.

4. Teach some new activities to your kids. So you can learn something and spend more time with your kid like cycling, boating, fishing, horse riding.

5. Don't talk with any friends or relatives who sounds always negative. They try to pass their negative feeling to you. Just delete their mobile and email address from your contact list.

6. Daily visit my blog and read my posts :)


Sunday, April 20, 2008

Back to work.

After 2 weeks of vacation to India, returned to Chicago yesterday. Time in India was great and quality one for me and my family. My 4 year and 5 month old enjoyed to the fullest with their grand parents. But the flip side is, my 4 year lost little discipline, due to over affection from grand parents and relatives. The truth is we all are lost our daily strict routine and lost our discipline, which is why we need vacation. The lost of daily routine and little discipline is most wanted for all humans at least once in a year. This vacation was good since it was full of functions, first my brother in law's marriage and then my son's birthday. We met all our relatives and friends on one go. I can see lot of improvements in india's quality of life, earlier we didn't have any issues with car parking in marriages halls, in fact we can see only 2-3 cars, now there were lot of space issues with car parking. Everybody now has car and everywhere we are facing car parking issues including in marriage halls. Every aspect of quality life improving slowly and steadily.

Saturday, April 05, 2008

Back to Home.

Here I'm in India after 28 hours of hectic and long travel from Chicago. Where ever you are, what job you do, how long you away from home, back to home is always a wonderful experience and I can't describe the feeling, all I felt is something that mind state changes from "turbulence" to "smooth". This time my hometown we are experiencing some sweet pain that we are getting lot of lot rain, which is unusual in this summer months. But it is good for me and my kids, as we are enjoying in rain and more greenish Nagercoil.

First time in my recent visits since 2004, I'm seeing some negative changes in India, which is not good. There is some loss of capitalist version of India, Reliance Petrol(Gas) station closed its stores all across India since it couldn't afford to competition with state run petrol stations. This time we are missing flashy and attractive gas stations on road. In and around my home town and South Kerala, a lot of infrastructure development works are on hold or no improvement at all. People are crazy about food and other essential items price. As per government report inflation rate now holds all time high of 7%. But there should be always a peeks and valleys in all aspects of progressive developments.

Apart of this, People doesn't change at all, same affection, same kindness, same politeness all are same as before.

Tuesday, April 01, 2008

Unified Modeling Language - Sequence Diagrams

After use case and class diagrams, sequence diagrams are important element to any design document. One issue with sequence diagram is, we can spend 12 hours to draw a diagram or 5 mins to do the same. But it all depends on each team's decision that how much time they want to spend on sequence diagrams. Sequence diagram comes handy when the system/product goes to maintenance mode or when ever new team takes over the system/product from current team.

The simple definition of sequence diagram is, explore the logic of complex function and how many objects required and how they interacts with each other to satisfy an use case. Not all use case required a sequence diagram, we can identify complex or most critical ones to be the candidate for sequence diagram.

Lets take a simple use case "add a product in shopping cart".
1. User enter user name and password in login screen.
2. System validates user and let user in the main page.
3. User select a product from product menu.
4. System adds the product into user's shopping cart.
5. User clicks checkout link.
6. System displays checkout page.

Based on above simple use case, we can draw a simple sequence like this

User -> Login - > main page -> Product catalog -> check out

Now we need to convert this simple sequence into objects

aLogin -> aProductCatalog -> aCheckOut -> aBusinessService

After second iteration, we identified that we need a business service to get products from a data base. After second iteration we have to put some more stress on aBusinessService, how it is going to get data, which pattern we are going to use to get data, how we are going to transfer the data etc.

aLogin - > aProductCatalog -> aCheckOut -> aLookUp -> aProductDTO -> aProductDAO

Ok. Now we have some decent sequence, lookup service going to get DAO reference and return to aProductCatalog and aProductCatalog executes getProducts method on aProductDAO, in return aProductDTO as value object. We have a good explained sequence here at high level.

DAO = Data Access Objects
DTO = Data transfer Objects

So we are moving towards Sun's J2EE design pattern here, hence it is good add a business delegate in front of aLookUp. Like wise, we can improve our design and apply design pattern after each iteration until we satisfy our design.

Here is excellent UML and applying design patterns book by Craig Larmen