Sunday, August 13, 2006

A story

A little longer, but I think its funny.

Let me tell a story. A story about computer application class, their teacher, a campus recruiter and a testing tool :) .

Now Disclaimer “To suit the story I may mold some principals and it may resemble a little realistic, but it’s imaginary” (yeah, believe that and you’d believe vaccinations are bad for health).

Any way a campus recruiter distributed students of this class in different teams and gave all teams same problem to solve. Time 3 hours (as decided by all) and Teacher wrote this problem in bold on the board.

Give an implementation of a Fibonaaci series in Java”.

Team X googled fibonaaci and started working on the program.

Team Y also googled and then went back to teacher to verify the problem. These being favorite team of teacher (any guesses why??), he explained to them that problem is to give implementation of a fibonacci series and not The Fibonaaci series.

Team Z had no clue of the problem so, teacher patiently explained, A fibonaaci series is a series where the Nth term is sum of previous 2 term. The implementation is to provide 2 functions, first to give Nth terms given initial 2 terms and value of N. Second is to offer sum up to N terms.

Still, Team W had no clue(these will not be recruited) and teacher told them that they could write a loop from 0 to N, with 2 or 3 variables they could write a function that could do both, or better still functions could be written separately.

Still, some of team members were not happy with the clarity but that’s life.

90 minutes later

Now I’m reinitializing the team names because I with my limited creativity am running out of names.

Team “mere programmer” started working on a java class, they created a program that assumed only one parameter as input, assumed 1st 2 variables were 0,1 and created a function.

Team “process programmers” did the same thing, but they wanted to avoid review comments so, they made initial parameter constants.

Team “senior process programmers” had a lot of knowledge of GoF and J2EE patterns so, they started with 3 layers and started writing a data layer that read initial parameters from database and computed the sum.

Team “Geek” actually wrote 3 functions

getNextTerm(1st term,2nd term) ,

getNthTerm(N, 1st term,2nd term) called function above to get to nth term,

and calcSum(N,1st term,2nd term) and used functions above.

Then one portion of the team first created some unit tests for all 3 functions and started writing their java class.

Looking at geeks teacher asked everybody to write Unit tests.

Programmers wrote only one, it was good enough.

Process Programmer didn’t like it but wrote one.

Senior process programmer got resentful and said it should have been told earlier as now they require a running database to run unit tests and it could not be done.

Now the fun begins :)

Recruiter in the meanwhile understanding the credo of the institute for “automation” downloaded a testing tool of java. This tool was good, it generated random initial parameters but to test fibonaaci implementation it required the API provider to stick to an interface. Teacher and students cried loud that it should have been told earlier. Recruiter responded that although he expected teams to be agile but considering the situation (he is stuck with class as he could not go to another institute just like that), he offered 15 more minutes. Although by now teacher realized his own mistake of not realizing the need of interface earlier, admitted his mistake. He requested 45 more minutes in good faith and apologized for his mistake. Everybody haggled and teams got 30 minutes finally.

160 minutes later

Geeks changed their code, wrote an interface and Adapter (googled GoF) and were almost ready.

Everybody else was re-writing their program. But data layer, constants (these in itself are not bad, actually very good, but should be used when required, says Eric a.k.a. GoF) were still there. It may sound weird but senior programmers in order to implement interface were fixing their data layer to insert parameters in database. Mere programmers and others were doing what they did best, copying seniors. :)

Looking at this, Recruiter downloaded another version of tool that generated random parameters and dumped those in a database.

He told this to class :) and teacher. And it started chaos again. Teacher got dissatisfied with recruiter, recruiter (since he did it to help teams) thought teams were bad, and Geeks were thinking now how to incorporate this.

Everybody started haggling again and finally class got 30 more minutes to incorporate changes. Teacher and Recruiter were worried, the whole thing was going over budget. They had allocated the infrastructure for 4.5 hours only. Beyond this could mean stiff penalty for teacher. Students were to go to another campus after 5 hours (Mere programmers knew this and rejoiced at it). Recruiter didn’t want to lose good students and was worried.

210 minutes later

Geeks had written a controller, implementing the same interface (they googled GoF and figured out a factory and decorator) which picked up the parameters from database (copied that code from seniors) and called their original java class. Geek tested their controller manually.

Seniors dropped their insertion code and were testing their class.

Rest copied seniors.

215 minutes

Testing tool had a bug. Both versions had the same bug. Some time it did not generate all the parameters and sometime it generated value of parameters so large that it crashed the hardware.

Now recruiter was very worried, so was teacher. Seniors were angry at them, but actually happy with themselves as their program was throwing (no not Null Pointer), but IllegalArgument (process helps :)). Geeks looked at their code, wrote a parameter valuator, wrote unit tests for that and created logical default for every wrong parameter (e.g. Nmax = 1000) .Offered default values via a capability interface as well.

230 Minutes

Geeks could handle this. Seniors could as well but they were now beginning to think and appreciate geeks. Rest had no idea what was going on.

250 minutes

Everybody had their program but only Geeks were offered job .Now, I tell you a secret, recruiter was working for a freshly funded start up company that offered loads but needed the best (Some how I think every story should have a happy ending, don't know why).
Seniors got their offers based upon an interview in the next round, but not that great salary. Rests of students were recruited by big U.D.T and are going through fresher’s training.

The End

Replace teacher with your project manager/architect/leader, replace recruiter with your customer/partner and replace tool with the market and you'd know what I'm talking about.

Now the crib

I am perhaps somewhere in between process and senior group but boy I’d give my arm and a leg to become a geek. I’m worried about seniors though; these are sincere people and work most. They should not be angry and feel frustrated.

And what do you think about Team X, Y, Z, and W. Team X is risk, they might be genius but it may be a disaster as well. And Team Z and W! do everybody like them. Wow, I don’t.

Well, that’s it, I hope I clarified few things, but if I didn’t, remember vaccinations are vicious marketing campaigns of multinational giant pharma companies.

1 comment:

  1. Those who think, its not a real problem, I know a real story.
    For ensuring only one session per user on a servlet based application how many thing do you need?
    One design requires these many
    1. SessionCache
    2. CacheUpdater (it is an additional SessionBindingListner)
    3. Close Window javascript on every JSP if session is not valid
    4. A restriction that if session is not timedout, you can not re login.In case if by mistake u killed the browser,wait.
    The guy is a great J2EE guy.

    ReplyDelete