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 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. |