Tutorials to .com

Tutorials to .com » Dotnet » Oop » Words - a prototype model

Words - a prototype model

Print View , by: iSee ,Total views: 22 ,Word Count: 452 ,Date: Wed, 22 Apr 2009 Time: 1:21 AM

Late today, and Monday because the company a lot of things to do, and I did not sleep last night, come what not to do after a morning. : (Fortunately, the boss in a meeting hiahia. But not so lucky next time, and if there are two places at once Sun monkeys law, not a clone, where I worked on, I sleep more than nice.... So tell us about today prototype model (prototype)
Sometimes, we want to create objects in general are very similar, but in some attribute values differ, but their initialization process is relatively complex and require a certain amount of time spent, then we can use the prototype. First of all, an initialization of an instance of a class, and then other examples of the first examples of cloning to create. And then, or cloning (clone) to deal with their different, or by the caller to deal with, depending on which is more concerned about their differences. If the caller does not care about their differences, then there should be copies of ways to deal with their differences and return to an example.
This model in <Design Pattern> is like this:
Examples used to develop a prototype to create the type of object, and through the copy of these prototypes to create a new object.
The applicability of his:
When a system should be independent of the products with his creation, composition, Oh said when. (In other words, the caller is not concerned about how to call the object is created, the internal structure is, how, and by the cloning method to deal with)
In order to avoid the creation of a parallel with the product category of factory-level class hierarchy (for we have introduced the factory method, a plant can have more than one type of factory methods to create different products, respectively, when a factory class that there is only one factory method, then this factory class and its products in a parallel interface on the level, this time in order to avoid creating too many categories of plants, leading to the complex structure of the prototype model can be used).
When a type of vision can only be a few different states of a portfolio, the establishment of a corresponding number of prototypes and clone them than the status of each with the appropriate type of hand the city to spend more convenient (this is what we talked about above initialization problem of the so-called)

.Net Object Oriented Programming Articles

Can't Find What You're Looking For?

Rating: Not yet rated


No comments posted.