Reading Notes from the book "Object-Oriented sunflower Collection"-object-oriented basics, sunflower collection

Source: Internet
Author: User

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

  • Process-oriented

    • Process-oriented is a kind of programming thought centered on "process". The meaning of the process is "the steps to accomplish one thing"

    • Process-oriented is actually a kind of "mechanical thinking". Like a pipeline, a stage is connected to a stage. Each stage has its own input, processing, and output, our raw materials or intermediate products flow in the pipeline. Each stage has a mechanical processing mechanism, and the final output is our product.

    • When using process-oriented methods, you also need to design such a program pipeline: divide the program into different stages, and design how each stage is connected, then define the data to be processed in each stage.

  • Object-oriented

    • Compared with process-oriented methods, object-oriented methods are not limited to computer machine nature, but more focused on real-world simulation.

    • The idea of object-oriented simulation of the real world is essentially "human thoughts", which is a qualitative leap, this means that programmers can observe, analyze, and design systems according to their ideas.

    • If the process is like a flow production line, the target is like a football team. At the beginning of a game, no one can accurately specify every running, every exit, and every pass of a player... However, you can only specify the role of a player (striker, midfielder, Defender, and goalkeeper), and then the team members can make their own response based on the situation. So there are two identical production lines in the world, but there will never be two identical matches.

    • The process-oriented typical summary includes "program = Algorithm + Data Structure", and the object-oriented summary is similar: "program = Object + interaction ".

    • The process-oriented pipeline has the following Disadvantages: the process and raw materials are relatively fixed, and expansion is troublesome. Object-oriented is designed to solve this problem. Therefore, object-oriented is not a complex and mysterious technology. The core of Object-oriented thinking is "scalability "!

    • Since the core of Object-oriented thinking is "scalability", its applicability is obvious: What changes frequently is where object-oriented applications are located.

    • Software attributes (cost, performance, reliability, security, maintainability, portability, scalability, and scalability)

    • As you can see, "scalability" is only a small part of the software quality attributes, and other attributes are not designed for Object-Oriented solutions. Understanding the characteristics and applicability of object-oriented is the key to application object-oriented. After the previous analysis, we know that object-oriented is not a Swiss Army knife, but a common hammer, never hold a hammer everywhere!

    • Will object-oriented performance decrease?

      • From the data, we can see that if your business process involves disk, network, database, and other operations, then the performance will suddenly fall to milliseconds. Therefore, for a complex business system, the performance is determined by the design, rather than by the language, rather than the performance reduction caused by the adoption of object-oriented!
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.


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.