How to Treat design patterns correctly-my point of view

Source: Internet
Author: User

Since I came into contact with the design model, the comments I have seen are generally highly respected. But I'm glad that two people recently read "programming life" are not very concerned about the design model.
It's not just about watching them attack each other and criticize each other. It's about different ideas, especially those of two very important figures. In the field of technology, the word "Public Mouth" is a terrible thing. We are happy to see it.The emergence of different ideas, especially different masters, can promote more people to think and explore independently..
Now, return to the topic. In programming life, at least two people in programming Life talked about design patterns.
Jamie zawinski: the famous lisp hacker, the core developer of Netscape Browser and Mozilla Browser. When talking aboutProgramThe clerk said:
"There is also a book called" design pattern ", which is sought after by everyone and regarded as a standard. However, in my opinion, this book seems like programming can be done simply by cutting and pasting it. You don't have to consider all the tasks you need to do. You just need to look at this recipe book and find a similar pattern to apply it directly. It's not programming at all. It's a coloring book. However, it seems that many people are obsessed with this book ."
Brendan eich, father of JavaScript, Mozilla cto, said when talking about things intended for programming but not done:
"I am not a fan of object-oriented and design patterns. I have never bought a gamma book (design patterns). Some people from Netscape buy it. Those from Jamie zawinski or those from companies acquired by Netscape will buy it. They put this book as a Bible, which is a little unbearable, they are not the best programmers at all."

As for what is a design model, what are the advantages of it? I will not talk about it today. I would like to give an example for comparison. We all know that the design model originates from the construction field, and the construction field may be too far away from us. Today I want to compare it with basketball.

In addition to body training and shooting training, basketball players also perform coherent motion training and tactical cooperation training to improve their basketball skills. For example, for example, cross steps, sudden jump stops, turning around, and blocking. Where did these training come from? When basketball was just born, it was definitely not. In the course of basketball, athletes find that in a certain situation (that is, the positions of the defender and team members ), using a similar coherent action can often achieve very good results. Therefore, a very savvy person sums up the constraints and actions to be taken, so that the athletes can perform repeated training during training to form a conditioned reflection, use these consistent actions quickly and effectively when appropriate opportunities arise.

I think this is also the origin of the model. The difference is that,The process of learning the design model is a process of thinking training..

In fact, the above analysis is also applicable to martial arts. The martial arts fans may remember the complicated tricks described by Jin Yong (in fact, they are also models ). However, Jin Yong also mentioned a higher realm:"No action, no action". In the impression, Zhang Wuji learned Taijiquan and Ling huchong learned the unique nine swords. They are really amazing after learning it. It's no wonder that Jamie zawinski and Brendan eich will oppose some patterns. Maybe they have learned the true meaning of no tricks and tricks.

Do we need to discard all models? However, I think it may not be suitable for all people. It depends on human accomplishments, talent, and savvy. Many of us may still have a very effective way to improve and conduct some model training.

So many times,Summary:

    1. For beginners, the mode is a good thing, and learning some modes is an effective way to improve.
    2. Do not over-use the design pattern. It will bring extra complexity to you. In my eyes, simplicity is the first factor in a technical solution. Do you know what is the core of Bruce Lee's cut? Aside from moves, we can launch the most effective attack and defense.
      Do not treat it as a silver bullet or the Holy Grail.
    3. When you have accumulated a certain amount of experience, you can also try the realm of "No tricks, no tricks, no tricks.

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.