This blog is about patterns in real life, design pattern, software patterns, the Gang of Four patterns and anti-pattern relating to Software Development.

Thursday, 22 February 2007

Introduction to pattern

[Blog 1]

In the first lecture, the lecturer gave an introduction of what pattern is and where it first originated. He talked about real life patterns. The class was full and so there was a lot of discussion and confusion going on, but as we discussed, the topic got clearer and clearer. As homework we were told to write about what pattern is as we see it in real life. I presented a few versions of my understanding of the topic and the final one is as follows.

What does pattern means to me?

My best understanding of “pattern” in the real world is a solution which is used to solve a specific problem that occurs repeatedly over a random period of time but for a specific context. Each pattern is meant to solve a single unique problem using a single unique solution. If someone says “I have a family problem” then a pattern cannot be applied directly because this is a big problem which needs to be broken down into smaller, more explicit problems which can then have their own individual solutions. Having a family problem means having to look after the husband which is one problem then children which is another problem and cooking which is another problem and cleaning and so on. In terms of context, having to do a lot of cooking is one context because it has its own unique variables like time and other resources, on the other hand having to do less cooking is a completely different context. So, in other words a family who has to do a lot of cooking has a different cooking style which is one type of pattern compared to those who do not have to do a lot of cooking which is a different pattern. Patterns are very useful in the real world because it allows solutions to be used on the spot without having to think of a new solution. One practical real life example can be, if while going to college there is a problem with the central line railway network (problem) but it is possible to use the same ticket (context) to travel by bus, then we can use the bus number 94 to reach Oxford Street (solution). Like that, with time, we human beings gather quite a lot of solutions to specific problems that we encounter and solve successfully. These solutions immediately come to our mind when we face those problems again because they are stored somewhere in our brain just like a collection (catalogue) of music tracks in a computer hard disk which can be used whenever the need arises.
Moreover, when a solution comes to our mind, we also have an idea of where and in which context it can be used. Along with any solution there is a kind of documentation, hence when a problem occurs we know exactly which solution to use for which problem and we do not mix one with another.

Example of a pattern I thought of.

Name: Optimising kitchen product sale transaction

Problem: Customers have to wait a long time while making payments because both credit sale and cash sale customers queue and expect to be seen by the same cashiers irrespective of their payment methods.

Context: Lots of people like to buy kitchen equipments like rice cookers, gas cookers, and dish washers and so on but not all of them pay by cash. Some buyers pay by cash while others prefer a credit sale. It takes more time to process a credit sale than a cash sale as lots of details about the customer and the goods they are purchasing need to be recorded. Because of that, people paying by cash have to wait in the queue along with people paying by alternative methods hence delaying them unnecessarily.

Solution: Customers are asked by which method they want to pay. And then those who want to pay by cash are allowed to queue in normally and make payment for the goods they want to purchase. Customers paying by credit are taken to a different line where all their details are recorded and the credit sales done. This allows cash sales to be done very quickly, preventing customers from waiting a long time and credit sales customers can wait as normal. Oncoming customers can be dealt the same way and hence reducing customer waiting time.

Anyone wanting to comment on my blog is most welcomed.
Also, I would be very happy if my blog is useful to anyone who wants to know about pattern in real life.
Thank you for reading.

Labels: