“This is my first day in the Gwen Challenge. See Gwen Challenge for more details.”
See nuggets 30 days post even more challenges, want to try their own can stick to a few days in a row, the prize is not important, important to participate? In the next 30 days, I will lead you to study design patterns. I always thought that design patterns were very complicated and rarely used in general programming. After reading carefully, I found how ignorant my previous ideas were. If a programmer wants to improve himself or herself and make himself more valuable, the technical knowledge of code specifications and design patterns also needs to be understood and mastered.
Design patterns are used more or less in everyday development, but they are not always well understood. For example, we often use singleton pattern, factory pattern and so on.
The main author is mainly engaged in C# development, the code in the program uses C# example.
Overview of design patterns
(Abstraction, encapsulation, inheritance, polymorphism) are basic object-oriented (OO) concepts, OO principles are our goal, design patterns are our approach.
There are a total of 23 design patterns, which can be divided into three categories from a large structure, namely, the creation pattern, the structure pattern and the behavior pattern.
Creation pattern
Such patterns are mechanisms for creating objects that improve the flexibility and usability of existing code.
- The factory method
- The abstract factory
- The generator
- The prototype
- The singleton
Structural mode
Describes how to assemble objects and classes into a larger structure while keeping the structure flexible and efficient.
- The adapter
- The bridge
- combination
- decoration
- appearance
- The flyweight
- The agent
Behavior patterns
This type of pattern is responsible for effective communication between objects and delegation of responsibilities.
- Chain of responsibility
- The command
- The iterator
- broker
- The memo
- The observer
- state
- strategy
- Template method
- The visitor
If you only have a hammer, everything looks like a nail. So let’s try to have more than one hammer in our hands.
The most basic, low-level patterns are often referred to as idiomatic techniques, and they can only be used in one programming language.
The most common, high-level patterns are architectural patterns, which can be used in any programming language and, unlike other patterns, can be applied to the architectural design of an entire application.
Small remarks
A person’s struggle, like pregnancy, a long time, will always be seen.
Life is short, I don’t want to go after what I can’t see, I just want to catch what I can see.
I am zai said, thank you for your reading, if it is helpful to you, trouble like, forwarding thank you.