Monday, 14 May 2007

Anti Patterns (blog 10)

Anti patterns! Different kinds of questions come in to our mind when we hear this word.
It was very interesting to hear the lecture on Anti patterns. I learnt a lot from patterns and anti patterns through out this unit. I was just looking on IBM and some other websites, trying to get more and more knowledge about anti patterns.
Our coursework Task4 in which we have to write about anti patterns will allow us to write in detail about anti patterns. I am going to write few lines on Anti patterns and want to express briefly what I understood about anti patterns.
An anti pattern I would is a pattern in which we produce a bad solution to solve a problem. When the wrong solution is produced at that time we don’t know that whether it is the right or wrong solution but when it is actually implemented than we realize that it was a wrong solution to solve that occurring problem. I think it is good in a way because it will allow us to learn from our mistakes so that we don’t do the same mistake in future.[1]
Anti patterns are not used only in software development it happens more often in our real life as well. I am going to explain more about it in my Task4 of the course work.

Reference:
[1]Anti patterns, learned from
http://c2.com/cgi/wiki?AntiPattern

Monday, 7 May 2007

Strategy Pattern (blog 9)

I found this pattern very interesting as it gives the client to choose their requirment. Strategy pattern helps us in defining family of algorithms and of them can be encapsulated so that they can be interchangeable.
The aim behind the strategy pattern is to make things easier for the implementation and maintenance of methods. It is also possible to use strategy pattern in software design. S
Strategy pattern should be used when
1. you require different versions of algorithms
2. Suppose you have many different classes which are related to each other but they differ from each other in terms of their behaviour. In this case, strategy pattern helps you in configuring a class with one of serveral different behaviours..
Strategy pattern can help us in avoiding the usage of difficult data structures. [1]
Reference:
Raghvendra Singh, accessed 7th May, 2007

Sunday, 6 May 2007

Decorator Pattern (blog 8)

The next pattern which i am going to discuss briefly is Decorator Pattern. Its a pattern which allows an elegant OOP technique to add some extra responsibilities or you can say functionalities to a specific object of a class. You can add functionalities to all the objects or even a single object of a entire class.
Decorator pattern is also know as Wrapper, is an object which has a interface similar to an object that it consist.
Decorator changes the way an object appears that is totally different from subclassing.
Drawback
The component which is enclosed with decorator is not the same. Tests of object types may fail in this case. And there is another point about this pattern which is not impressive is by using this pattern ! lots of small objects are created which is severe stress to the programmer when it comes to debugging some error.[1]
Reference:
C# Design Patterns: The Decorator Pattern

Tuesday, 3 April 2007

Adapter Pattern (blog 7)

We had an interesting class regarding Adapter pattern. I found this pattern very interesting because it allows us to make classes work together with the help of their interfaces, the interface of the classes will make classes work together which are incompatible to interact with each other. Adapter patterns are also known as Wrapper.
This pattern should be used in solving issues such as when you want to replace a class but the interface doesn’t match OR without knowing the interfaces of the classes when we want to create a class that could be used with some other classes.


Adapter Pattern has two types.

1.Object Adapter Pattern
This type of pattern has a technique in order to adapt an interface to another which I think I have never seen in any other pattern. According to the client requirement the adapter inherits the interface. Object adapters authorize the client and the adaptee to be completely decoupled from each other. Just the adapter knows concerning both of them.
2.Class Adapters
Multiple inheritance is used by class adapter to accomplish their goals. Class adapters are useful in situations like where there are some existing class provides services and doesn’t require to use the interface.

Tuesday, 27 March 2007

Research on new pattern: Datetime Design Pattern (blog 6)

Dr.Sri asked us to do some research on more patterns apart from the one we are studying in our unit. I was looking on the internet trying to find some new pattern and came across DateTime Design pattern
Datetime Design Pattern
Why
This design pattern is used to make human readable datetimes to be also formally read by the machine. The needs arises as a result of solving the practical need for human readable dates for hCalender (hCalendar is a simple, open, distributed calendaring, based on the Calendar standard).
Where & How it is used
Datetime design pattern is used in hCalendar is something like this:
Date Time
where foo is the name of the class which is being applied to this date/time, the title of the is an ISO 8601 date/time and "Date Time" is a friendly representation of the same date/time. [1]
Reference:
[1] Where Datetime deisng pattern is used
http://microformats.org/wiki/datetime-design-pattern

Thursday, 22 March 2007

Comment on the Coursework (blog 5)

Well finally we got the coursework and thanks to Jane chandler who came to our college and gave us very valuable information about the coursework.
When I first looked at the coursework when it was handed to me and to all classmates I was scared that how I am going to do it because I have other course work to do as well, anyway when I came to know the submission date for this course work I was a bit relaxed after that.
The course work seems to be alright, doesn’t look very easy neither very hard but It is lengthy.

TASK1 (UML Designing)

If we talk about the task 1 which is based on UML designing in terms of Strategy, Decorator and Adaptor patterns. First of all what I think that it is not possible for anyone to complete this task unless you understand how UML diagrams are designed. If you know how to design UML diagrams than this Task is easy to attempt because we just have to come up with four UML diagrams and of course we need to design them by adapting the above three mentioned design patterns and apply them to the prototype of customer records.

TASK2 (Coding) & TASK3( Patterns and Software Development)

I am making my mind to do task 2 (coding) but still confused I might attempt task 3 which is a bit theoretical. Although there is much possibility of doing the coding task because I have been programming since more than two years but I haven’t done programming using patterns. Task 3 is not tough as well but I am thinking what tasks should I attempt.

TASK4 (Essay writing)

I think this is most difficult question in this course work in which we have to write an essay about anti patterns and write our point of view on anti patterns. This task could have been easy if there was no specific scenario given. Writing an essay of 600 words reminds me of my school days when I use to write essays on different topics but never got a chance to write an essay related to computing and it is really hard to get good marks when you are writing an essay. I am looking forward to do my level best to take this task as my 3rd task.

TASK5 (Blog)

I love blog because we just have to write whatever we understood from the lecture given in the class so there is not as such research involved in it. So I am happy to do the blog task. Basically in this task we just have to write what we learnt from our lecturer on each class. So we didn’t understand the lecture very well the other way we can do a bit research online about the topic which was taught in the class and then write it in our own words or do referencing.

Overall,Coding and the essay writing are the tasks in which we have to be very careful how are we using patterns and what are we writing about patterns, rest I think its straight forward.
Please give your comments

Wednesday, 14 March 2007

Abstract Factory (Blog 4)

The next blog on which we were asked to understand and do research is Abstract factory. I have looked in to many websites, tried to get as much knowledge as I can and now I am going to write what I understood about Abstract factory..!
The Factory Pattern known as Abstract Factory is used to facilitate class instantiation. In the Abstract Factory pattern, a special class, called a factory, is created whose main aim is to create instances of a class.
The factory method pattern is like defining an agreement for the creation of a given type of classes
  • An abstract factory is an object creator.
  • It can produce different types of objects.
  • Each object that it produces is recognized by receiver of the object which is created only by the interface of that object, not by the object's real implementation.
  • Objects which are produced by abstract factory are related to each other or you can say they belong to a common family

Benefits

Abstract factory eliminates the need of classes to bind in to the code. The code deals with the interfaces, therefore it is possible that I can work with any class that implements an interface.
It also allows the subclasses to give an extended edition of an object because it is hard to create an object within the class but It is more easy to create an object in the client directly