Object Orientation, Design Principles, Design Patterns, Programming Specifications, and Code Refactoring

object oriented

Because of its rich features (encapsulation, abstraction, inheritance, polymorphism), object-oriented programming can realize many complex design ideas, and is the basis for many design principles, design patterns and other coding implementations.

Design Principles

Design principles are some experience summaries that guide our code design, and have guiding significance for whether a certain design pattern should be applied in certain scenarios. For example, the "open-closed principle" is the guiding principle of many design patterns (strategies, templates, etc.).

Design Patterns

A design pattern is a set of solutions or design ideas summarized for some design problems often encountered in software development. The main purpose of applying design patterns is to improve the scalability of the code. In terms of abstraction, design principles are more abstract than design patterns. Design patterns are more specific and more executable.

programming specification

The programming specification mainly solves the problem of code readability. Compared with design principles and design patterns, coding specifications are more specific, more focused on code details, and more implementable. The theoretical basis for continuous small refactoring dependencies is mainly programming specifications.

Refactoring

Refactoring, as an effective means to keep code quality from falling, uses theories such as object-oriented, design principles, design patterns, and coding standards.

Summarize

In fact, object-oriented, design principles, design patterns, programming specifications, and code refactoring, all five of which are to maintain or improve code quality, are essentially serving the matter of writing high-quality code.
When we chase after the source and see the essence clearly, how to do many things becomes clear.
Whether you should use this design pattern depends on whether you can improve the scalability of the code;
whether you want to refactor it depends on whether the code has readability and maintainability issues.

Guess you like

Origin blog.csdn.net/rd_w_csdn/article/details/115185333