Thursday, September 25, 2008

My second interview with I

So I went for my second interview with I
And this time -dressed up :)

It was a good conversation
I think I did well.
It was weird hearing myself speak at times.
The first meeting was with V- An architect of sorts
I think I was able to carry the conversation well
He has some interesting questions- which i think I answered well.

Meeting with A and D also went fine

Lets see... what happens next
All this economy meltdown has me worried...but then should I worry ?

I already have my 'insurance policy' :)

Technology Tracker

So these are the technologies I need to catch up on

GWT
Php
Webservice
AJAX
Grails
Groovy
Flex
Ruby
RoR
Apache
Tomcat
mySQL
Linux
JUnit
Cactus

Saturday, September 20, 2008

What is Factory Design Pattern

Factory design pattern is a creational pattern- which gives you more control on how you create objects.

The main objective is to encapsulate object creation.





Factory pattern basically comes in three flavours

A) Simple factory

There are three entities. Client- who needs to create objects. Factory- who does the actual creation. Product- the objects that are finally created.

The client has a reference to a the Factory (or this method createObject may be static as well)

The client then asks the factory to create the object it wants



B) Factory Method

It has two sets of classes- Creators and Products.These are implemented as parallel hierarchies

So we have Product A, B, C - (all implementing the same interface Product I)

And in parallel- we will have multiple creators- Creator A,B,C extending Creator Abs.

The Creator Abs defines how Product will be created

Creator A , B and C have specific knowledge about how their counterpart Products will be created

No one except Creator A should know about Product A



An abstract creationMethod is provided in the Abstract Creator

This will be implemented by the Creators A ,B,C



C) Abstract Factory Pattern

This is used to create a family of related objects rather than a single object.

We start with an abstract interface which defines the suite of objects to be created

like createValidator, createPreProcesor, createPostPorocssor.

We will then create a Factory which implements all these methods

The objects that this class will create will all be related or dependent

We can accordingly have another Factory which also implements the same interface- but this one creates another set of objects - also related to each other though



The second thing we need to do is define the family of objects

e.g. you have a POValidator and a DO Validator

POPreprocessor and a DOPreprocessor

PO Validator and DO validator belong to the same family and POPreProcessor and DOPreProcessor belong to another family

Whats the difference between Hashmap and Hashtable

Hastable is always synchronized.
Hashmap is by default - not synchronized- though it can be constructed as such

Hashtable doesn't allow null values. Hashmap does allow null values(Neither allows null keys)

These headhunters...

Oh boy
Some of these are worse than car salesmen
Specially this lady -SG.

Every time I bring up the name of a company I am talking to - without her help
All she has to say is- Oh that company sucks

Well, S:
I am not as naive as I seem to be
I appreciate that you have a living to make and in a way is related to how and where I make the selection. But puh-lease - don't be so naive yourself to think that I would be so naive to shut down my grey cells and look for your advice at all

Meeting K was quite refreshing.
She was awesome !!!
Helpful. Genuine. She earned my respect for her- in the first call.

How do you write threead safe programs

Thread safe program is one which will work well in an environment where there are multiple threads working in tandem.

Look out for global variables. These can be easily in the centre of a conflict between multiple threads
Its a common practise to declare static constants. Such constants should be declared as final whenever possible.
This will gaurantee that these do not get changed
If you have an intention of changingthese- then they shouldnt have been Static Variables probably

Thread safe program is achieved by taking care of the following
1) Write re-entrant code
This involves using variables created on stack (private variables) rather than variables created on heap (global)

2) Mutual Exclusion
Access to shared data is serialized- typically by using programming constructs like synchronized in Java.

3) Atomic operation
Using machine language instructions

4)Thread local storage
Not sure if Java provides this.

Saturday, September 13, 2008

What is a Singleton Pattern

Singleton pattern is used to ensure there is one and only one instance of a class.

There are three parts to it

A. Ensure that we cant have more than one instance of the class
This is done by marking the constructor as private or protected
B. Provide a mechanism to access the singleton object. This is typically done by providing a static method to access the object. Something like getInstance ()method
C. Creation of the object.
This is by far the most tricky part.There are many ways to do so
1) Create the object using the static initializer or Construct the object at the time of declaration
This uses the classloader to create the object. You can run into issues in a J2EE environment where there can be multiple classloader
2) Use an inner static class. The singleton object is held in a static inner class. This will ensure that the object is not created until its really needed
3) Use double-checking mechanism. This means that we create the object in the getInsatnce() method- we check for NULL before creating the object. And the call to the creation of the object is enclosed withing synchronized block

The hunting season is open

Two Phone interviews
One Personal lined up
Another phone interview scheduled

Hmmmm
So this is how it is...

Appearing for an interview after a gap of 6 years was a bit un-nerving
The first one with TA could have gone much better if that had not been my first interview

