继承和接口的关系,可以从几个主要角度理解:
1、在方向上,继承接近于竖向的抽象,而接口更接近于横向的抽象。
2、从功能上,继承较多应用于领域模型,而接口多倾向于“工具性”使用,即领域中通性部分。
3、从产品上,继承多应用实际应用类,而接口更倾向于通用底层,一般不对开发人员暴露。
4、从功能上,继承可以看成是主干,而接口属于分支,使模型更充实和丰富。
小结,在抽象维度上,接口与继承一个不能少,而接口会使模型最优化,所以要特别认真对待--其实在建模一开始,就要对继承与接口统一考虑:继承与接口不对立而是统一的关系。这也是我个人认为极限抽象为什么不好的原因。
后记,coding的目的,在于以一种可显化的方式(如函数、类)来交流“约定的符号”(如变量),并形成制式(即模式)。
而对于接口,接口的定义,首先最重要的是:接口不能拥有实例,只能实现。而容器(container)是重要的识别(identity)组成。而容器的本质是命令在外。IoC是SoS(system of system),它的本质是结构控制数据,而非数据掌握结构;是人(我们)来控制系统,绝非系统控制人(我们)。(further more,make manufacturing-functioning included, indepdent from consuming,or provider-consumer pattern called.)
分享到:
相关推荐
在Alura的"Alura_inheritance_Interface"课程中,你可能会学习到如何使用继承和接口来构建真实世界的示例,例如创建不同类型的交通工具,其中每种交通工具都可能有共同的行为(如移动、停止等),但具体的实现方式因...
2. **继承(Inheritance)**: 如果类继承自其他类,我们可以使用冒号(`:`)后面跟着父类的名称,如`@interface MyCustomClass : NSObject`,表示`MyCustomClass`继承自`NSObject`。 3. **属性(Properties)**: 使用`...
5. **接口(Interface)**:在某些编程语言中,如Java,接口是另一种形式的继承,它只包含方法签名,没有方法实现。类可以实现多个接口,以达到多重继承的效果。 在实际编程中,继承的应用场景多种多样,例如: - ...
Class inheritance diagram Direct Subclasses All Known Subinterfaces All Known Implementing Classes Class/interface declaration Class/interface description Nested Class Summary Field Summary ...
本网络研讨会——"webinario-heranca-vs-interface"——深入探讨了这两个主题,旨在帮助开发者理解它们的工作原理以及在实际开发中的应用。 首先,让我们来看看继承(Inheritance)。继承是面向对象编程的一个关键...
在IT领域,尤其是在面向对象编程(Object-Oriented Programming,OOP)中,继承(Inheritance)是一项核心概念,它允许一个类(称为子类或派生类)继承另一个类(称为父类或基类)的特性与行为。C#作为一种广泛使用...
此外,“继承”(Inheritance)在这里也发挥了关键作用。虽然描述中没有明确提及,但可以推测"Employee"和"Invoice"可能从某个共同的基类继承,或者直接从`Object`类继承,然后实现`Payable`接口。继承使得类能够从...
- 类型继承(Type Inheritance):创建具有父类共享属性和方法的特殊类。子类可以增加自己的属性和方法,但不会重复父类的接口。 - 实例化(Instantiation):一个类的对象通过其方法创建另一个类的对象,例如,...
在给定的项目"Inheritance-Polymorphism_OOP"中,可能包含了一个或多个示例,演示了如何在Java中利用继承和多态来构建应用程序。report.pdf文件很可能是对这些概念的详细解释和项目实现的说明。通过阅读这份报告,...
**Answer**: A legacy API (Application Programming Interface) is an interface that was designed for an older version of a system or application and is no longer actively maintained or updated....
Object-Oriented Programming: Inheritance and Polymorphism. 9. Operator Overloading. 10. Graphical User Interface Components: Part 1. 11. Graphical User Interface Components: Part 2. 12. Exception...
- 接口(interface)是一种完全抽象的类型,仅包含常量和抽象方法。一个类可以实现多个接口,但只能继承一个类。 7. **继承的应用场景**: - 表示“is-a”关系,如:“狗是动物”(Dog is an Animal)。 - 共享...
标题 "w12d1_inheritance_java_lab" 暗示了这是一个关于Java编程语言的教育项目,专注于类的继承这一主题。在这个实验室练习中,学生或开发者将深入理解Java中的面向对象编程概念,特别是如何通过继承来创建类的层次...
The Daikon Forge GUI Library (DF-GUI™) is a user interface library for Unity that provides a very flexible and powerful way to create the user interface for your games. It includes a useful list of ...
2. **Interface vs Abstract Class** - **Abstract Class** 可以包含方法体内的代码,而**Interface** 不允许。抽象类中定义的方法默认为抽象方法,需要子类去实现。Java不支持多重继承,所以一个类只能继承一个...
YaViewDelegate: Composition over inheritance compile 'com.github.piasy:YaMvp:1.3.1' YaMvp-Rx RxJava Subscription management. compile 'com.github.piasy:YaMvp-Rx:1.3.1' YaRxDelegate: Comp
21.5 A USER INTERFACE FOR UNDOING AND REDOING 711 21.6 DISCUSSION 712 21.7 BIBLIOGRAPHICAL NOTES 715 EXERCISES 715 Chapter 22: How to find the classes 719 22.1 STUDYING A REQUIREMENTS DOCUMENT 720 ...
As a Class Browser it shows classes (inheritance) and members (fields, methods, properties) in two filtered views, similar to the windows explorer. On the left the Explorer docked in the IDE editor. ...
As a Class Browser it shows classes (inheritance) and members (fields, methods, properties) in two filtered views, similar to the windows explorer. On the left the Explorer docked in the IDE editor. ...
You will learn all the technical Java programming language such as Loops and Arrays, Boolean Logic, Methods, Inheritance and Polymorphism, Algorithms, etc. You will get a chance to apply what you ...