Sunday, 13 May 2007

THE STRATEGY PATTERN

The Strategy Design Pattern

The Strategy Design Pattern fundamentally consists of a way to separate an algorithm from their host, and enclosing algorithm into a different separate class. startegy patten does allow you to switch the algorithm that you where using at any time of your design.
Some of the avantages that strategy pattern allow you to do is to keep track of the behaviours that you want your object to perform.



Saturday, 12 May 2007

DECORATOR PATTERN

DECORATOR PATTERN

After the class, i did some research on the decorator pattern and ii find out that its one of the most important of the 23 pattern types. Some of the reason why i said its important is that is flexible and you can do what ever you want to do with it. that is why i come up with this defination of decorator pattern.
Decorator pattern is the design pattern that allow additional or new behavious to be added to an existing design dynamically.
The example i can give for easy understanding of a decorator is, when you go to a chinese restarant to buy food, you can buy your rice and as them to add some aditive food to it, like chicken wing, ribs, soup and so on. So all the ribs, chicken wing and soup are all decorator.



REFERENCES

http://www.exciton.cs.rice.edu/JavaResources/DesignPatterns/DecoratorPattern.htm

Thursday, 19 April 2007

ANTI-PATTERN

ANTI-PATTERN

Anti-pattern are important tools to avoid problems from happening, by identifying the problem before it become a problem, and also trying to provide awareness on how its can be prevented from happening.

PATTERNS VS ANTI-PATTERNS

This critics we be done using the format by which pattern and anti pattern are designed.
PATTERNS ANTI-PATTERNS
PATTERNS Name: A name, this is used for the purpose of identification of the pattern that is being solved.
ANTI-PATTERNS Name: A name this anti-pattern means a way prove the use of the anti-patterns in the design.
PATTERNS Problem: this is a reoccurring problem that is faced by an individual or an organisation.
ANTI-PATTERNS Problem/bad solution: In this case problem is the common reoccurring mistake or bad solutions that are made doing pattern and are related to anti-patterns.
PATTERNS Solution: This is the best solution recommended by an individual or an organisation after several encounter with a particular problem.
ANTI-PATTERNS Symptoms: this show point to the direction where the problem is located in the design.
PATTERNS Consequences: This explains the merit and demerit of the recommended solution to the context.
ANTI-PATTERNS Consequences: this brings out the result, which is why anti-pattern, can be use to solve the problem.
PATTERNS Examples: this is where you be given past examples of where the solution have been applied to solve a particular problem.
ANTI-PATTERNS Root cause: this is the most important place because this is where the context for the anti-pattern is provided, because this is where is going to show where the pattern was applied incorrectly and why it results in a problem.

ANTI-PATTERNS Suggested solution: this is where the anti-pattern is going to give out a refined solution to the problem and attached more benefit of why the solution is best.

Thursday, 12 April 2007

ADAPTER PATTERN

ADAPTER PATTERN

According to my understanding and research done on the adapter pattern, adapter pattern alway come in two forms and that is object adapter and class adapter. To make it more simpler for me to understand and explain, i will explain each one, one by one.




An adapter pattern allows classes from different part of the design to get together because of incompatibility. The job of adapter is to bring then together anbd make them work regardless of the different code or design. e.g if you write a code in JAVA and in are using SQL server, both of them might not be compatible must with the use of adapter, this is very possible.

OBJECT ADAPTER PATTERN

firstly, object adapter pattern, Object adapters use a constitution method to get one interface to another. The adapter trys to get the interface that the client we like to see in the ddesign of the system, while the instance of the adaptee is hold.



CLASS ADAPTER PATTERN
Class adapters use alot of inheeitance from differnet part to achieve their goals, the class apater does not use the interface of the clients but its inherit the interface of the customer and also inherit the interface of the adaptee.



REFERENCE

http://exciton.cs.rice.edu/JavaResources/DesignPatterns/adapter.htm

Thursday, 5 April 2007

ABSTRACT FACTORY (GOF)

In my own word and understanding, abstract factory is a method of enclosing a group of single factories that are related to each other. One of the things I noticed in abstract factory is that, an individual that is not good in programming or UML diagram will always find it difficult to use abstract factory because is based on programming and UML diagram. In abstract factory, we should always have this in mind that there will always be a participant and a class diagram. A participant, which is the actor in the object that is use to for the purpose of understanding and illustration in the class diagram. A UML diagram, this is a diagram representation to show the actor, use case and their interrelationship. e.g.

