Archive

Archive for March, 2010

Programming building blocks with real world object comparison

March 13, 2010 1 comment

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.

Pallete

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 🙂

Advertisements
Categories: Uncategorized

Find jar file location of a class [Fastest way]

March 11, 2010 Leave a comment

If you have folder which has all jar, then following command is quicker way to find your jar file of anyclass.

java -verbose:class -classpath $(echo *.jar | sed ‘s/ /:/g’)  com.anything.yourclass | grep “yourclass”

Categories: Uncategorized