Alibabacloud.com offers a wide variety of articles about interface or abstract class, easily find your interface or abstract class information here online.
Adapter mode Adapter): Converts an interface of a class to another interface that the customer wants. The A d a p t e r mode makes those classes that cannot work together due to interface incompatibility work together.
Applicable scenarios:
1.
Dependency inversion principle (dependence inversion Principle) dependency inversion principle (DIP)Basic ConceptsOriginal Definition
High-level modules should not rely on low-layer modules, both should rely on their abstraction
In the past, I have not been able to distinguish between abstract classes and interfaces, of course, the syntax of the difference between the syntax we all understand, but in the real use of the time, you can be sure to use the interface or abstract
pattern Question: how can you easily and conveniently construct object instances without worrying about the details and complex process of constructing object instances?Solution: Build a factory to create objects.Realize: , Introduction 1)
ArticleDirectory
Problem cause
What is the Dependency inversion principle?
Three dependency implementation methods
Advantages
Summary
Design Pattern Series
Six principles of design model (1): single Responsibility
Disclaimer: The content of this article is from the network of books collated, not original.Defined
The most authentic definition:
If for each object O1 of type S There are an object O2 of type T such so for all programs P
I. Principle of single responsibilitySingle Responsibility Principle, abbreviated as SRP.Definition: There should never is more than one reason for a class-to-change.There should be and only one cause for class changes.Division of duties? A single
Design Patterns-six principles
1. Principle of Single-stick responsibility (SRP): For a class, there should be only one reason for his change.
If a class assumes too many responsibilities, it is equivalent to coupling these accusations. A
I. Definition
Observer mode, also known as Publish and subscribe Mode
According to the design pattern, this pattern is defined as a one-to-many relationship, allowing multiple observer objects to listen to a topic object at the same time, when the
11.2 overview of combined modes
For a tree structure, when a method of a container object (such as a folder) is called, the entire tree structure is traversed to find a member object that also contains this method (which can be a container object,
Definition:Encapsulate some operations that act on each element in a data structure. It can define new operations that act on these elements without changing the data structure.
Type:Behavior mode
Class diagram:
The visitor pattern may be the most
Solved problems:
Use a prototype instance to specify the type of the object to be created, and copy the prototype to create a new object. In fact, this function is consistent with the c ++ copy constructor. In fact, it is to dynamically extract the
Concept
Provides an interface for creating a series of related or related dependent objects without specifying their specific classes. That is to say, we often learn how to create a series of dependent objects, however, due to changes in
2. Richter Replacement principle:LSP(Liskov Substitution Principle) richter substitution principle, defined as long as the parent class appears where the subclass can appear, and after the subclass is replaced, There is no problem with the program,
To learn Java well, you first need to know the approximate classification of java. We know that since Sun introduced Java, we have tried to make it all-encompassing, so Java developed to now, according to the application to divide into three main
Object-oriented design has a point that everyone has basically formed a consensus, that is, interface programming, I think most people on this is nothing to suspect.
The question is how we embody it in the actual project development. Does it mean
Java Key knowledgeMultithreading (thread state, thread concurrency, the difference between synchronized and lock and the underlying principle, commonly used locks and their usage scenarios and principles,How volatile and threadlocal solve problems,
Inner class:Overview: There is also a class inside the class, inside that class called Inner class, outside that class is called external class. Classification:member Inner class: The inner class that is defined at the member location.Local inner
Java design mode-Factory modeThe factory model is divided into simple factory, factory method mode and abstract Factory mode. The simple factory as the name implies is the simplest, from a factory to obtain the desired product similar to
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.