1. 面向函数的设计:
面向函数的设计是关注程序函数的结果。这是基于逐步细化。逐步细化基于迭代过程分解。逐步细化是一种自上而下的策略,其中程序被细化为不断增加细节级别的层次结构。
我们从对程序功能的高级描述开始。然后,在每一步中,我们都会提取高级描述的一部分并对其进行改进。细化实际上是一个细化的过程。这个过程应该从一个高度概念化的模型开始到较低层次的细节。每个模块的细化完成,直到我们达到我们的编程语言的语句级别。
2. 面向对象设计:
面向对象的设计不是将注意力集中在程序执行的函数,而是将注意力集中在程序要操作的数据上。因此,它与面向函数的设计是正交的。面向对象的设计始于对现实世界“事物”的检查。这些事物在其属性和行为方面是单独的特征。
对象是独立的实体,可以很容易地更改,因为所有状态和表示信息都保存在对象本身中。对象可以是分布式的,可以顺序或并行执行。面向对象技术包含以下三个关键词——
- 对象——
软件包设计和开发与包含所有数据和服务函数及其关联的实体的信息真实世界的实体相对应。 - 沟通 –
通信机制的建立提供了对象协同工作的方式。 - 方法 –
方法是对象为满足问题域的功能需求而执行的服务。对象通过消息请求其他对象的服务。
面向函数设计和面向对象设计的区别:
COMPARISON FACTORS | FUNCTION ORIENTED DESIGN | OBJECT ORIENTED DESIGN |
---|---|---|
Abstraction | The basic abstractions, which are given to the user, are real world functions. | The basic abstractions are not the real world functions but are the data abstraction where the real world entities are represented. |
Function | Functions are grouped together by which a higher level function is obtained. | Function are grouped together on the basis of the data they operate since the classes are associated with their methods. |
State information | In this approach the state information is often represented in a centralized shared memory. | In this approach the state information is not represented is not represented in a centralized memory but is implemented or distributed among the objects of the system. |
Approach | It is a top down approach. | It is a bottom up approach. |
Begins basis | Begins by considering the use case diagrams and the scenarios. | Begins by identifying objects and classes. |
Decompose | In function oriented design we decompose in function/procedure level. | We decompose in class level. |
Use | This approach is mainly used for computation sensitive application. | This approach is mainly used for evolving system which mimics a business or business case. |