31 December 2010

Wish You a Very Happy New Year - 2011

Unstuck wishes you, your family and friends a very happy new year


Cheers,
Lakshmi


30 December 2010

A Question on Java Exception?

In Java, there are two types of exceptions - checked and unchecked.
Java compiler ensures that "checked" exceptions are handled and flags compilation error when checked exceptions are not handled. But it does not flag errors when "unchecked" exceptions are not handled. The subclasses of "RuntimeException" and the subclasses "Error" are "unchecked".

Why does Java have this as a thumb rule?

28 December 2010

Software Design Puzzle #6 - Design A Dictionary

Think about a dictionary now and kind of things that you will do with a dictionary. Normally a dictionary will have simple operations of add, delete, edit and search words. Being a software dictionary, won't it be good that it suggests you list of words based on the words you type.

For example, when you type "sim", it should display first "N" closest match with the prefix supplied. I don't need to emphasize that the first word should be the exact match (if any) and then followed by list of words that matches closely.

Assume that you have many data store in which the words are stored (database, XML file, txt file, CSV file etc). It is enough to perform the search/auto-suggestion on the data in local database. If the user is willing, the user can also hear the word through audio and for doing that you have to contact a remote web service that gives a audio file for a specific word. You can also assume that there exists a audio file for every word in the database.

Can you design the application, come up with set of classes, assign responsibilities to the classes and a brief architectural diagram too.

Put your design patterns knowledge in action :-)

27 December 2010

Lesson Learnt from "Clean the Mess"

I had a wonderful experience today (Sunday, 26-Dec-2010). I took my nephew to a nearby super market. Being a Sunday evening, there were lot of people and even lot more in the billing counters. We were standing at 5th position waiting for our turn at one of the counters. There were many chocolates racks near the billing counters and those chocolates were kept there purposefully to make people standing in the counter to buy when they are waiting for their turn. While standing, i noticed two perk chocolates fallen off the shelf.

