Teach you how to create a keyword matching project (search engine) ---- 14th days

Source: Internet
Author: User

14th days

Start Point:

1. Teach you how to create a keyword matching project (search engine) ---- Day 1

Review:

13. Teach you how to create a keyword matching project (search engine) ---- 13th days

After receiving the code from the boss, Shuai looks a little difficult and does not know what design mode is used.

Shuai is also very smart. when reading the design model book, he is only interested in diagrams. In addition, he understands UML in the past, so he decided to convert the code into a graph.

So Shuai spent a long time finally converting the code of the boss into a design drawing. The design drawing is as follows:

When he completed these figures for the first time, he also learned about the concepts of association, dependency, and inheritance.

 

 Inheritance

A class (called a subclass or sub-interface) inherits the functions of another class (called parent class or parent interface) and can add its own new functions, inheritance is the most common relationship between classes or interfaces;

Dependency

It can be simply understood that a class A uses another class B, and this relationship is contingent, temporary, and very weak, however, changes in Class B will affect;

Association

It represents a strong dependency between two classes or between classes and interfaces, such as my friends and I; this relationship is more dependent than the dependency relationship, with no dependency relationship. The relationship is not temporary and is generally long-term. In addition, the relationship between the two parties is generally equal, and the relationship can be one-way and two-way;

 

Shuai compared the figure with the design pattern. How does he feel like a factory pattern .....

Shuai found the boss with a figure. He was excited and said, "Yu Boss, this is the class chart I sorted out from your code. I also know that the factory model is used.

After listening to the boss, he felt that he was good and diligent, and he was satisfied with him. (What would happen if the boss knows that Shuai is compared with the figure ...)

After the boss praised the handsome boy, he said to the handsome boy: How can I add an old-age outfit?

Shuai looked at the figure and said with pleasure and confidence: Write a class and inherit charlisthandle to implement the exec method.

Yu laoda said with a sigh of relief: It's better to write it. Write it and read it!

 

Factory mode: instantiate an object and use the factory method instead of the new operation. Factory models are divided into simple factory models, factory method models, and abstract factory models.

 

Shuai is very happy and feels that he is not far from success.

Shuai started to write the tasks assigned by the boss.

 

Teach you how to create a keyword matching project (search engine) ---- 14th days

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.