What is a design pattern?
If a problem arises over and over again, you must find a way to effectively solve the problem. The method is described as a pattern. Design patterns are independent of programming languages and are used to solve common, object-oriented design problems. When you implement a design, you should know the names of some common solutions. Familiarity with design patterns enables people to communicate effectively with each other. In fact, you may already be familiar with some design patterns, and you just don't describe them in terms of the familiar names. Sun recommends the use of Gof ("gang", which refers to the four pioneers of the book "Design patterns-reusable elements of object-oriented software"), so we use that book as a guide to describe the solution. You also need to familiarize yourself with these terms and see how others use them to solve programming problems.
Are you sure you want to use design mode?
If you want to be a Java professional programmer, you should at least know some popular ways to solve coding problems. These methods have been proven to be very effective by experienced programmers in practice. They are the so-called design patterns. Learning Design patterns can accelerate your experience in the Ooa/ood field. Once you have mastered them, you will benefit for life and become a master in the design and development arena. Also, you can use these terms to communicate more effectively with your peers.
Many programmers with years of experience don't know about design patterns, but as an OO programmer, you have to be familiar with them, especially to those who are learning java. In fact, when you solve a programming problem, you are already using design patterns. You just don't call them in popular terms, or you don't choose an effective way to better control your results from an intellectual property perspective. Learning how experienced developers can solve programming problems and apply them to your own projects is the best way to gain experience and proof.
Remember, learning design patterns will certainly change the way you program; you're not just going to be wise, you're going to be very wise.
How many design patterns are there?
Many. A web site says there are at least 250 patterns in oo, including "spaghetti" (which means poor code). The 23 design patterns used by GOF are well known, and many patterns are still being explored and discovered.
By the way, a reminder that the design pattern is not a term, an algorithm, or a component.
The interrelationship between design patterns
Generally speaking, building a system requires many design patterns to be organized together. Different designers may use different patterns to solve the same problem. Generally speaking:
Some patterns get along with each other harmoniously
One pattern can throw out another pattern
Some patterns are very similar and can be substituted for each other
Patterns can be found and documented
Pattern is not a method or schema
Patterns can provide some useful tips for solving problems
Create a sexual pattern
Abstraction Factory (abstract Factory) definition
Provides a higher level of interface than Factory mode (Factory pattern). It is generally used to return a factory in a number of factories.
When to use and benefits
Create family-related objects that are interconnected and dependent, such as kit
Provides a class library of products, external interface, not implementation details
Isolate specific classes from their parent classes
A system needs to be independent of the creation, composition, and expression of its products
A restriction needs to be enforced
Another option outside of the surface that can be used to hide platform-related classes
can easily be inherited from a system and family
The design patterns associated with this include,
Factory methods (Factory method), usually implemented in an abstract factory
Single case (Singleton), usually implemented using abstract factory methods
Prototypes (Prototype), usually implemented using abstract factory methods
Appearance (façade), usually used with abstract factories, to provide an interface to create an implementation class