面向过程和面向对象编程之间的差异

面向过程编程:

面向过程编程是基于调用过程的概念从结构化编程发展的编程模式。
过程(Procedures),也称为例程,子例程或函数,
仅包含要执行的一系列步骤,在程序执行期间,过程会被严格按序调用。

面向过程编程中使用的语言:
FORTRAN, ALGOL, COBOL, 
BASIC, Pascal and C. 
面向对象编程:

Object oriented programming can be defined as a programming model which is based upon the concept of objects.
Objects contain data in the form of attributes and code in the form of methods.
In object oriented programming, computer programs are designed using the concept of objects that interact with real world.
Object oriented programming languages are various but the most popular ones are class-based,
meaning that objects are instances of classes, which also determine their types.
面向对象编程可以定义为基于对象概念的编程模型。对象包含属性形式的数据和方法形式的代码。在面向对象的编程中,
计算机程序是使用与现实世界交互的对象的概念来设计的。面向对象的编程语言多种多样,但最流行的是基于类的,
这意味着对象是类的实例,它们也决定了它们的类型。

Languages used in Object Oriented Programming:
Java, C++, C#, Python, 
PHP, JavaScript, Ruby, Perl, 
Objective-C, Dart, Swift, Scala.
Difference between Procedural Programming and Object Oriented Programming:
PROCEDURAL ORIENTED PROGRAMMING OBJECT ORIENTED PROGRAMMING
In procedural programming, program is divided into small parts called functions. In object oriented programming, program is divided into small parts called objects.
Procedural programming follows top down approach. Object oriented programming follows bottom up approach.
There is no access specifier in procedural programming. Object oriented programming have access specifiers like private, public, protected etc.
Adding new data and function is not easy. Adding new data and function is easy.
Procedural programming does not have any proper way for hiding data so it is less secure. Object oriented programming provides data hiding so it is more secure.
In procedural programming, overloading is not possible. Overloading is possible in object oriented programming.
In procedural programming, function is more important than data. In object oriented programming, data is more important than function.
Procedural programming is based on unreal world. Object oriented programming is based on real world.
Examples: C, FORTRAN, Pascal, Basic etc. Examples: C++, Java, Python, C# etc.

原文参考:https://www.geeksforgeeks.org/differences-between-procedural-and-object-oriented-programming/

评论未能加载 DISQUS被屏蔽 请检查网络