OOP:A new perspective on programming
基本概念
- OOP:Object-oriented programming(面向对象编程)
- POP:Procedure-oriented programming(面向过程编程)
Compare to POP
- POP views program as a series of steps.(POP将程序视为一系列步骤)
- OOP views program as interactions between objects.(OOP将程序视为对象之间的交互)
4 core ideas
Abstraction(抽象)
A high level perspective to focus program overall function not implementation details
一种高层次视角,专注于程序的整体功能而非实现细节
Encapsulation(封装)
A great engineering design thinking to decrease the complexity of overall system, sub system and program by focus call not details.
一种优秀的工程设计思维,通过关注调用而非细节来降低整体系统、子系统和程序的复杂度
Inheritance(继承)
A language function design to enhance code reuse by sub class extend parent class fields and behavior.
一种语言功能设计,通过子类扩展父类的字段和行为来增强代码复用
Polymorphism(多态)
A language function design to implement overload and override to increase the scalability and readability.
一种语言功能设计,实现重载和重写以提高可扩展性和可读性
深度思考
是人类发明了面向对象?还是人类发现了面向对象?