It's and appropriate of time that I can join the Yoolk team. I've learned a lot of new things.
======================================State pattern is mostly used in State machine. It has all of methods in itself to calculation in everything. as an example, if you have some methods such as, Add, delete, Update and Save. you will write all of these operations. Like when will you allow to press button after this button you will move to another button, so If you have many of these operation in your project you should better write these operation in State pattern by writing only one time and use it in many places.
Visitor pattern is the pattern that we don't want to change anything in the existing class. we just derive it and override some method over the main class. As example, we have employee department and have many levels of employee in it, so if we want to increase their salary we just write another method to the new object and update all of their salary by their own different level.
February 17, 2009
State pattern and Visitor pattern
Posted by samneang
Subscribe to:
Post Comments (Atom)

0 comments:
Post a Comment