Sunday, June 05, 2005 

Object Oriented Design !!! ..Is it me ?

Well tommorow I am supposed to give a lecture on OOD's Open and Close Principle...Sounds very wierd for the ppl and for me too ...of all things on earth i m lecturing on Programming ...Yes this is a fact and y this and y me have a simple answer .....Boss this is life you almost any thing can happen to you ...So this is it ....So what is the Open Closed Principle : Simply its having an abstraction for every class u derive so as u dont have to change the existing code of urs ..thats is working fine ....just put an abstraction layer for the extension of the code and keep on providing the functionlaties accordingly without changing the existing code ......So clearly defined the Open Close pRinciple says:
"Software entities like classes, modules and functions should be open for extension but closed for modifications."
Just take for the sake of example I am writting a program for a function that draws a particualr shape say triangle the code is working fine ....now when i try to provide a additional functionality of drawing a circle ... i will provide a switch case for circle ...and accordingly for every shape i add .....thereby making my code vulnerable ... mistakes and regression creeps in .......How to avoid this ...the answer lies in open close principle of designing......Make an Abstrack class shape having a draw function ......and then derive every shape from the base class .....isnt it simple ......isnt it the code is open for exptension and closed for modification ...........One of the very good para i read about object oriented concepts is smth like this .....
" Many of the concepts used in Object Oriented programming, are actually metaphors. We get so used to the metaphors that we forget they are metaphors. You are used to talking about a window on your program, but of course there is no such thing; there is just a rectangle with text and images in it. It looks like a window into your document so we call it a window. Of course, you don't actually have a document either, just bits in memory. No folders, no buttons — these are all just metaphors.
There are many levels to these metaphors. When you see a window on the screen, the window itself is just a metaphor enhanced by an image drawn on your screen. That image is created by lighting tiny dots on the screen, called pixels. These pixels are lit in response to instructions written in your program. Each instruction is really a metaphor; the actual instructions read by your computer are in Assembly language, low-level instructions that are fed to the underlying computer chip. These Assembly instructions map to a series of 1s and 0s that the chip understands. Of course, the 1s and 0s are just metaphors for electricity in wires. When two wires meet, we measure the amount of electricity, and if there is a threshold amount we call it 1, otherwise 0. You get the idea.Good metaphors can be very powerful. The art of object-oriented programming is really the art of conceiving of good metaphors. "
..............aptly said indeed ! What more i can say :)

Thursday, June 02, 2005 

Its a matter of Choice

Sometimes when I get up from a deep slumber and watch out from the bolcony of my flat .....there is a vast open field with dwellings all around it and concrete pillars aspiring at the heart of it to reach the sky ......Sitting over that place for some time I realise the variety of things on this earth .....Isnt it all about observing and how deep we observe ....how much we feel about people around us forget about the people we dont know but for thoes with whom we actually live with ...the people we know the people for whom we care ....Over the period of time i find many people becoming indiffrent about their fellows .....that tooo with a grace .....is it not the reflection of the society we are in or is it just the person who changes for the reason know only to him then why does a person helping someone is taken for granted by this scoiety ...Well i am not the one to answer this what all i can do is just to think on that and feel sad about :) ........Yes one of the great saying to quote with and an end to everything that troubles once brain is to think ......That in life one should always race with oneself . In the relatively false world of absolutism whatever we think, say or act on is relative ....the relativity is a great concept in itself ...but it creates lot of pains for lot many people ...therefore the indian culture i think never encouraged competetion instead glorified the laid back and compalcent attitutde of the people feeling content in whatever you have is what fed to all of us in our great books of wisdom ....though i have not read all of them but still this is what is around .Though what i said right now bout the Indian ideology I really cant reject the element of peace and internal happiness which one get by toeing on the lines of Ancient Indian Systems ...So is it just a tradeoff between material and spritual growth ..as said by the The Architect (with some changes )-this brings us at last to the moment of truth, wherein the fundamental flaw is ultimately expressed, and the anomaly revealed as both beginning, and end. There are two doors. The door to your right leads to the source, and the salvation of human self . The door to the left leads back to the matrix, to her, and to the end of every of ours materail need . As adequately put, the problem is choice. But we already know what you’re going to do, don’t we? No matter how much i crib ......but the fact remains At the other end of the spectrum are the opponents of every view being appalled by what they feel to be the bleakness of others thoughts . .... they feel diminished by that knowledge of other belives ....I would not try to answer any of these critics with a pep talk about the beauties of human belief. Their worldview is chilling and impersonal in the localized domains of their own ideologies . It has to be accepted as it is, not because we like it, but because that is the way the world works.
Towrds the end .....Its always the matter of choice ....well said by Frost :

