Object-Oriented Design Patterns and principles (Miscellaneous 1)

Source: Internet
Author: User
  1. The solution is the organizational relationship between classes and mutual objects, including their roles, responsibilities, and collaboration methods.
  2. "Good Object-Oriented Design Patterns" are those that can meet "respond to changes and improve reuse"
  3. The object-oriented design pattern Describes software design.
  4. The object-oriented mode is not likeAlgorithmSkills can be copied and used. It is an empirical understanding of "Object-Oriented" based on a sophisticated and in-depth understanding ".
  5. Source codeIs the designProgramThe member's programming work is also regarded as software design, and the design mode is derived from the constant reconstruction, not the rigid installation,
  6. Three object-oriented mechanisms

    -Encapsulation to hide internal implementations

    -Inherit and reuse existingCode

    -Polymorphism: rewrite object behavior

  7. Through object-orientedProgramming Language(Oopl) recognized object-oriented, not all of them, or even a simple object-oriented
  8. Why should we use object-oriented? How should we use three mechanisms to achieve "Good Object-Oriented "? What kind of object-oriented principles should we follow?
  9. The object-oriented knowledge obtained from programming languages alone is not competent for object-oriented design and development and requires systematic learning of Object-Oriented Knowledge.
  10. What is an object?

    -At the conceptual level, an object is an abstract with certain responsibilities.

    -On the specification layer, an object is a series of interfaces that can be used by other objects.

    -At the language implementation level, the object encapsulates code and data.

  11. How can we design "good object-oriented"

    -Follow certain object-oriented design principles

    -Familiar with some typical Object-Oriented Design Patterns

  12. From design principles to design patterns

    Interface Programming, rather than implementation programming-- The customer does not need to know the specific type of the object in use, but only needs to know that the object has the interface the customer expects.

    Object combination is preferred, rather than class inheritance-- Class inheritance is usually "white box reuse", and the object combination is usually "black box reuse ". Inheritance damages encapsulation to some extent, and the Child class parent class has a high Coupling Degree. Object combination only requires that the combined object has a well-defined interface, and the coupling degree is low.

    Encapsulation change point --The encapsulation is used to create the demarcation layer between objects, so that the designer can modify the interface on one side of the demarcation layer without adversely affecting the other side, so as to implement loose coupling between layers.

    Use refactoring to get the model-the application in design mode should not be preemptible..
    The design pattern is the biggest misuse of the design pattern. There is no one-step design model. Agility
    The "refactoring to patterns" advocated by software development practices is currently widely recognized as the best
    Use the design mode.

  13. Design Principles

    single responsibility principle (SRP): A class should have only one reason for its change.
    OCP principle: class modules should be extensible, but cannot be modified (open to extensions and closed to changes)
    liskov replacement principle (LSP): subclasses must be able to replace their base classes.
    Dependency inversion principle (DIP ): high-level modules should not depend on low-level modules, both of which should depend on abstraction. -Abstraction should not depend on implementation details, but on abstraction.
    interface isolation principle (ISP): customer programs should not be forced to rely on methods they do not need

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.