Highlights of design patterns (I) and highlights of design patterns

Source: Internet
Author: User

Highlights of design patterns (I) and highlights of design patterns

The main document of the design pattern is "big talk Design Pattern". In the first stage, we will first look at the basic concepts of various patterns to implement examples under each pattern. Then, you can learn and understand the benefits of various modes and know that a certain mode is suitable for that State. Now, the examples have been basically implemented. Although I followed the examples in the book, I still encountered many problems.

Question 1: interface problems

When I typed the factory method model in chapter 8, I encountered the following problems:


This problem has never been encountered before. I don't know where to start, and I haven't found any error after carefully comparing the code. I had to ask someone for advice. After the prompt, I wrote the interface directly in program. in cs, an error is always reported. The modification method is to re-Add the following interface to the control window of the interface.

Chapter 8_factory method mode {interface ifacloud {LeiFeng CreateLeiFeng ();}}
Think about this error, but I am not very familiar with the code writing process. It is best for the interface class to write it in its interface console location, so as to keep the interface beautiful, it is easy to find related items.


Question 2: metadata sharing

When I saw this prompt, I found Hashtabel in the Code. At first, I thought I did not write the Hashtable part of the code, but I didn't have this part in the example; then I found the relevant information on the Internet and learned that this indicates a hash table. To tell the truth, I really don't quite understand what I want to do. But when I look at this process, in the namespace, there are using System. collections; this section of code, and then add this sentence in your own code, the problem is solved.

Continue to find out the specific cause: In. NET work, Hashtable is a container provided by the System. Collections namespace for processing and displaying key-value pairs similar to key. This gives me some understanding of it, And I carefully compare my code, and found that I have been reading an electronic version, and this Part does not use the code, but the book prompts us to add it. So in the future, we must pay attention to the combination of the two. We cannot completely believe in one thing. Nothing is correct.


Question 3: Interpreter Mode

It can be said that this part is the biggest problem you have encountered. It has been called many times, and the code still cannot run many times. It always prompts that the object has not been referenced.


This was really an emergency. Later I had to ask for help again. After a long time, I found the problem, which was a common problem.


The quotation marks shown in the figure must contain a space. Otherwise, the above error is prompted. Then I think that I have encountered the same problem in both the student information management system and the data room charging system. It seems that, regardless of the language, there are many areas that are common, and we need to carefully write and debug them.


We still need to continue to work hard on this part of learning. In many places, we are still stuck on the surface, and we need to continue in-depth understanding and research. No matter how many times we have done it, there will always be problems, but we need to have an unyielding heart. I believe that no matter what problems we encounter, we will certainly be able to solve them.

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.