1.结构化编程:
顾名思义,结构化编程是一种被认为是OOP的先驱,通常由结构良好且分离的模块组成。在此编程中,用户可以创建自己的用户定义函数,并且该方法论尝试解决与无条件传输相关的问题,以允许程序员遵循程序的逻辑。在设计和逻辑构建阶段还需要更多的纪律。
示例: Pascal,ALGOL,C,Modula-2等
2.面向对象编程:
顾名思义,面向对象编程是一种不同的编程方法,可以将在其上执行的数据和函数组合在一起。它基本上支持封装,抽象,继承,多态等。它还包含数据隐藏功能,因此更加安全。该模型基于现实生活中的实体,该实体专注于由谁来完成任务,而不是专注于要做什么。
示例: Java,C#,C++等
结构化编程和面向对象编程之间的区别:
Structured Programming |
Object-Oriented Programming |
It is a subset of procedural programming. | It relies on concept of objects that contain data and code. |
Programs are divided into small programs or functions. | Programs are divided into objects or entities. |
It is all about facilitating creation of programs with readable code and reusable components. | It is all about creating objects that usually contain both functions and data. |
Its main aim is to improve and increase quality, clarity, and development time of computer program. | Its main aim is to improve and increase both quality and productivity of system analysis and design. |
It simply focuses on functions and processes that usually work on data. | It simply focuses on representing both structure and behavior of information system into tiny or small modules that generally combines data and process both. |
It is a method of organizing, managing and coding programs that can give or provide much easier modification and understanding. | It is a method in which set of objects can vary dynamically and can execute just by acting and reading to each other. |
In this, methods are written globally and code lines are processed one by one i.e., Run sequentially. | In this, method works dynamically, make calls as per need of code for certain time. |
It generally follows “Top-Down Approach”. | It generally follows “Bottom-Up Approach”. |
It provides less flexibility and abstraction as compared to object-oriented programming. | It provides more flexibility and abstraction as compared to structured programming. |
It is more difficult to modify structured program and reuse code as compared to object-oriented programs. | It is less difficult to modify object-oriented programs and reuse code as compared to structured programs. |
It gives more importance of code. | It gives more importance to data. |