(1)Fig 1
BENEFITS
consistency
changes can be done easily

Thursday, 29 March 2007

SOFTWARE PATTERNS.

Software pattern: according to my understanding, software patterns is the same as patterns. Pattern as a general repetation solution to occuring problem.The only different there is just the software that is added to the pattern, so because of that i will define software pattern as overall solution to occuring problem in the software industry.
The introduction of software pattern is good in the industry because it bring about the introduction of alot of thing that are missing in the industry. some of the things that software pattern bring to the industries
1. avoid repeatation
2. no time wastage
3. comparism
4. pattern allows you to edit

with all of this, software pattern as make alot of thing that are impossible-possible.

Thursday, 8 March 2007

COURSE WORK CRITICISM.

Overall, i think the course work is good and challenging. when i first got the course work, the first thing that come to my mind after going throught what we are suppose to do is programming and UML diagram which am not good in.
To start with question 1 UML diagram, its alrite to have it in the course work but when you dont know what to do them its becomes a problem. i have been trying o do alot of reading regarding the class diagram and other related UML diagram that i need to know o get the work done.
Question 2 code (programming), i have never been a good fan of programming since i started mt IT career and one thing i noticed is that you can do without it. i have stated learning some of the code i will nedd for the course work.
Question 3 Abstract factory, i think i should be alrite with abstarct factory because i have done a lot of research on that i have i done alot of work on it as well, so am okay with the question 3.
Question 4 Anti patterns, i love this part of the question because i like going against thing and bring out the mistake made my people. the only thing that make that question difficult is the quote in the sentence, i dont understand it.
Question 5 BLOG, blog is good and easy, that is if you get them posted on time.
overall nice course and challenged.

Thursday, 1 March 2007

CRITISIZE GANG OF FOUR ELEMENT OF PATTERN AND THE PREFER ONE THAT YOU LIKE.WEEK 3

The lecture today was fun because we discuss about a good topic they everyone in the class as been waiting for. we were given chance to criticize gang of four element of pattern and choose the one we are comfortable with.

CRITISIZE GANG OF FOUR ELEMENT OF PATTERN AND THE PREFER ONE THAT YOU LIKE.

According to all reading and all the research I have done, I believe pattern should be some thing sample not complex. The reason why I concluded that this should be done that way is because the people using this pattern are not all expert.
Gangs of four element of pattern are too complex for new learner in pattern, so I will not like to implement gang of four elements of patterns. But I will like some of the element should be taking out of it because they are repeated.
The following are gang of four element of pattern.

Name that describes the pattern
Problem to be solved by the pattern
Context, or settings, in which the problem occurs
Forces that could influence the problem or its solution
Solution proposed to the problem
Context for the solution
Rationale behind the solution (examples and stories of past successes or failures often go here)
Known uses and related patterns
Author and date information
References and keywords used or searching
Sample code related to the solution, if it helps


Name: YES. Name of the pattern is good to be there.
Problem: YES. Problem is another area which needs to be included.
Context: YES. Context is important because that is what describes what the real problem is so it’s cool to be there.
Force: NO. Force is one of the elements which I don’t like to be among the element of the GOF element of pattern.
Solution: YES. When there is a problem, there is always a solution.
Context: NO. Is already there, there is no case for repetitions.
Rationale behind the solution. NO. This is a repetition as well, so to me I think it’s not advisable to include that to it.
Known uses: YES. Is always good for some one to find out the knows user of the pattern before doing it.

After going through other Arthur element of pattern (Alexander c, GOF, copper j w) I think the Alexander way of element of pattern is the best because it good for new use, it’s straight forward and can be easy easily manipulated.
But still I want some thing to be added to the Alexander element of design e.g. name of the pattern. He’s way of pattern can be used in any environment and all part of life.

Thursday, 22 February 2007

FAQ ON PATTERNS WEEK 2.

FAQ ON PATTERNS.

After today’s lecture, there was a lot of argument in class, so because of that the lecturer asks us to prepare some FAQ for new comer in pattern. The following are the question and answer.

1. Is there a better definition for pattern
For a new person that is just introduce to pattern, the best for the person is to give a simple definition for patterns that is pattern is solution to a problem in a context.
Problem refers to a set of forces goals and constraints that occur in this context.
Solution refers to a canonical design form or design rule that someone can apply to resolve these forces.

