Content deleted Content added
m →Bibliography: refs using AWB |
Add "redirects here" template |
||
(23 intermediate revisions by 12 users not shown) | |||
Line 1:
{{short description|Design technique in object-oriented programming}}
{{Redirects here|Data-driven design|the optimization approach|Data-oriented design}}
{{primary sources|date=December 2012}}
'''Responsibility-driven design''' is a design technique in [[object-oriented programming]], which improves encapsulation by using the [[client–server model]]. It focuses on the [[contract]] by considering the actions that the [[Object (computer science)|object]] is responsible for and the information that the object shares. It was proposed by [[Rebecca Wirfs-Brock]] and Brian Wilkerson
Responsibility-driven design is in direct contrast with data-driven design, which promotes defining the behavior of a class along with the data that it holds.
To further the encapsulation of the server, Wirfs-Brock and Wilkerson call for language features that limit outside influence to the behavior of a class. They demand that the visibility of members and functions should be finely grained, such as in [[Eiffel (programming language)|Eiffel]] programming language. Even finer control of the visibility of even classes is available in the [[Newspeak (programming language)|Newspeak]] programming language.
==Overview==
Responsibility-driven design focuses on the objects as [https://www.cs.cmu.edu/~rbd/doc/nyquist/part4.html behavioral abstractions] which are characterized by their responsibilities. The [[Class-responsibility-collaboration card|CRC-card]] modelling technique is used to generate these behavioral abstractions. The rest of the object structure including data attributes are assigned later, as and when required.<ref name="AnthonySimons">{{cite book | chapter=Design Patterns as Litmus Paper to Test the Strength of Object-Oriented Methods | year=1998 | chapter-url=http://citeweb.info/19980495062 | doi=10.1007/978-1-4471-0895-5_10 | author1=Anthony J. H. Simons | title=Oois'98 | pages=129–147 | author2=Monique Snoeck | author3=Kitty Hung| isbn=978-1-85233-046-0 | citeseerx=10.1.1.130.8713 }}</ref> This makes the design follow type hierarchy for inheritance which improves encapsulation and makes it easier to identify [[abstract class]]es. It can also group the classes together based on their clients which is considered a unique ability.
A good object-oriented design involves an early focus on behaviors to realize the capabilities meeting the stated requirements and a late binding of implementation details to the requirements. This approach especially helps to decentralize control and distribute system behavior which can help manage the complexities of high-functionality large or [http://www.computerhope.com/jargon/d/distribs.htm distributed systems]. Similarly, it can help to design and maintain explanation facilities for [[cognitive model]]s, [[intelligent agent]]s, and other [[knowledge-based systems]].<ref name="Cognitive Models">{{cite web | title=Responsibility-Driven Explanation Engineering for Cognitive Models | year=2004 | url=http://citeweb.info/20040821547 | author1=Steven R. Haynes | author2=Isaac G. Councill | author3=Frank E. Ritter}}</ref>
==Building blocks==
In their book ''Object Design: Roles, Responsibilities and Collaborations'',<ref name="ObjectDesign-entirebook">{{cite book|author1=Wirfs-Brock, Rebecca|author2=McKean, Alan|title=Object Design: Roles, Responsibilities, and Collaborations|date=2003|publisher=Addison-Wesley|___location=Indianapolis, IN|isbn=
* Application
* Candidates
* Collaborations
* CRC Cards
** Content of lined side
** Content of unlined side
* Hot Spots
* Hot Spot Cards
** Hot Spot Name
** General description of the variation
Line 29 ⟶ 31:
=== Objects===
Objects are described as things that have
* Object Neighborhoods
* Responsibilities
** Public Responsibilities
** Private Responsibilities
** Subresponsibilities
*** Subordinate Responsibilities
*** Sequencing
===Roles===
* Controller
* Coordinator
* Information Holder
** Information Provider
* Interfacer
** External Interfacer
** Internal Interfacer
** User Interfacer
* Service Provider
* Structurer
==Control style==
An important part in the responsibility-driven design process is the distribution of control responsibilities that results in developing a control style. A control style is concerned about the control flow between [https://en.wiktionary.org/wiki/sub-system subsystems].
* Concept of Control : The responsibilities and collaborations among the classes.<ref name="Evaluating the effect of a delegated versus centralized control style on the maintainability of object-oriented software">{{cite journal|first1=Arisholm|last1 = Eric|first2 = Sjoberg|last2 =Dag I.K.|title=Evaluating the effect of a delegated versus centralized control style on the maintainability of object-oriented software|journal = IEEE Transactions on Software Engineering|date=2004|volume=30|issue=8|pages = 521–534|doi = 10.1109/TSE.2004.43|s2cid = 6396127}}</ref>
* Control Centers : An important aspect of developing a control style is the invention of so-called control centers. These are places where objects charged with controlling and coordinating reside.<ref name="ObjectDesign-page196">{{harvnb |Wirfs-Brock|McKean|2002| pp=196 }}</ref>
* Control Style Variations : A control style comes in three distinct variations. These are not precise definitions though since a control style can be said to be more centralized or delegated than another.
=== Centralized control style ===
This control style inflicts a procedural paradigm on the structure of the application and places major-decision making responsibilities in only a few objects or a single object.
;Types
* Call-return model : The control of the objects in the application is in hierarchical way. Control starts at root and moves downwards. It is used in a sequential model.
* Manager model : The control of the objects in the application is in with only one object. Generally, it is implemented in concurrent models. It can also be implemented in sequential model using [[Switch statement|case statement]].
===Clustered control style===▼
This control style is a variation of the centralized control style wherein control is factored among a group of objects whose actions are coordinated.<ref name="ObjectDesign-page197">{{harvnb |Wirfs-Brock|McKean|2002| pp=197 }}</ref> The main difference between a clustered and delegated control style is that in a clustered control style, the decision making objects are located within a control center whereas in a delegated control style they are mostly outside.<ref name="ObjectDesign-page213">{{harvnb |Wirfs-Brock|McKean|2002| pp=213 }}</ref>▼
;Advantages
Line 92 ⟶ 83:
===Delegated control style===
A delegated control style lies in between a centralized and dispersed control style. It passes some of the decision making and much of the action to objects surrounding a control center. Each neighboring object has a significant role to play. It can also be called as event driven model, where the control is delegated to the object requesting it to process the event.
;Types[reference]
* Broadcast model : An event is broadcast to all objects in the application. The object which can handle the event can acquire the control.
* Interrupt-driven model : There will be the [[interrupt]] handler to process the interrupt and passes to some object to process it.
;Advantages
* It is easy to understand.
* Though there is an external coordinator, Objects can be made smarter to know what they are supposed to do and can be reused in other applications.
* Delegating coordinators tend to know about fewer objects than dominating controllers.▼
* Dialogs are higher-level.▼
▲* Delegating coordinators tend to know about fewer objects than dominating controllers
▲* Dialogs are higher-level
* It is easier to divide design work among team members.▼
▲* Changes typically affect fewer objects
▲* It is easier to divide design work among team members
;Disadvantages
Line 108 ⟶ 102:
;When to use
When one wants to delegate work to objects that are more specialized.
▲===Clustered control style===
▲This control style is a variation of the centralized control style wherein control is factored among a group of objects whose actions are coordinated.<ref name="ObjectDesign-page197">{{harvnb |Wirfs-Brock|McKean|2002| pp=197 }}</ref> The main difference between a clustered and delegated control style is that in a clustered control style, the decision making objects are located within a control center whereas in a delegated control style they are mostly outside.<ref name="ObjectDesign-page213">{{harvnb |Wirfs-Brock|McKean|2002| pp=213 }}</ref>
===Dispersed control style===
Line 123 ⟶ 120:
===Preferred control style===
After extensive results of experiments conducted, only the senior management has the necessary skills to make use of delegated control style and centralized control style benefits programmers. There is no context mentioned about the mid-level employees.<ref name="Evaluating the effect of a delegated versus centralized control style on the maintainability of object-oriented software"/>
==References==
Line 132 ⟶ 126:
==Bibliography==
* [
* {{cite book |author1=Wirfs-Brock, Rebecca |author2=McKean, Alan |title= Object Design: Roles, Responsibilities, and Collaborations |publisher= [[Addison Wesley]] |date=November 2002 |isbn= 978-0-201-37943-
[[Category:Object-oriented programming]]
|