Reading Notes from the book "Object-Oriented sunflower Collection"-object-oriented basics, sunflower collection
The object-oriented sunflower collection is a netizenHuatai TechnologyOne of the articles in the technical column I read one by one, the biggest feeling is that this Object-Oriented Programming series is a real experience from technical frontline engineers, is the author's work experience summary and sublimation, for all aspects of programming-oriented guidance, here strongly recommended to the Object-Oriented field of friends, the original link is as follows: http://blog.csdn.net/column/details/oobaodian.html
The following is a collection of Reading Notes made based on xMind. I will record the knowledge points that I personally think are particularly valuable or have feelings for me, as shown below, so that I can read them at any time.
Object-oriented Overview
Object-oriented Theory
Class
Class is the collective name of a group of similar things.
"How to define a class"? "As long as there are similarities in the same class"!
Views are determined! How to classify: From your perspective, things with similarities are the same!
A noun is an attribute and a verb is a method.
A basic principle for designing attributes: Minimum attribute principle, that is, "attributes cannot be divided "!
A basic principle of the design method: the principle of single method, that is, one method only does one thing!
Object
Class.
Real Object> generalization> reality> Abstract Simulation> Software> instantiation> Software Object> activity interaction> Program
"The software class comes from the reality class, but higher than the reality class": the reality class must correspond in the software class, but not exactly one-to-one; the software class is not necessarily a reality.
Interface
"Interface" is a term that I have seen most abuse, misuse, and misuse in the Object-Oriented field.
An interface is a set of related interaction function points.
Abstract class
Abstract classes are special classes. They can only be used for inheritance and cannot be instantiated.
What is the difference between an abstract class and an interface? Why is there an interface and an abstract class?
- Abstract classes are essentially classes that emphasize the similarity of a group of things, including the similarity between attributes and Methods. interfaces only emphasize the similarity of methods and only reflect the similarity of method declarations, there is no way to define similarity. (Code reuse)
Abstraction
"Extract the image part"
Abstract: extract the image of multiple objects or classes.
"Similar property"
"Similar behavior"
Abstract: The main role of abstraction is "classification". The main purpose of classification is to "isolate concerns and reduce complexity ". Because the world is too complicated, it is so complicated that a person cannot pay attention to all the content at the same time. Psychological research confirms that there are no more than 7 +/-2 transactions that people can focus on at the same time. As you can imagine, without abstract classification, we will face a chaotic world and pay attention to so much content, even if it is a genius, it is estimated that it will crash.
Three core features
Encapsulation
"Privacy Protection"
"Isolation complexity"
Inheritance
Inherit from the "genetic" similar to biology, "Dragon growth dragon, Feng Sheng Feng, and mice will be born to holes"
Object-oriented Inheritance means that "subclass" inherits some "parent class" attributes and methods.
Abstract: It is an action in the process of analysis and design. It is a skill to abstract the class.
Inheritance: it is an action in the implementation process. Based on the abstract results, the simulation of abstract graphs is completed through the characteristics of programming languages.
Polymorphism
"Multiple births" can only be confined to the number of child classes, that is, the number of births.
Polymorphism plays an important role in the field of object-oriented programming. Polymorphism shields the differences between subclass objects so that callers can write universal code without having to write different code for each subclass.