Saturday, 17 March 2007

PAFSD Coursework (Week -4)

Today in the morning, Ma'am Jane Chandler came from university of Portsmouth, she spoke about different aspects of software design patterns and gave some examples of real life patterns, also she gave the coursework for our batch.

In my opinion, the coursework has enough time span to be completed and it seems okay, not very easy and not very difficult either.

In Task-1, we have to design a small prototype which creates, stores and updates customer records, then we have to make some UML diagrams using three patterns. Only thing that is worrying in this task is to evaluate the effectiveness of each pattern.

Task-2, we have to come up with the code of above UML diagram, I am going to skip this task.

Task-3, seems to be easy, as we have to complete a pattern draft, the thing that worries me is choosing the pattern preserving technique, because if i chose GoF (which I intend to), i have to drill down deep into any particular Temporal pattern.

Task-4 is a bit difficult task as we have to come up with a really good essay on Anti patterns, and I have no clue about what they are.

Task-5 (my favourite one) is the easiest of them all, that is we have to make a blog (which i m currently doing) about our understanding of the design patterns. We have to explain every lecture of our class in our own words where by we have to explain, what we understood from today's lecture.

Abstract Factory (Week - 4)

In today's session, we studied about first design pattern of GoF Design Pattern catalogue i.e. Abstract Factory.
From my understanding of the concept, Abstract factory creates interfaces for different objects that are related to each other or depend on each other, such that there is no specific concrete class. In simple words, it encapsulates a group of individual factories having same essence.

The client uses same interface to generate objects that are part of it, the client does not know about which concrete objects it gets its requests served because of generic interfaces. This patterns separates the details of implementation of set of objects from clients.

This pattern is used when;
  • When a system is independent of how it is implemented
  • system needs to configure with one of multiple families of products

Uses of using this pattern are;

  • Isolation of concrete classes; they becoming independent of how the system is implemented from client side
  • exchanging of different families of products because easy because they all belong to same set

Perhaps an analogy of abstract factory would make it easy to understand; Taking example of Electric hair cutting machine, it has different grades. Short, Medium and large. The amount of hair person would like to cut depends on the grade being used. For example; if you want short hairs, you might use grade 1, if you want medium then maybe grade 3.

Each different grade acts like a factory and the machine acts like a class. As soon we plug the grade in to the machine then grade inherits the properties of abstract (machine). The machine doesn't care about which grade you are using, its sole purpose is to cut hairs, only the grade would decide the amount of hairs its going to cut.