- Introduction to Design Patterns
- Uses of Design Patterns
- Types of Design Patterns
- GoF Pattern preserving technique
As per the task given in the class, the students were required to identify one pattern from GoF Design Patterns and critically analyze their preserving technique.
The author went through the first pattern that is Abstract factory, understood the concept of each element in preserving technique, the elements and criticism of their preserving technique is as follows;
1) Pattern Name and Classification
Description
The pattern’s name conveys the essence of the pattern succinctly. A good name is vital, because it will become part of your design vocabulary. Every pattern should have a descriptive and unique name that helps in identifying and referring to it. Additionally a pattern should be classified according to a classification. This classification helps in identifying the use of the pattern. [1]
Criticism
I totally agree with the descriptive nature of pattern name, because a patterns name should be such that highlights the pattern essence and it should also be unique so that two patterns are not mixed. Pattern should be added in its relevant classification such that it highlights the uses of that pattern.
2) Intent
Description
Intent is a short statement that answers the following questions: what does the design pattern do? What is its rationale and intent? What particular design issue or problem it address? This describes the goal behind the pattern and the reason of using it. It resembles the problem part of the pattern. [1]
Criticism
Indeed Intent should be included while preserving a design pattern, before we actually go to the detail of the pattern a small description of the pattern is very useful and handy as it explains the purpose of developing the pattern.
3) Also Known as
Description
A pattern could have more than one name; these names are documented in this section. [1]
Criticism
I do not think that this part is vital for every single pattern and it can be avoided in certain situations. Not every pattern has other names, however if any pattern has some other names, they can be included in “Pattern Name and Classification”
4) Motivation
Description
This section provides a scenario consisting of a problem and a context in which this pattern can be used. By doing so this section shows when this pattern can be used. [1]
Criticism
It is important to include motivation section in catalogue because it proves with example that when and where this pattern can be used, which is handy for end user.
5) Applicability
Description
This section includes situations in which this pattern is usable; it represents the context part of the pattern. [1]
Criticism
The context part makes sense to use because it describes the context of the pattern, however the usage part can be avoided because we have already described of the use of this pattern in “Name and its Classification” and “Motivation” stages of catalogue.
6) Structure
Description
This section presents a graphical picture of the pattern using class diagrams and interaction diagrams. [1]
Criticism
“A picture portrays a thousand words”, following this statement it is very important to include this section as the picture would give the overview of the pattern.
7) Participants
Description
A listing of the classes and objects used in the pattern and their roles in the design. [1]
Criticism
Developers from different backgrounds would find this section beneficial as it conveys the purpose of classes and objects in simple terms so that they can be applied in different languages easily.
8) Collaboration
Description
Describes how classes and objects interact with each other. [1]
Criticism
Again this part would prove to be beneficial for developers who use different languages, technologies and tools; it should be included in catalogue.
9) Consequences
Description
This section describes the result, side effects and trade offs caused by using this pattern. [1]
Criticism
Everything has advantages and disadvantages associated with it, this part would describe the key advantages and disadvantages allied with this pattern, and it should be included.
10) Implementation
Description
This section describes the implementation of the pattern and represents the solution part of the pattern. It provides the techniques used in implementing this patterns and suggests ways for this implementation. [1]
Criticism
Techniques and ways to implement the system would be handy for developer, these techniques and ways can be used by novice developers.
11) Sample Code
Description
An illustration of how this pattern can be used in a programming language. [1]
Criticism
This part would only be handy for developers who work in the same environment as used in this section. For example a pattern whose sample code is given in C++ would be valuable for C++ programmers only.
12) Known Uses
Description
This section includes real usage of this pattern. [1]
Criticism
Details of real world examples regarding a particular pattern would be handy because it highlights where this pattern has been used before and in what situations.
13) Related Patterns
Description
This section includes other patterns that have some relation with this pattern, so that they can be used along with this pattern or instead of this pattern. It also includes the similarities and differences with these patterns. [1]
Criticism
This section should be included as it describes other patterns that use similar concepts and relations between these patterns.
Reference
[1] Lecture Handouts given By Lecturer
Week (3) - Introduction to Design patterns
Slide Number 15 to 18
6 comments:
I still coudnt understand this pattern Abbas!.Could u please tell me about it with a help of any simple example would be very helpful..Thanks ..
I think you havent gone through my post.
I have not crticized any pattern Hani so how come your are going to understand it...
I mentioned in my post that I have used Abstract Factory to understand the elements of GoF preserving technique, I have not crticized Abstract factory.
The criticism is on the elments that are used in GoF pattern preserving technique
Hi, well done on the blog about the cataloging technique. I was quite elaborate. I benefited from it. About the Sample code, I donot think the GOF should have included it since they also provide a UML diagram for each pattern. This would give the pattern users chance to choose a language they prefer. Of course it should be OO
John
Well john, one of the advantage of patterns is to provide a template for reuse. GoF have used one specific language to build on that UML diagram so programmers from that particular language can benefit from it, however your point is valid enough that same UML can be used to write the code in other languages.
Hi khawar
The "uses of pattern" is different from the short description in "name" or the "forcing factors" in "motivation", hence it is very important to have the uses in "applicability" to enhance the pattern understandability of user
Personally I think, there is a very thin line between the uses of a particular pattern explained in Pattern Name and Classification, Intent, Applicability.
The uses explained in first element give a slight insight of the classification, which highlights the applicability of a certain classification. Since the pattern belongs to that classification so it slightly gives a hint that where this pattern can be used.
On the other hand, Intent explains the purpose of the pattern and not the classification, it elaborates the slight hint given in classification.
Coming over to Applicability, this element portrays the exact situations where a particular pattern can be used, thus it adds to what is explained in Classification and Intent.
Thanks...
Post a Comment