Jump to content

User:Psvaidya/sandbox

From Wikipedia, the free encyclopedia

This is the current revision of this page, as edited by Psvaidya (talk | contribs) at 21:33, 20 February 2017. The present address (URL) is a permanent link to this version.

(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

This is my sandbox page used for testing. Below section is to try some edits on Wikipedia page "Responsibility-driven design".

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 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. Data-driven design is not the same as data-driven programming, which is concerned with using data to determine the control flow, not class design.

In the client–server model they refer to, both the client and the server are classes or instances of classes. At any particular time, either the client or the server represents an object. Both the parties commit to a contract and exchange information by adhering to it. The client can only make the requests specified in the contract and the server must answer these requests.[1] Thus, responsibility-driven design tries to avoid dealing with details, such as the way in which requests are carried out, by instead only specifying the intent of a certain request. The benefit is increased encapsulation, since the specification of the exact way in which a request is carried out is private to the server.

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. Even finer control of the visibility of even classes is available in the Newspeak programming language.

Overview

[edit]

Responsibility-driven design focuses on the objects as behavioral abstractions which are characterized by their responsibilities. The 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.[2] This makes the design follow type hierarchy for inheritance which improves encapsulation and makes it easier to identify abstract classes. 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 distributed systems. Similarly, it can help to design and maintain explanation facilities for cognitive models, intelligent agents, and other knowledge-based systems.[3]

Building blocks

[edit]

In their book Object Design: Roles, Responsibilities and Collaborations,[4] the authors describe the following building blocks that make up responsibility-driven design.

  • Application: A software application is referred to as a set of interacting objects.[5]
  • Candidates: Candidates or candidate objects are key concepts in the form of objects described on CRC cards. They serve as initial inventions in the process of object design.[6]
  • Collaborations: A collaboration is defined as an interaction of objects or roles (or both).[5]
  • CRC Cards: CRC stands for Candidates, Responsibilities, Collaborators. They are index cards used in early design for recording candidates.[7] These cards are split up into an unlined and a lined side.
    • Content of lined side: On this side the candidate's name, its responsibilities and its collaborators are recorded.[7]
    • Content of unlined side: On this side the candidate's name, its purpose in the application, stereotype roles and anything worthwhile such as the names of roles in patterns it participates in are recorded.[7]
  • Hot Spots: Hot Spots are points in the application where variations occur. They are recorded using Hot Spot Cards.[8]
  • Hot Spot Cards: Hot Spot Cards are used for recording variations with just enough detail so you can discriminate important difference. Similar to CRC cards, these are also created from index cards.[8] These cards consist of:
    • Hot Spot Name
    • General description of the variation
    • At least two specific examples where the variation occurs

Objects

[edit]

Objects are described as things that have machine-like behaviors that can be plugged together to work in concert. These objects play well-defined roles and encapsulate scripted responses and information.[5]

  • Object Neighborhoods: Another term for subsystem.[9] It is a logical grouping of collaborators.[9]
  • Responsibilities: A responsibility is an obligation to perform a task or know information.[5] These are further categorized according to their usage scenario.
    • Public Responsibilities: Public responsibilities are the responsibilities an object offers as services to others and the information it provides to others.[10]
    • Private Responsibilities: Private responsibilities are the actions an object takes in support of public responsibilities.[10]
    • Subresponsibilities: Sometimes, a large or complicated responsibility is split up into smaller ones called subresponsibilities.[11] They are further categorized based on what they do.
      • Subordinate Responsibilities: These include the major steps of each subresponsibility.[11]
      • Sequencing Responsibilities: These refer to the sequencing of the execution of subordinate responsibilities.[11]

Roles

[edit]

Object role refers to an exterior view of what general service is offered by the object. It is a set of related responsibilities.[5] It can be implemented as a class or an interface. Interface, however, is the preferred implementation as it increases flexibility by hiding the concrete class which ultimately does the work.[12]

Role Stereotypes: Role stereotypes are simplified roles that come with predefined responsibilities.[13] There are several categories.

  • Controller: Object implementing this role makes decisions and closely directs the action of other objects.[13]
  • Coordinator: This role reacts to events by delegating tasks to others.[13]
  • Information Holder: Information holder knows and provides information.[13]
    • Information Provider: A slight variation of an information holder is the information provider, which takes a more active role in managing and maintaining information. This distinction can be used if a designer needs to get more specific.[14]
  • Interfacer: This role transforms information and requests between distinct parts of an application.[13] It is further divided into more specific roles.
    • External Interfacer: External interfacer communicates with other applications rather than its own.[14] It is mainly used for encapsulating non-object-oriented APIs and does not collaborate a lot.[15]
    • Internal Interfacer: Also called intersystem interfacer.[14] It act as a bridge between object neighborhoods.[15]
    • User Interfacer: User interfacer communicates with users by responding to events generated in the UI and then passing them on to more appropriate objects.[14][15][16]
  • Service Provider: This role performs work and offers computing services.[14]
  • Structurer: This role maintains relationships between objects and information about those relationships.[14]

Notes

[edit]
  1. ^ Wirfs-Brock, Rebecca; Wilkerson, Brian (1989). "Object-Oriented Design: A Responsibility-Driven Approach". ACM SIGPLAN Notices. 24 (10): 74. doi:10.1145/74878.74885.
  2. ^ Anthony J. H. Simons; Monique Snoeck; Kitty Hung (1998). "Design Patterns as Litmus Paper to Test the Strength of Object-Oriented Methods". doi:10.1007/978-1-4471-0895-5_10.
  3. ^ Steven R. Haynes; Isaac G. Councill; Frank E. Ritter (2004). "Responsibility-Driven Explanation Engineering for Cognitive Models".
  4. ^ Wirfs-Brock, Rebecca; McKean, Alan (2003). Object Design: Roles, Responsibilities, and Collaborations. Indianapolis, IN: Addison-Wesley. ISBN 0201379430.
  5. ^ a b c d e Wirfs-Brock & McKean 2002, pp. 3
  6. ^ Wirfs-Brock & McKean 2002, pp. 58
  7. ^ a b c Wirfs-Brock & McKean 2002, pp. 61
  8. ^ a b Wirfs-Brock & McKean 2002, pp. 72
  9. ^ a b Wirfs-Brock & McKean 2002, pp. 17
  10. ^ a b Wirfs-Brock & McKean 2002, pp. 126
  11. ^ a b c Wirfs-Brock & McKean 2002, pp. 168
  12. ^ Wirfs-Brock & McKean 2002, pp. 340
  13. ^ a b c d e Wirfs-Brock & McKean 2002, pp. 4
  14. ^ a b c d e f Wirfs-Brock & McKean 2002, pp. 93
  15. ^ a b c Wirfs-Brock & McKean 2002, pp. 165
  16. ^ Wirfs-Brock & McKean 2002, pp. 164