Archive

Archive for March, 2008

Factory Pattern

March 31, 2008 Leave a comment

Simplest way to explain this –
http://www.javaworld.com/javaworld/javaqa/2001-05/02-qa-0511-factory.html?page=1

Anyway,

Every program needs a way to report errors. Consider the following interface:

public interface Trace {
// turn on and off debugging
public void setDebug( boolean debug );
// write out a debug message
public void debug( String message );
// write out an error message
public void error( String message );
}

You have two implementations –

Class FileTrace implements Trace{
}

Class SystemTrace implements Trace{
}

To use any of these classes, you need to instatiate these where ever you need them.

//... some code ...
SystemTrace log = new SystemTrace();
//... code ...
log.debug( "entering loog" );
// ... etc ..



Now if you want to change the trace mechanism in your code. You need to change it everywhere. Instead, we use sthg called as TraceFactory.

We say

Class Tracefactory {
public static Trace getTrace(){
return new SystemTrace();
}
}

And we say in the code :

new Tracefactory().getTrace();

We can thus change the Tracefactory, if we need to change the default tracing!
Categories: Tech stuff

Static methods in java

March 27, 2008 Leave a comment

Overriding does not work for static if you upcast the instance! With a static you’ll get the behavior of whatever class you upcast to. Thus you cannot have polymorphic behavior.

Categories: Tech stuff

California smiling

March 25, 2008 Leave a comment

Well, its been a long time. Its been that kind of a situation. I have moved to california from new jersey. Its all been real busy time.

Well, where do we start from. I get a call on friday ..the 14th march. I was supposed to report to CA on monday. That was no way possible. I took just 2 days off, but then I was on bench already for quite some time and cudnt have stayed longer. I was interviewed few days back thou, and nothing was informed to me. I guess they didnt find anyone OR maybe didnt find anyone better. Whatever the case, I was in. I actually didnt want to move to the west, I wanted to stay as close as possible to east. But then, I realised there was no point. Things wouldnt have worked out 😦 .. Its a sad truth or maybe I am thinkin too much.

well, now to th fun part. These things had to be blogged. I call up my landlord on sunday and guess what..he is in china. and he says he can come down only on the weekend. I am thinkin …great! Few more days of fun. and so I relax.

I go out to watch a movie with one of my mates. Dr.Horton hears a who. Absolutely cool movie. Felt for my mate, he was feelin down. He was feeling pretty homesick. I would be surprised if he stays longer in the states. Well, me and him dont know what we want. Or maybe we know what we want in life, and we just dont have the courage to go get it.

After moving here, I dont want to stay here too, I just dont want to. I just want to go back home. Its like you know … I miss NJ and its too lonely out here. Can you believe it? All my frnds are here and I feel lonely…and I knew noone there..and I had fun. The time of my life.

Well, I call up my boss on monday afternoon saying…I cant come. And he is like FU, pack and start. Then I panic. I pack until 6am in the morning. Sleep for 2 hrs.. Finish as much as I can. I call the cab at 3:15. By the time, I start ..I forget my tickets..The cab driver is more interested in telling me the greatness of indian and american cultures than dropping me for the 5’oclock flight. Well, anyway we make it. My flight was from NJ – Chicago – San Jose. The first flight is delayed..so I end up in denver and then to San jose. By the way, I had to go thru an extra securtiy check..since the great myself..put shampoo in the bag.

Well, After I land here…guess what ..I didnt book a hotel. I guess I needed to stay at my cousins place. I am extremely shy by nature and I hadnt seen her in 8 yrs. It was tough for me to stay here. Nithya was terrific. Pretty cool kid. Anyway, first day. I wake up 6:30 ..do my stuff…Vijay drops me at the nearest rental…I dont take the rental…and wait for my frnd. He comes and sugegsts that I bunk office today and look for apt. I take the stupid suggestion and do it. My boss bangs me again and FU etc etc… I go at 1200
meet people etc….. APPLE mate. its APPLE.

mac kinda sucked. Hope I get to love it more. Second day – I plan to take rental. Gueess what!! My credit card is out of limit :(. My frnd refuses to help. I get another one in time to help me out
But its too late anyway. I am late again. 😦 Dont like mac still.

Day three – We have to pay rent and take the apt. 1700$ . pure crap. but no choice. Late again! This time I get warning…well, it was coming. I hated it

Weekend was all shopping and stuff.

I try not to think of NJ. Its tough. Theres history there. I hate this feeling. I just hate it. I just love the place,…maybe not the place.

Categories: Uncategorized

Jersey gardens

Me hear lot abt jersey gardens, me thought lets visit, me discover it is waste of time and energy. There was no difference at all.

Categories: Uncategorized

Long time no see

Well, things have been pretty hectic the last week. Hence Couldnt post any thng. Well, my project at verizon is over. I wont be missing the project as such. Nor the office. Just will be missing few ppl 😦 . I hate this feeling. And I wish more now , I wish I was very rich. Things fall in place so easily 😦

Well, Now is the time for a new project.

Categories: Uncategorized