Read the book "Object-oriented sunflower Treasure" Reading notes-object-oriented Foundation

Source: Internet
Author: User

"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
  • Prehistoric times: Machine oriented

  • Process oriented

    • Process-oriented is a programming idea centered on "process", in which the meaning of process is "the step of accomplishing one thing"

    • The process is actually a kind of "mechanical thought", it is like the assembly line, a stage to join a phase, each stage has its own input, processing, output, and flow in the pipeline is our raw materials or intermediate products, each stage has a mechanical processing, the final output is our products

    • In applying a process-oriented approach, you also need to design a program pipeline that divides the program into different stages, designs how the phases converge, and then defines the data to be processed at each stage.

  • Object oriented

    • Compared with the process-oriented approach, object-oriented is no longer confined to the machine nature of the computer, but more focused on the real-world simulation.

    • The idea of object-oriented simulation of the real world, which is essentially "human thought", is a qualitative leap, which means that the programmer can observe, analyze and design the system according to People's thoughts.

    • If the process is like a running line, then object-oriented is like a football team. No one is able to specify the exact movement of each player at the beginning of a game, every foot, every pass ... You can only specify the player's role (forward, midfield, defender, goalkeeper), and then the player will respond to the situation. So there are two of the same production lines in the world, but there will never be two matches.

    • In the process, there is a classic summary of "program = algorithm + data structure", and the object-oriented also has a similar summary: "program = object + Interaction".

    • The process has a pipeline of this disadvantage, namely: the process and raw materials are relatively fixed, the expansion is more troublesome. Object-oriented is to solve the process-oriented shortcomings of the birth, so object-oriented is not a complex and mysterious technology, the core of object-oriented thinking is "extensibility"!

    • Since the core of object-oriented thinking is "extensibility", the scope of its application is obvious: the place where the object-oriented application is often changed.

    • Full picture of software properties (cost, performance, reliability, security, maintainability, portability, scalability, scalability)

    • As you can see, "extensibility" is only a small part of the software quality attribute, and other properties are not object-oriented to solve. Understand the object-oriented characteristics and application scope, is the use of object-oriented key, through the previous analysis, we know that the object-oriented is not a Swiss army knife, but just a common hammer, do not take a hammer everywhere knocking!

    • Object-oriented results in degraded performance?

      • From the data we can see, if your business process involved in the disk, network, database and other operations, then the performance has dropped to a millisecond level. Therefore, for complex business systems, performance is determined by the design, not by the language, not because of the use of object-oriented results in performance reduction!
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

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.