Two roads diverged in a yellow wood,
And sorry I could not travel both,
And be one traveller, long I stood,
And looked down one as far as I could,
To where it bent in the undergrowth,
Then took the other, as just as fair,
And having perhaps the better claim,
Because it was grassy and wanted wear,
Though as for that, the passing there,
Had worn them really about the same,
And both that morning equally lay,
In leaves no step had trodden black,
Oh, I kept the first for another day!
Yet knowing how way leads on to way,
I doubted if I should ever come back.
I shall be telling this with a sigh,
Somewhere ages and ages hence:
Two roads diverged in a wood,and I-
I took the one less travelled by,
And that has made all the difference.

Wednesday, June 01, 2005 

The Sinhagad Xperience !

I think I have been doing lot of poetry or say rhyming with words .All in all they were just the reflection of what we do in our daily life ....each thought of us has to be a reflection of the past.....As once said if we want to go to future we should run from the past that's what one has to do run ..run and run from past and leave it behind and enter the new dimension ...Provided if we travel faster than light ......this is a travelogue should be all about or atleast this is what I feel !
Two days back ....there was this fine evening ...overcast and drizzling .....Jatin and me decided to go to coffee express ( a food outlet in the premises of my company ) ......as and when we moved out from our dull cubicle life ...fulll of codes and bytes to eat ...the very moment we moved out of the closed wallls the breeeze flowing from mountain side touched us so deep that we felt a desire to chase the wind as far as it goes .In the spur of movement we decided to hitch hike to Sinhagad a fort the details of the place as I got from google are like this :D

Sinhagad : The Place
Sinhagad is one of the most popular forts of the sahyadris, being very close to pune city and also being very easy to climb.It is also known as 'Kudhana'.Standing at a height of 4320' it provides a fantastic view of the pune city and the lakes around and also rajgad and torna.

The first task inhand was to convince Vineet for the trip as all of us leaving the company together in itself requires a dare ! ......That ofcoure thanks to Vineet's enthusiastic and spirited nature we got the "Go" for the trip .........I was pooling with Tejinder on his Thunder Bird and belive me thunderbird is the bike which even on 100+ speed will not even shake .....with Suhas driving alone and Jatin and Adrija on Bullet we drove around 35 kms from our company to Sinhagad .On the way we stopped by for a cup of tea and corn at Khadagwasala dam .....Supposedly a kind of beach for Puneites ......not that clean but indeed a good place for a change where one can see lot of water to dive or dip ! ..........Over the dam we met Jatin and drove to the base of the fort .There we met Vineet- Shilpa-Rucha along with Santosh . From the base we all drove upto the height of 10 kms to the fort ....seeing the beautiful sunset somehwere from the hills i remmber was the most pleasing experience to eyes after the munar trip i had in third year summers .....After the ride of around half and hour ....and belive me thats like tough ride and a good test of endurance ...with lot of blind turns and stuff to skid on if we dont drive carefullly .....we reached the fort around 7:30 ....it was dark by then .....but stilll we managed to walk around the fort and clicked few snaps that i will post with this blog ......After that we all ate the jhunka bhakar and kanda bhaji there with an awesome cup of tea ....sitting beyond the clear sky and enjoying the cool air ........
While returning back the driving was bit risky with Suhas and Tejinder racing like maniacs on those turns and at that height ...Both of them made my life helll for atleast half and hour of the race .....One ofcourse shivers while sitting behind someone and having faced an accident in recent past :) ........Overall a nice trip to record and remember in later years of life !