Six Design Principles of Interview Questions

  1. Single Responsibility Principle

    Definition: As far as a class is concerned, there should be only one reason for it to change.

  2. open closed principle

    Definition: Classes, modules, functions, etc. should be extensible, but not modifiable. Two meanings: one is open for extension, and the other is closed for modification.

  3. Liskov Substitution Principle

    Definition: All places that refer to the base class (parent class) must be able to use objects of its subclasses transparently.

  4. Dependency Inversion Principle

    Definition: High-level modules should not depend on low-level modules, both should depend on abstractions. Abstractions should not depend on details, details should depend on abstractions.

  5. Demeter principle

    Definition: A software entity should interact with other entities as little as possible.

  6. Interface Segregation Principle

    Definition: A class's dependence on another class should be based on the smallest interface.

おすすめ

転載: blog.csdn.net/fry3309/article/details/125279713