2. Is there a better word to describe pattern.
Pattern can be called anything you like.

3. What's the difference between class and pattern?
A pattern is not an implementation. It describes when, why, and how to go about creating an implementation or other engineering product.

4. Who is Christopher Alexander?
Alexander is an architect in the sense of buildings, not software who invented patterns.

5. Are there any disadvantages in pattern taking a negative form?
Perhaps ideally not sets of good patterns would steer you clear of the infinitely many bad designs sometimes called antipatterns you could come up with, as well as all of the contexts in which it is not appropriate to apply a given pattern. But some ideas are so bad yet so prevalent that they deserve explicit mention. One way to do so is to include a Common traps and pitfalls section in a pattern description. Descriptions of bad solutions can form part of the motivation, rationale or forces for a good solution. Patterns may also describe ways of transforming bad solutions into good ones.
5 Some people think pattern is just ideal that can be given to then by anybody.
Because some patterns are so good and useful that even your grandmother knows them. Writing them down makes the context, value and implications of the advice clearer than your anybody probably did.

6. Why should I use patterns?
For the same kinds of reasons that you should reuse good code: Benefiting from the knowledge and experience of other people who have put more effort into understanding contexts, forces, and solutions than you have done or want to do. Further, patterns can be more reusable than code, since they can be adapted so that you can build software to address particular special circumstances that cause you to be unable to reuse an existing component.

7. How do I go about writing a pattern?
This recommendation can be followed.
8. Avoid writing about patterns; just write patterns.
a. Aim for quality, not quantity of patterns.
b. Figure out why the pattern exists or applies.
c. Pick a format for writing about it.
d. Continually iterate and refine.


9. How many patterns do we have?
Some people think there are relatively few undiscovered patterns that nearly everyone ought to know about. Some people think that there are a great many more domain-specific patterns that need to be written.

10. Is the use of patterns necessarily iterative?
In principle, you could be very lucky and have a problem for which there is already a complete set of patterns, and in which each application of a pattern flows into the next, leading to a final product without ever backtracking. But people are never this lucky.

11. Wouldn't it be more useful to teach people to write patterns rather than teaching them to use a bunch of existing patterns?
Both are needed. Neither is more needed.

12. How can we institutionalize the use of patterns where I work?
This recommendation can be followed.
a. Extend design documentation and review practices to also deal with design patterns.
b. Run courses on the use of existing design patterns.
c. Review existing patterns in a writer's workshop.
d. Use a pattern-based style template for documenting designs.

13. Can you use patterns in very large development efforts?
I think yes, because a lot of people has do so and its works for them.

14. Do patterns really work?
Yes it does.

NB
Some people incorrectly use the term design pattern to refer to any object structure, even if it is not in any sense a pattern. Please don't do this.


REFERENCE.
http://g.oswego.edu/dl/pd-FAQ/pd-FAQ.html

Thursday, 15 February 2007

PATTERNS WEEK 1.

PATTERN

“According to Alexander’s definition of pattern, he describes pattern as a problem which occurs over and over again in our environment, and then describes the core of the solution to that problem, in such a way that you can use this solution a million times over, without ever doing it the same way twice.”

After digesting of this definition and the reading of the note give about pattern, I define pattern in my own way, pattern is method by which different or similar problem occur all the time and you find a permanent way of solving that problem in case the problem occur again and there are different context involved in solving different problem.

After this lecture about pattern, I got to know that pattern is a real life thing that happens every day to solving human being problem in all aspect of life. Pattern is everyday thing because all the invention in the world today is done because of the problem people are facing everyday.
After the digestion of pattern and its relations, i decided to create a new real life pattern for my reading.




PATTERN IN REAL LIFE.

You are a student, you work full time and you school full time, and you want to get a 1st class result in your university degree BSC.
Your lecturer want you to come to class as early as possible, and also your manager at work want you to come to work early to avoid been send off at work but he offer you a solution of, if you know that u can come to work early then change to a part time job but if you change to a part time job, you need money to pay your school fine because you are already owning the school a lot of money.
Your brother wants to help you but he does not have money to give because they have not paid him at work. And there is nobody that is ready to borrow you money because they knows that u are a student.

PROBLEM: Want a 1st class result in the University for Bsc Degree.

SOLUTION: Stop working or work part time.

CONTEXT: You have to leave some of the thing you want to pay for so that you can get a 1st class result.