"Object-oriented Sunflower Treasure Book" is a netizen love technology of a technical column of the article, I read by article, the biggest feeling is that the object-oriented programming series is genuine from the technical front-line engineer experience, is the author's work experience summary and sublimation, It is instructive to all aspects of programming, which are 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 personal reading, based on the collation of reading notes Xmind, I personally think that there is a special value or I have a more emotional knowledge points, recorded as follows, so that they can be read at any time.
Object-Oriented Overview
Object-oriented theory
"How do I define a class?" "As long as there are similarities is the same class"!
angle of view! How to divide a class: standing in your observation angle, things with similar points are the same class!
Nouns are attributes, verbs are methods.
a basic principle of design attributes: attribute minimization principle, that is: "Attribute cannot be divided"!
Object
The instance of the class.
Real Object--inductive summary--real class--abstract simulation--software--instance--software object--active interaction---Program
"The software class originates from the real class, but above the real class": The real class must have the correspondence in the software class, but is not exactly one by one correspondence; The software class is not necessarily a real existence.
Interface
"Interface" is the term that I've seen in the object-oriented realm of abuse, misuse, and misapplication.
An interface is a set of related interaction feature point definitions.
abstract class
abstract class is a special class, its particularity is that abstract classes can only be used for inheritance, Cannot be instantiated
What is the difference between an abstract class and an interface, why is there an interface, and an abstract class?
- abstract class essentially or class , emphasizing the similarity of a set of things, including the similarity of attributes and methods, whereas interfaces only emphasize the similarity of methods and only the similarity on the method declaration, and there is no similarity on the method definition. (Code reuse)
Abstract
"Pull out the part that looks more like"
Abstract detailed meaning: extracts multiple objects or parts of a class that are more similar.
"Property is similar"
"Behave like"
Abstract role: Abstract The most important role is "classification", and the main purpose of classification is actually "isolate concerns, reduce complexity." Because the world is too complex to be complex enough for one person to focus on everything at the same time. Psychological research confirms that people can focus on not more than 7+/-2. As you can imagine, if there is no abstract classification, we will face a chaotic world, while focusing on so much content, even genius, the estimate will collapse.
Three core features
Packaging
"Privacy protection"
"Isolation Complexity"
Inherited
Inherit similar biological "heredity", "Dragon born Dragon, chicken born chicken, mouse is born to make hole"
Object-oriented inheritance means that "subclasses" inherit the properties and methods of some "parent" classes.
Abstraction: is an action in the process of analysis and design, a skill, derived from the class by abstraction
Inheritance: is an action in the implementation process, based on abstract results, through the characteristics of programming language, to complete the simulation of abstract diagram.
Polymorphic
"Multi-Fetal", polymorphic morphology can only be limited to the number of subclasses, that is, the number of "fetal"
The characteristics of polymorphism play an important role in the field of object-oriented programming. Polymorphism masks the differences of subclass objects, allowing callers to write out common code without having to write different code for each subclass.
Read the book "Object-oriented sunflower Treasure" Reading notes-object-oriented Foundation