Create a model

xiaoxiao2021-03-06  83

The first time I wrote a technical article on Blog, I hope I can stick to it.

Overall, create a model, which is where you don't care, use a class package, such as your cover, you won't care about bricks.

How to get it out, the assembly car doesn't care about how the tires are, it is in line with a certain specification and use it. This regulation is over-inspected, don't worry.

This factory test is similar to the inheritance mechanism of a large number of uses, which ensures that as long as it is inherited to formulate a good specification-base class, it can be used. Otherwise, it can't be compiled.

1. Abstract factory. It is only responsible for giving things that meet the norms. How to assemble these things. For example, when assembling a car, there is a person who is responsible for taking part, is a class pull that is responsible for creating different objects. The mating is said to him, give me four tires, a roof. He is responsible for completing these movements, and the mating is also a tire, and it is good to be equipped. In this way, the BMW is equipped with people responsible for the BMW related accessories; if the assembly is Mercedes-Benz, it will deal with people responsible for Mercedes-Benz.

2. Builder mode. In fact, and abstract factories and similar, but his responsibility is more important, in addition to retrieving different parts, it is also responsible for assembling these parts. For example, when assembling a computer, there is a person responsible for the production of motherboards. If it is an abstract factory model, then you have to ask him to have 100 capacitors, 20 pins, but also have yourself. The Builder mode is pleasant, just say hello to him, buddy, put a motherboard. Then what you see is a motherboard that makes a capacitor and wire. This saves a lot of things, but this has lost the space. This level is to see the specific needs.

3. Prototype mode. In fact, it is to change the abstract factory to Template. The abstract factory is practical BMW tires and Mercedes tires, you need to find different people. That day, the factory funds were tense, and the people who were responsible for taking the BMW tire were retired, and there was one, so it was not enough in accordance with the obstacles. How to do it? Only strengthen its training, let him recognize the Mercedes tires in addition to the Mercedes tires. In this way, the assembly workers on both sides asked him to take a tire, say "give me four tires", this sentence will make him depressed, you must say that I want "Mercedes tire" or "BMW tire" can get itself Want. This kind of benefit is that when it is installed with a car, it is only necessary to train people responsible to the tires, if his mind is easy to use. And no need to ask someone to spend more. However, such a problem is that there is no assembly, you must know what you are doing, in case it is equipped with a BMA to adjust the installation of the Mercedes-Benz, it can't change the mouth, or a "BMW" tire, you will have trouble. . People responsible for removing tires are not responsible. This responsibility is transferred. Each has a thousand autumn, see if it is needed. If you have two cars to be assembled, there is no need for this risk. However, in case of 100 kinds of cars, it will be different, you can save 99 human costs and management costs, very cool.

转载请注明原文地址:https://www.9cbs.com/read-94965.html

New Post(0)