"JavaScript Design Patterns and Development Practices" --- (Single Responsibility Principle)

The book I read is called "JavaScript Design Patterns and Development Practice"

  First, plan the order of reading the book. I have already browsed the basic knowledge roughly, and I have not left any notes. I will make up for it when I have time. I was going to follow along. But I feel like it's going to be difficult for me to finish the second part in a short period of time. I decided to go through Part 3 first - Design Principles and Programming Tips. Here is a brief description. Discuss in detail later.

1. The principle of single responsibility.

  Why was this principle derived? It is to deal with the endless changes of products and planning, which is also the most troublesome problem for programmers. ---- Digression

  But also fully appreciate the convenience of the single responsibility principle.

  Definition: The responsibility of the Single Responsibility Principle (SRP) is defined as "the cause of change".

  Incarnation: An object (method) does only one thing.

  Application mode: proxy mode, iterator mode, singleton mode, decorator mode, etc.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324833459&siteId=291194637