面向对象:用线性的思维。与面向过程相辅相成。在软件开发过程中,宏观上,用面向对象来把握事物间复杂的关系,分析系统。微观上,仍然使用面向过程。
“面向过程”是一种是事件为中心的编程思想。就是分析出解决问题所需的步骤,然后用函数把这写步骤实现,并按顺序调用。
”面向对象“是以“对象”为中心的编程思想。
https://en.wikipedia.org/wiki/Procedural_programming
Procedural programming is a programming paradigm, derived from structured programming, based upon the concept of the procedure call. Procedures, also known as routines, subroutines, or functions (not to be confused with mathematical functions, but similar to those used in functional programming), simply contain a series of computational steps to be carried out. Any given procedure might be called at any point during a program's execution, including by other procedures or itself. The first major procedural programming languages first appeared circa 1960, including Fortran, ALGOL, COBOL and BASIC.[1] Pascal and C were published closer to the 1970s, while Ada was released in 1980.[1] Go is an example of a more modern procedural language, first published in 2009.
一、什么是面向过程
面向过程是一种思维方式。当试图通过面向过程解决问题时,我们的关注点在于问题解决的流程,重在这个过程的控制,需要用大量的模块(模块化的思想源自于硬件,在C语言中是函数)将大问题拆解,程序员通过控制模块的执行顺序以解决问题。
举个例子,当我们解决一个“如何将大象装入冰箱?”的问题时,最简单的解决思路是面向过程解决:
1、关注过程,将大问题拆解为小问题,实现每个小问题的解决方法
a、打开冰箱门
b、将大象装入冰箱
c、关闭冰箱门
2、通过控制代码,控制模块执行,执行顺序为a->b->c,问题解决。
在日常生活或者说日常编程中,简单的问题用面向过程的思路解决,更加直接有效,但是当问题的规模稍大时,如要描述三万个人吃饭的问题,或者要构建一个航空母舰模型的时候,用面向过程的思想是远远不够的。而且面向过程程序的代码复用性、可扩展性、可移植性、灵活性、健壮性都会在处理大规模问题中出现问题。
http://blog.csdn.net/zhangliangzi/article/details/51221477