Anyways- it is what it is

Second one went much better and I am now scheduled for a personal interview next week

I am not sure if I am going to take the offer if it ever comes- but at this point -= I want as much exposure to interviews as possible so i can smoothen up my rough edges

Sunday, August 31, 2008

Hi I am looking for an open positon. You got any for me ?

So - here it goes...
I have taken the plunge

Sent my resume across to handful of people and will be sending to more this weekend

Met a recruiter in person as well
I think I am going to decline further requests for such meetings in person- they consume way too much time- Lets see...

Sigh I have already started fantasizing how I will break the news to my Manager
oh boy. I know this is kiddish- but somehow propels me

Hibernate - a way of life

So I started reading this book- Hibernate in Action.
One of the things that hit me was- that Hibernate is not a persistence API alone
Its a way of life...
If you are simply planning to plug out your JDBC API and plug in instead Hibernate- you will not be able to get the full force out of it

( Of course in any re-factoring project- compromises are made to see what can be done and achieved within the boundaries of other constraints.)

What you really need to do is- move away from thinking in terms of tuples and data sets- and instead think more in terms of objects...

Given the fact most of the enterprise applications are coded in Object oriented languages- it shouldn't difficult

But the fact is that most designs are strongly dominated by the Database layer and user interface
These two ends are start- all and end-all for most workflows
It takes great effort and discipline to make sure that these concerns don't leak...

Anyway- its a nice book and am on to the fourth chapter tomorrow
Yay !!!

Wednesday, June 25, 2008

Putting the head where the patterns are...

So I needed to design an enhancement to the project I work on
I gleefully rubbed my hands and smirked- Now is the time when I put in all the patterns I learnt in the last 10 days or so- going through the Head First book

I decided to use Abstract Factory Pattern- keeping in mind the OOP principles I learnt
This pattern was a good fit.

Had I not read this book- I would have implemented this is a very different way
Its almost difficult to imagine how would I have done it....

But - it was not a easy exercise
Patterns are like guides
They show you the way- but then they offer you multiple paths
You get to choose what path to pick and how well you use it.

All said and done- I am pretty pleased with myself how it unfolded

Sunday, June 22, 2008

InfoQ and eBay

yesterday I saw Randy Shoup's interview on InfoQ (http://www.infoq.com/presentations/shoup-ebay-architectural-principles)

Very intresting...
And I couldn't help compare our architeture with their's

And I started wondering could we incorporate some of their principals into our design?
We already have some- we too acknowledge the power of asynchronous processing
Though I feel we have not gone as far as we should\could have...

Our objects are too tightly coupled.

Another thing I liked what Randy said was about shorter transactions

I think there is great wisdom in that principle- it gives you lots of flexibility on how you can handle situations, faster performance,quicker response to all objects,fewer wait time all over

InfoQ seems to be a nice hangout- I intend to visit that place more often

Design Patterns: Proxy

So today I learnt the Proxy pattern
Proxy pattern is like a personal assistant of a Hollywood star.

Provides access.
Serves as a body guard
Acts likes a star- you think you are talking to the star while you are of course not

Just couple of more chapters to go before I can put this book down (Head First- Design Patterns)

I already have an idea- which book I want to read next...

Saturday, June 21, 2008

Confession

I wish I had read this book- Head First Design Patterns before
In fact I now wonder how many books I should have already read before

I think I would have done a much better job at my current project if I had read about these patterns and whatever else I have missed...

Anyway...I will see what I can fix now
I plan to redesign few objects- hopefully that will help.

Design patterns:Iterator and Composite

Today learnt about the Iterator and Composite design patterns
Though I admit composite didn't register as much a Iterator did

Tomorrow I will read about the Proxy pattern

It seems its at least another week before I finish this book- Head First: Design Patterns .

New boss

So I have a new Boss
Well- he seems nice- (but don't they all seem nice in the beginning?)

well he is definitely much better than the character I had before

Anyways lets see- how this unfolds...

Thursday, June 19, 2008

Design Patterns:Template

So today I learnt the Template Design Pattern

Pretty neat pattern- or maybe its the guys at Head First who know how to get it into your head

So you have a bunch of algorithm to implement
Form a template method which outlines the generic algorithm
Put the common code in concrete methods in the abstract class- all variable code becomes abstract method- which are then overriden by the subclasses

and there you have a Template Design Pattern !!!

Learn something new everyday

When I started preparing for my future interviews - I realized how distant I had become from the idea of updating myself

So here is my pledge...

Learn something new everyday
And to serve as a reminder to myself - I will post here what I learnt everyday...

Job

So I decided to change ny job.

And now comes the hard part- preparing for the change

Its almost six years since I have been working here-and I am more than due for a change

Resume is almost done...

Started taking a peek at job sites...

Started reading...

This should be fun !!!