SWE202: GRASP Patterns in Software Construction
24 Questions
0 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

What is the primary goal of GRASP patterns?

  • To create obligations for classifiers
  • To document what expert designers know intuitively
  • To provide a methodical approach to learning basic object design (correct)
  • To avoid accidents in software development
  • What is the definition of a responsibility in the context of UML?

  • A principle of object-oriented design
  • A type of design pattern
  • A contract or obligation of a classifier (correct)
  • A classification of an object's behavior
  • What is the name of the person who created the GRASP acronym?

  • Oluwaseun Priscilla Olawale
  • Unknown
  • Craig Larman (correct)
  • Nathaniel Borenstein
  • What is the main focus of the GRASP patterns?

    <p>Creating responsibilities for classes</p> Signup and view all the answers

    What is the quote about the most likely way for the world to be destroyed referring to?

    <p>The role of computer professionals in causing accidents</p> Signup and view all the answers

    How many GRASP patterns are presented and discussed in the text?

    <p>Four</p> Signup and view all the answers

    What is the significance of GRASP patterns in relation to object design?

    <p>They are a methodical approach to learning basic object design</p> Signup and view all the answers

    What is the primary objective of using GRASP patterns?

    <p>To understand and apply design principles</p> Signup and view all the answers

    What is the primary goal of the Low Coupling pattern?

    <p>To minimize dependencies between classes</p> Signup and view all the answers

    Which GRASP pattern is responsible for assigning responsibilities to classes based on the information they possess?

    <p>Information Expert</p> Signup and view all the answers

    What is the purpose of the Controller pattern?

    <p>To handle system events or coordinate activities</p> Signup and view all the answers

    Which class should be responsible for calculating interest on a bank account, according to the Information Expert pattern?

    <p>BankAccount class</p> Signup and view all the answers

    What is the primary purpose of the Observer pattern in the context of GRASP patterns?

    <p>To notify interested parties of changes in bank account balances</p> Signup and view all the answers

    According to the Creator pattern, which class(es) should be responsible for creating instances of a new bank account?

    <p>Bank class or AccountManager class</p> Signup and view all the answers

    What is the primary goal of the High Cohesion principle?

    <p>To promote high cohesion and minimize coupling</p> Signup and view all the answers

    Which GRASP pattern is responsible for assigning responsibilities to classes based on their ability to handle system events or coordinate activities?

    <p>Controller</p> Signup and view all the answers

    What is the primary focus of the 'doing' responsibilities of an object?

    <p>Initiating action in other objects</p> Signup and view all the answers

    According to the GRASP pattern 'Information Expert', what is the primary consideration for assigning a responsibility to a class?

    <p>The class's possession of the information needed to fulfill the responsibility</p> Signup and view all the answers

    What type of pattern is the GRASP pattern 'Creator' an example of?

    <p>Creational pattern</p> Signup and view all the answers

    What is the primary difference between 'knowing' and 'doing' responsibilities?

    <p>Knowing is about private data, while doing is about initiating actions</p> Signup and view all the answers

    What is the purpose of a GRASP pattern?

    <p>To describe a problem and solution pair that can be applied in new contexts</p> Signup and view all the answers

    How many GRASP patterns are mentioned in the text?

    <p>9</p> Signup and view all the answers

    What is the primary principle of the GRASP pattern 'Controller'?

    <p>Assign a responsibility to the class that controls and coordinates activities</p> Signup and view all the answers

    What is the primary characteristic of a 'knowing' responsibility?

    <p>It involves knowing about private encapsulated data</p> Signup and view all the answers

    Study Notes

    GRASP Patterns

    • GRASP (General Responsibility Assignment Software Patterns) is an acronym created by Craig Larman to encompass nine object-oriented design principles related to creating responsibilities for classes.
    • GRASP patterns are a learning aid to help talk about and methodically do fundamental object design.
    • The assignment of responsibilities and design of collaborations are very important and creative steps during design.

    Responsibilities

    • A responsibility is a contract or obligation of a classifier.
    • There are two types of responsibilities:
      • Doing: includes doing something itself, initiating action in other objects, controlling and coordinating activities in other objects.
      • Knowing: includes knowing about private encapsulated data, knowing about related objects, knowing about things it can derive or calculate.

    GRASP Patterns (Examples)

    • Information Expert: Assign a responsibility to the class that has the information needed to fulfill it.
    • Creator: Assign the responsibility of creating instances of a class to the class that has the most knowledge about when and how to create them.
    • Low Coupling: Aims for classes to have minimal dependencies on each other, facilitating easier maintenance and flexibility in the system.
    • Controller: Assign the responsibility of handling system events or coordinating activities to a controller class.

    Other GRASP Patterns

    • High Cohesion: Promotes high cohesion within a class.
    • Polymorphism: Supports variation in behavior.
    • Pure Fabrication: Creates a new class that does not represent a real-world concept.
    • Indirection: Provides an intermediate object to reduce coupling between classes.
    • Protected Variations: Anticipates and protects against variations in the system.

    Studying That Suits You

    Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

    Quiz Team

    Related Documents

    Week 12-13 -SWE202.pdf

    Description

    Learn about GRASP patterns and their application in software construction, including four key patterns. Understand the importance of responsible software development.

    More Like This

    Use Quizgecko on...
    Browser
    Browser