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