My nephew, while taking his chocolate disturbed couple of chocolates from the overloaded chocolates stacks. I had told him to place the fallen chocolates in its shelf. He did it many times as he was busy in choosing chocolates. All the times, he made sure that he kept the fallen ones on to the shelves. But his attention was not on the perk chocolates that had fallen off before we stood there. As an usual adult guy, i didn't try to bring his attention towards the two chocolates that fallen before. The simple philosophy was "i didn't create the mess (we didn't dislodge those two perk chocolates), why i should clear it".

After five minutes, i had a lesson from my young nephew. Finally, his eyes fell on the two chocolates. He picked up those two chocolates along with the new fallen ones. He cleared the whole mess. Though it was mess, i saw the mess differently than how he saw. For him, the mess is the mess and he has to clear it. For me, the part of the mess was due to me and the other part was someone else's. So, i dont need to clear others' mess.

Many times, we go to a training  to learn etiquette. But being sensitive and watching little ones will teach us what the trainings can't teach.

It was powerful learning and great life's experience. I aspire to take this learning forward till I die.

25 December 2010

What is Experience

Yesterday, Sandeep and I had a long discussion on "what is experience". Here is what we came up with.

We start our career with equal potential. Experience is how we mobilize our potential. It is how we convert our potential (the energy we posses by virtue of being human, engineer etc) to action (how we mobilize the potential to get results) decides the depth of our experience. The conversion factor differs and so is over experience/learning. Experience obeys law of conservation of energy. The energy neither be created nor destroyed but transformed from one form to another form.

In general, potential diminishes as experience grows and kinetic increases with experience (for most of us). We become more action oriented with experience.

We came up with the following diagram during our chat.



15 December 2010

Software Design Puzzle #5 - Ice Cream, Ice Cream, Ice Cream

Uncle John is very tired working for a software company. It is his childhood dream to be a entrepreneur and so he resigned his job and started a ice cream business. His business idea is very simple. Like coffees, teas, milkshakes, he wants to do ice cream vending machines and sell ice creams along with ice vending machine. Being a Java developer, he wants to develop a highly flexible ice cream vending machines (and eventually patent it). He wants to give few varieties of ice creams - cone, cup and stick and so many flavors.

The question here is, how will you design the ice cream vending machine (time being forget the fact how various ice creams base/flavors are mixed and ice cream is made which by itself is a separate design problem to solve).

How will you design the vending machine?

10 December 2010

Puzzle - Which is at the Middle

There is a linked list (you can assume that it is unidirectional or bi-directional). The list is not ordered in any specific format (unsorted).
  • What are the methods (or ways) by which you find the middle element of the list? (For example, if the element has 11 elements, 6th element is the middle. If you have 10 elements, 5th or 6th (whichever you like) is the middle element of the list).
  • What is algorithmic complexity of each method?

08 December 2010

Software Design Puzzle #4 - Apple Farm

This time, it is producers and consumers. Here is the story

There is a apple farm and the season is at its peak. The farm has many trees and each tree has numerous apples. The owner decides to harvest the apple and invites bids from various folks who are interested to buy apples. Some of them want the apples to be sent to their places and some of them are ready to reach the farm to procure the apples. So, the farmer plans for the harvest. He employs few hundreds of people - some to pick apples from the tree and some to package/transport apples. And by the way, the farmer sends apple as package of 500 apples.

Can you bring out classes and their relationships to fulfill the above requirements?

05 December 2010

Engage at Higher Level

For quite sometime, i have been reading books quiet consistently (probably at least 30 minutes before i sleep) but yet i m not consistent with my thoughts. So far, it still exists as an unaccomplished dream - the dream that i would cherish when i see through things beyond what is so obvious and penetrating through the subtle and be satisfied with the way i abstract things. Solving an unsolved problem through the one that i already solved is going to make me so happy, so satisfied, so brainy. Above all, i think that is the starting point of wisdom. Wisdom, not only helps me to solve unsolved problems but also helps me to stay calm during the period of time when the problem is getting resolved. An analogy is the process of farming. You sow the seed but yet wait until it reaps. This needs a bit of higher level of thinking.

Do we need people to just tell the direct things? Yes, we do need people to tell us direct things. But we don't want them to teach. Assume that i teach people how to do stuff by writing a book. Then the book becomes science even if the book is written on arts. The beauty of a subject lies in "art form". For example, let us assume that a world class painter writes a book on how to use colors in painting. The painter talks about science of mixing colors to produce new colors that expresses the mood in the painting. It is a science. But even the art has science and art forms. So is science, it has science and art forms. The wisdom helps us to take up something to art form.

The science form tells us how to do stuff, probably how to do stuff better. But it never tells us how to imagine with the help of stuff that we know. The science form of a subject cannot tell all sort of things that can possibly come out of science because the science has definite boundaries. On the other hand, the imagination yields new science. But only the art form begins the hope of the future and hence it has no limits. The art form is most compelling and forward looking. I m not trying to say that science isn't required. But i argue that science is not suffice. In order to understand the obvious and move beyond obvious is only possible when you take up something beyond "science form". Engaging at higher level helps in accomplishing this.

Engaging at higher level is a starting point of appreciating something in art form. The art form gives the guts feeling, tells you that you are on the right path and it helps you to unfold your future that you imagined few years back.

Engaging at higher level can take multiple forms like seeing things in different perspective, trying to digest the information and question the appearance of things. If we start accepting things as they are presented to us without employing (or at worst trying to think at higher level) any higher level of thinking, soon we will find stuck in rituals.

Finally, if you ask me what do i mean by higher level, it don't have a correct answer other than saying that it depends on individuals (and how they events are unfolded) and the way they abstract ideas.

About Image:
I was searching to get an image for this post and feel the above image with elephant trying to hide behind a small tree as apt one. Every day, we process a lot of information and tend to form fractured views about the things we read. We read a book, attend conferences and draw conclusions rather than drawing inferences. The beauty of inference is that it keeps changing as we think. :-) The image shows how we fail in thinking. Most of the times, we think that we are brainy but the other side clearly catches our ignorance because our ignorance is quiet visible.