|
所在平台: Udemy |
课程主页: https://www.udemy.com/course/solid-principle-dart-flutter/
课程评论:没有评论
课程名称:SOLID原理 - Dart / Flutter 课程概述: SOLID是罗伯特·C·马丁(也称为Uncle Bob)提出的五个面向对象设计(OOD)原则的首字母缩写。这些原则为软件开发提供了实践指导,使得开发者能够在项目扩展和维护时考虑到代码的可读性和可扩展性。采用这些实践可以帮助避免代码异味、重构代码,并促进敏捷或自适应软件开发。SOLID分别代表: - S - 单一职责原则(Single-responsibility Principle) - O - 开放-关闭原则(Open-closed Principle) - L - 里氏替换原则(Liskov Substitution Principle) - I - 接口隔离原则(Interface Segregation Principle) - D - 依赖倒置原则(Dependency Inversion Principle) 在本课程中,您将逐一了解每个原则如何帮助您成为更出色的开发者。 1. 单一职责原则(SRP):类应该只有一个且唯一一个变更的理由,即类应专注于一项工作。 2. 开放-关闭原则(OCP):对象或实体应对于扩展开放,但对修改关闭。 3. 里氏替换原则(LSP):超类的对象应能够被其子类的对象替换,而不破坏应用程序的正确性。换句话说,子类的对象应表现得与超类对象相同。 4. 接口隔离原则(ISP):不应强迫代码依赖于其不使用的方法。ISP将大型接口拆分为更小、更具体的接口,以便客户只需了解其所感兴趣的方法。 5. 依赖倒置原则:实体必须依赖于抽象,而不是具体实现。高层模块不应依赖于低层模块,两者应依赖于抽象。 通过学习这些原则,您将能够构建更清晰、更易于维护和扩展的软件系统。
SOLID is an acronym for the first five object-oriented design (OOD) principles by Robert C. Martin (also known as Uncle Bob)These principles establish practices that lend to developing software with considerations for maintaining and extending as the project grows. Adopting these practices can also contribute to avoiding code smells, refactoring code, and Agile or Adaptive software development.SOLID stands for:S - Single-responsiblity PrincipleO - Open-closed PrincipleL - Liskov Substitution PrincipleI - Interface Segregation PrincipleD - Dependency Inversion PrincipleIn this course, you will be introduced to each principle individually to understand how SOLID can help make you a better developer.Single-Responsibility PrincipleSingle-responsibility Principle (SRP) states: class should have one and only one reason to change, meaning that a class should have only one job.Open-Closed PrincipleOpen-closed Principle (OCP) states: Objects or entities should be open for extension but closed for modification.Liskov Substitution PrincipleLiskov Substitution Principle (LSP) states: Objects of a superclass should be replaceable with objects of its subclasses without breaking the application. In other words, what we want is to have the objects of our subclasses behaving the same way as the objects of our superclassInterface segregation principle (ISP) Interface segregation principle (ISP) states: No code should be forced to depend on method it does not use. ISP splits interfaces that are very large into smaller and more specific ones so that clients will only have to know about the methods that are of interest to them. Such shrunken interfaces are also called role interfaces.ISP is intended to keep a system decoupled and thus easier to refactor, change, and redeploy.Dependency Inversion PrincipleDependency inversion principle states: Entities must depend on abstractions, not on concretions. It states that the high-level module must not depend on the low-level module, but they should depend on abstractions.