Object-oriented design pattern summary 01

The purpose of writing this article is to facilitate memory, and it is published to give some beginners some help. Everyone's understanding may have some deviations. If there is a misunderstanding, please correct me. Modesty does not necessarily mean lack of self-confidence, no one is perfect, and learning is endless. Modesty makes people progress and transmits positive energy.

Object-oriented design pattern is to describe the organizational relationship between "classes" and "objects that communicate with each other" in specific scenarios in the process of object-oriented design.

For ease of reading, the "object-oriented design patterns" described below are referred to as "design patterns" for short.

Why use design patterns?
Software can be developed without design patterns, and it can run normally and perform well. But why use design patterns?
Software is ever-changing, not only from changes in customer needs, but also from technological updates, functional expansion, performance improvements, and so on. In this case, if we do not use design patterns, in the process of software change, the work will become more and more complicated, the code will become more and more difficult to understand, and the whole (change) will become more and more difficult to maintain.


The premise of learning design patterns
1. Object-oriented programming must be understood thoroughly. How to understand thoroughly? Read the book a hundred times and see its meaning.
2. Want to go further in software development.


Analysis of the advantages and disadvantages of using design patterns [limited to personal understanding]
1. Using design patterns may not necessarily improve the performance of the software. If you want to do a small software with a single function, it may be more efficient to write the code directly.
2, may not necessarily reduce the workload. Early in the software life cycle, using design patterns may cost more man-hours.
3. If the design pattern is used improperly, the workload and performance will be greatly affected.
4. Using design patterns can better adapt to software changes and minimize the impact of changes.


When to use design patterns?
1. There are many software changes.
2. Long-term maintenance products and projects.
3. Medium and large software.
4. Try to use design patterns when refactoring. get schema from refactoring

Why use design patterns when refactoring? [Personal opinion only]
1. The workload is the most intuitive. It is necessary to demonstrate which design mode is appropriate to use; a development team will definitely have high and low awareness of a development mode, pre-training, and mid-term guidance. The current market model has high requirements for time, the time limit required by the contract, the initial investment cost, and the competition for the market.
2. Avoid using inappropriate design patterns. There is no one-step design pattern, and inappropriate design patterns are used in the early stage, which will not only have an impact on time, but also have a serious impact on later changes.
3. If the predictability of the software is high and the team is mature, it is not impossible to use appropriate design patterns.


The focus of the software [off-topic]
Internally
1. Appearance, whether the software is good-looking and whether it is comfortable to look at is the most intuitive performance.
2. Interaction, whether the user's use is simple and convenient, and is not prone to misoperation.
3. Performance, the user's use of the software can improve work efficiency, not affect the user's work efficiency.

External
1. The code is easy to understand, the annotations are complete and accurate, and the naming is standardized.
2. The overall structure is easy to understand, relevant documents are complete, and appropriate design patterns are used to achieve low coupling and high cohesion. That is, the elements in the same module should be highly close, but the interdependence between the modules should be less close.
3. The development environment is good, the environment construction, debugging, and testing are convenient, and relatively good third-party controls, plug-ins, frameworks, etc. are used.

Guess you like

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