3.4 面向对象分析面向对象设计(初步)
Posted mayzhou
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了3.4 面向对象分析面向对象设计(初步)相关的知识,希望对你有一定的参考价值。
一般原则
? An object-oriented system is composed of objects sending messages to other objects
? The quality of the overall design depends on which object is doing what
? 比喻:“人尽其责、各有所长”
? That is, the quality depends on how we assign responsibilities to the objects
? Problem:
? Define “good quality”?
职责驱动的设计 (RDD)
? RDD,Responsibility Driven Design
? Pioneered by Wirfs-Brock in early 90s
? Think of objects in terms of what they do or know (the human worker metaphor!)
设计时考虑对象做什么、或者知道什么
? An object’s obligation or contract that it offers to other objects
一个对象对其他对象承担的义务或者合约
? A responsibility is really a behavior the other classes depend on
职责是一个对象的行为,而其他的对象依赖这种行为
职责的定义 Responsibilities
? 这里定义为两类Knowing、Doing
? 认知职责 Knowing
? about private encapsulated data
? about related objects
? about things it can derive or calculate
? 行为职责 Doing
? doing something itself
? initiating action in other objects
? controlling and coordinating activities in other objects
以上是关于3.4 面向对象分析面向对象设计(初步)的主要内容,如果未能解决你的问题,请参考以下文章