Home > Uncategorized > Programming building blocks with real world object comparison

Programming building blocks with real world object comparison

Nowadays I try to compare programming building blocks with real world objects. Especially interface is my special interest.

Finally I am able to compare interface with real world thing.

When I was walking close to ShengSiong shop in Singapore, I came across a person lifting 100’s of cases of Coke using pallet and jack. Here lift can handle weight, but doesn’t know what shape it is? Pallet knows that it will be lifted, so it gives place holder for other things to stack upon it. Coke cases are flat, and don’t know anything about transportation.


The magic is when lift seamlessly plugs itself into pallet, and on top of pallet it could be anything. Imagine if you work as an employee in shopping mall without lift, pallet and customer :).

When I asked the same question to Hanspeter, he explained using screw and bolt-nut. As long as they have the same size, bolt nut can fit to any screw. When screw hole in any machine matches, any bolt nut and screw can be used to fit them.

He also shared that he imagines programming problems as some model in his mind. Sometime it takes time, but will help to give strategic (clean, perfect) solution. But sometime problems can’t wait, so it reaches a person who solves it somehow (tactical), may not be clean solution.

And today, I want to pour a glass of lemon tea from a glass tumble to another to filter it. Unfortunately, I don’t have second tumbler. Imagine, how if recursion is possible in real world, so I could pour tea into the same tumbler, in between I can also filter them 🙂

Categories: Uncategorized
  1. Hari
    May 4, 2010 at 6:19 pm


    Recently one EE engineering guy joined us as a fresher. He was not very confident of himself because he was from a non-CS background. I talked with him and told him that was his greatest advantage as a matter of fact.

    OOP can be better understood by non-CS engineers. I explained him the concept of ‘interface’ by means of a resistor. A resistor made by any company anywhere in the world, any time can have only 2 pins!! That is its interface. World over, circuits are designed with this idea in mind. One can plug in any type of resistor of any make.

    Good article! What you said is right. Looking into the real world and seeing objects consciously would teach us OOP much better than what books can.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: