Tuesday, May 24, 2011

Can elevators teach us how to write good code?

Most of you might have taken the lift from West Lake Station to Onvia office and I wanted co-relate the same to performance

We usually find us waiting for the lift to come down when going up and coming up when going down !! HOW STRANGE !!
Would not it be so simple to always make the lift 1 to always come down after delivering a passenger. Is that all that needs ?? Atleast to begin with the lift can always be made to go down for passenger entering into Seattle.

This applies for lift that takes up from Platform to Mezzaine [From bus level to intermediate] and another lift from Mezzaine to Platform. But there is one only one lift that takes passenger from Surface to Mezzaine and this is shared by both sides. How do we optimize it? Well in the mornings you always make sure the lift returns to Mezzaine because that’s where most of the people would use it and during the evenings make sure it always default to surface. Aren’t we helping the MOST passengers save time

But that’s like me thinking like a developer. Everything I develop is cool. From a test perspective, I would like to validate it and that’s were counters would come in. If I could track the no of times user presses the buttons to the actual time the lift were used, it would be easy for me to validate the claims. No wonder as testers we need to be so sure of the requirement and ask for appropriate counters

Finally is this like universal law and applied everywhere [Make lifts go to ground floor during morning and make lifts go to Top floors in evening] Not quite though. Take the Medical building in which Onvia resides in 5th floor. Making the lift always goto a desired level is a waste of energy because there are enough lifts. We hardly save any time so let’s try optimizing some-thing else..
[When there is enough memory or threads or resources for me don’t spend it in optimizing time rather try saving ENERGY - electricity]

Hope we get some correlation between Lifts and Performance in our applications.

Golden Rule - There is no golden rule to solve all problems. Be innovative and think through and capture as many counters as possible INITIALLY to keep building and improvising systems..