面向对象编程OOP的优点
2023-07-06
1. Simplicity: software objects model real world objects, so the complexity is reduced and the program structure is very clear;
简单性: 因为面向对象语言里面的对象都是反映的真实世界的对象,所以复杂性就降低了而且程序结构也更加清晰;
2. Modularity: each object forms a separate entity whose internal workings are decoupled from other parts of the system;
模块性: 每一个对象都来源于一个单独的实体, 它内部的工作与系统的其他部分是分离的
3. Modifiability: it is easy to make minor changes in the data representation or the procedures in an OO program. Changes inside a class do not affect any other part of a program, since the only public interface that the external world has to a class is through the use of methods;
易修改性: 在面向对象程序中对数据表现层和工作过程进行小的改动是非常简单的, 类内部的改动不会影响程序的其他部分,因为外边的程序与这个类的交互是通过一个公开的接口方法进行的。只要这个方法不改动就不会影响交互。
4. Extensibility: adding new features or responding to changing operating environments can be solved by introducing a few new objects and modifying some existing ones;
可扩展性:在面向对象程序里面,添加新的功能只需要引入新的对象或者修改一下现存的对象。
5. Maintainability: objects can be maintained separately, making locating and fixing problems easier;
可维护性: 对象可以进行分别维护, 这样就使查找问题和修复问题变得简单了
6. Re-usability: objects can be reused in different programs
重用性:对象可以在不同的程序里面重用