-
A template method pattern defines the skeleton of an algorithm in an operation, while deferring some implementation steps into a subclass. Template methods allow subclasses to redefine certain steps in an algorithm without changing the structure of the algorithm.
The template method pattern is a relatively simple design pattern, but it is a basic technology for reuse, especially in class libraries, which follows the refactoring principle that "abstract classes should have as much behavior as possible, and should have as little data as possible". The method as a template should be defined in the parent class, and the abstract method is used in the definition of the method, and the abstract method of the parent class is not known how to deal with it at all, and the actual specific processing is the subclass, and the specific function is implemented in the subclass, so different subclass execution will get different implementation results, but the processing process is still customized according to the parent class. This is the essence of the template method, to formulate the algorithm skeleton and let the subclasses be concretely implemented.
I recommend you an excellent book on design patterns: "Software Secrets - Design Patterns" edited by Zheng Archie. The explanation is in place, the examples are easy to understand, and I have gained a lot from reading it!
Good luck learning the design pattern soon!
-
The template pattern is not used very much.
-
Although the names and order vary from source to source, the format of the descriptive schema can be broadly divided into the following four main sections:
Pattern name: Each pattern has its own name, and the name of the pattern allows us to discuss our design.
Problem: A specific occasion that occurs repeatedly in the design of an object-oriented system that leads us to adopt a pattern.
Solution: The solution to the above problem, which gives the various components of the design, how they relate to each other, the division of responsibilities, and how they work together.
Consequence: The impact of adopting this pattern on other parts of the software system, such as the impact on the scalability and portability of the system. Influences also include negative effects.
Also known as: A pattern can have more than one name. These names should be noted in this section.
Motivation: The model should be used in the context of which it is the responsibility of the scenarios provided in this section, including the problem and the context.
Structure: This part of the commonly used class diagram and mutual ** illustrates this pattern.
participants: This section provides a list of the classes and objects used in this pattern, and the roles they play in the design.
Collaboration: Describes the interaction between classes and objects in this mode.
Consequences: This section should describe the results, trade-off, and trade-off after using this pattern
Implementaion: This section should describe the implementation of the pattern, some of the scenarios for the pattern, possible techniques for implementing the pattern, or proposed ways to implement the pattern.
Sample code: A sample code.
Known Uses: Examples of practices known to the industry.
First of all, photoshop is the first software, suitable for design that does not involve printing, such as web design, software interface design, processing color grading, etc., the support for printing is limited to bitmaps, and printing often involves vector elements, such as text, logo, etc. (of course, text and logo can also be added to the bitmap in photoshop, but the bitmap and vector printing effect is biased, you may have to ask, then why not convert all the elements to be printed into vectors, such as characters or landscapes.) Yes, okay, it's best to do this, if you don't consider the workload, turn a character ** into a loss, and the best designer may have to complete it for dozens of days, so it is enough to convert text or logo into vector, like most of the mobile phones on the mobile phone box, which looks better than the effect of the photo, but that may take more time and energy from the designer. ), so use CorelDraw, Illustrator to add vector elements to the printed art. >>>More
Both are equally important, 3D to make the effect, most of them need to be modified and polished with Photoshop, so the effect is better. Once you have both mastered, the work you make will be closer to your ideas.
1. Which is better for plastic mold design and software development varies from person to person, which is related to the individual's ability. >>>More