关于dependency inversion principle的理解
来源:互联网 发布:iphone隐形监控软件 编辑:程序博客网 时间:2024/06/13 01:01
首先讲了这个原则的目的是为了 decouple objects in an application by inverting 反向 certain dependencies between them.
这个原则的应用可以使代码更 robust and maintainable.
The dependency inversion principle states that:
1. High-level objects should not depend on low-level objects. Both should depend on abstractions.
2. Abstractions should not depend on details. Details should depend on abstractions.
另外在 ios-programming-the-big-nerd-ranch-christian-keur 第六版 第十章 P185 中提到的 在Homepwner这个应用当中,针对上述提到的DIP中的高层模块和底层模块分别对应于
A store is a lower-level object that retrives 检索 and save Item instances through details that are only known to that class.
ItemsViewControlleris a higher-level object that only knows that it will be provided with a utility object (the store) from which it can obtain a list
of Iteminstances and to which it can pass new or updatedItem instances to be stored persistently 持久的.
This results in a decoupling becauseItemsViewControlleris not dependent onItemStore. In fact, as long as the store abstraction is
respected,ItemStore could be replaced by another object that fetches 获取 Iteminstances differently (such as by using a web service)
without any changes to ItemsViewController.
文末还提到了另外一种实现 dependency inversion principle的 a common pattern 叫做: dependency injection
... 之后再了解!
- 关于dependency inversion principle的理解
- DIP Dependency Inversion Principle
- The Dependency Inversion Principle
- The Dependency Inversion Principle(翻译)
- 依赖倒转原则(The Dependency Inversion Principle)
- DIP简介(DIP--Dependency Inversion Principle)
- 依赖倒转原则(Dependency Inversion Principle)
- 依赖倒转原则(Dependency Inversion Principle)
- Dependency Inversion Principle 依赖反转原则
- 依赖倒置原则 (Dependency Inversion Principle)
- OO设计原则 -- Dependency Inversion Principle:OO设计的 DIP依赖倒置原则
- OO设计原则 -- Dependency Inversion Principle:OO设计的 DIP依赖倒置原则
- OO设计原则 -- Dependency Inversion Principle:OO设计的 DIP依赖倒置原则
- A curry of Dependency Inversion Principle (DIP), Inversion of Control (IoC), Dependency Injection (D
- 依赖倒转原则 (Dependency Inversion Principle, DIP)
- 依赖倒转原则(Dependency Inversion Principle,DIP)
- 依赖倒置原则(DIP - Dependency Inversion Principle)
- 依赖反转(Dependency inversion principle)和控制反转(Inversion of Control)
- CentOS6.5下Redis安装与配置
- C++ 通过 JNI 调用 Java 代码
- 机器学习基石 5.1 Recap and Preview
- 工厂方法模式的java实现例子
- HDU5862-Counting Intersections
- 关于dependency inversion principle的理解
- ROS学习笔记-------Message_filters
- 解决二维数组取值的问题
- mysql
- Foreign Exchange
- PAT B1061. 判断题
- android自定义控件,动态设置Button的样式
- grpc-整合gradle与代码生成
- 萌新的linux之旅2