Object-Oriented Design Fundamentals
30 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 term describes a class whose objects retain their existence after the system has been shut down?

  • Transient class
  • Controller class
  • Boundary class
  • Entity class (correct)

Which class type serves as a mediator between boundary classes and entity classes?

  • Persistent class
  • Controller class (correct)
  • Data access class
  • View class

What is the visibility indication for an attribute that can be accessed by other objects?

  • -
  • #
  • *
  • + (correct)

Which notation is used to indicate that a method cannot be invoked outside its own class?

<ul> <li>(D)</li> </ul> Signup and view all the answers

What does a design class diagram stereotype indicate?

<p>The characteristics of a model element (D)</p> Signup and view all the answers

What notation is specifically used for attributes that only apply to the class and not its instances?

<p>Class attribute (C)</p> Signup and view all the answers

Which of the following is true about abstract classes?

<p>They can only be used for inheritance (A)</p> Signup and view all the answers

Which type of operation does a class level method pertain to?

<p>The class itself (D)</p> Signup and view all the answers

What is the appropriate notation for the initial value of an attribute in a class?

<p>Default value (A)</p> Signup and view all the answers

Which method signature denotes a method that will return an integer?

<p>-calculateTotal(): int (B)</p> Signup and view all the answers

What does the principle of encapsulation specifically help to reduce?

<p>System complexity (C)</p> Signup and view all the answers

Which design principle focuses on protecting stable parts of a system from those likely to change?

<p>Protection from variations (C)</p> Signup and view all the answers

What is considered an indicator of high cohesion within a class?

<p>A class that has a clear and focused set of responsibilities (B)</p> Signup and view all the answers

Which term describes the quantitative measure of how closely related classes are linked?

<p>Coupling (D)</p> Signup and view all the answers

Which principle advocates for grouping similar functionalities into classes?

<p>Separation of responsibility (B)</p> Signup and view all the answers

What is the primary benefit of inheritance in object-oriented design?

<p>It enables the creation of a class hierarchy sharing attributes and methods (A)</p> Signup and view all the answers

Why is it preferable to have classes that are loosely coupled?

<p>It allows for independent function modifications without widespread impact (A)</p> Signup and view all the answers

Which of the following is NOT a consequence of low cohesion in a class?

<p>Better organization of functionality (B)</p> Signup and view all the answers

What is the primary assumption that underlies object responsibility in design?

<p>Objects know how to perform actions and will do what is requested (D)</p> Signup and view all the answers

What does high cohesiveness indicate about a class's responsibilities?

<p>Responsibilities are well-aligned and logical (A)</p> Signup and view all the answers

What is the primary role of a subclass in object-oriented design?

<p>To extend or inherit properties and methods from a superclass. (A)</p> Signup and view all the answers

Which concept allows different methods of the same name to coexist in a class?

<p>Overloading (B)</p> Signup and view all the answers

What is the significance of indirection in class design?

<p>It helps reduce coupling and enhances security. (A)</p> Signup and view all the answers

What does the dashed line in a sequence diagram represent?

<p>The lifeline of an object. (B)</p> Signup and view all the answers

How does a base controller function in an object-oriented design?

<p>It serves as a switchboard between UI classes and domain classes. (C)</p> Signup and view all the answers

When creating a design class diagram (DCD), which step follows extending input messages?

<p>Determining all internal messages. (A)</p> Signup and view all the answers

What do activation lifelines in a sequence diagram indicate?

<p>The time period when an object is executing based on received messages. (B)</p> Signup and view all the answers

What assumption is made regarding technology in object-oriented design?

<p>That technology is perfect and free from logon issues. (A)</p> Signup and view all the answers

What is expected when determining the objects involved in a message during design?

<p>To include both origins and destinations as part of the analysis. (B)</p> Signup and view all the answers

Which is a characteristic of a controller class in object-oriented design?

<p>It serves as an artifact without intrinsic business logic. (C)</p> Signup and view all the answers

Flashcards

Object-Oriented Design

Identifying classes, methods, and messages for a use case.

Use Case Driven Design

Designing by focusing on individual use cases.

Persistent Class

A class whose objects survive program termination.

Entity Class

Represents a problem domain object (often persistent).

Signup and view all the flashcards

Boundary Class

A class at the system's interface (e.g., input forms).

Signup and view all the flashcards

Controller Class

Manages interaction between boundary and entity classes.

Signup and view all the flashcards

Data Access Class

Retrieves and sends data to a database.

Signup and view all the flashcards

Attribute Visibility

Indicates if an attribute can be directly accessed.

Signup and view all the flashcards

Method Visibility

Specifies whether a method can be called from outside.

Signup and view all the flashcards

Class Level Method

A method that applies to the class itself, not individual objects.

Signup and view all the flashcards

Indirection

A design principle where an intermediate class is introduced to decouple two other classes while maintaining a connection between them.

Signup and view all the flashcards

Polymorphism

The ability of a class to implement multiple methods with the same name but different parameters, allowing for different behaviors based on input.

Signup and view all the flashcards

Use Base Controller

A class that acts as a switchboard between UI classes and problem domain classes, reducing coupling and simplifying interaction.

Signup and view all the flashcards

Lifeline

A dashed line under an object in a sequence diagram representing its life cycle and serving as a message origin and destination point.

Signup and view all the flashcards

Activation Lifeline

A vertical box on a lifeline in a sequence diagram indicating the time period when the object is executing code based on received messages.

Signup and view all the flashcards

What are the origins and destinations of messages?

Messages in sequence diagrams have both origins and destinations, which can be either on the lifeline or within an object box.

Signup and view all the flashcards

DCD Input Models

The inputs used for creating a first-cut Design Class Diagram (DCD), including activity diagrams, System Sequence Diagrams (SSDs), and classes.

Signup and view all the flashcards

Extend Input Messages

Adding internal messages to a DCD based on input messages, including origin and destination objects and elaborating message details.

Signup and view all the flashcards

Assumptions in OOD

Simplified assumptions used in OOD, such as perfect technology, no technical issues, perfect solutions, and no error handling.

Signup and view all the flashcards

From Input Messages

Identifying internal messages, objects, and elaborating messages with conditions, parameters, and return values from each input message in a scenario.

Signup and view all the flashcards

Object Responsibility

Objects are responsible for carrying out system processing. They 'know' how to perform methods and 'do' what they are asked.

Signup and view all the flashcards

Separation of Responsibility

Separating classes into groups or packages based on their functions. This principle promotes organization and avoids muddled code.

Signup and view all the flashcards

Protection from Variations

Separating parts of a system that are likely to change from those unlikely to change. This isolates potential disruptions.

Signup and view all the flashcards

Coupling (Tight/Loose)

How closely related classes are linked. Tight coupling means lots of associations/messages between classes, while loose coupling means fewer interactions.

Signup and view all the flashcards

Cohesion (High/Low)

The focus or unity of purpose within a class. High cohesion means all responsibilities are relevant, while low cohesion means tasks are scattered and unrelated.

Signup and view all the flashcards

Encapsulation

Bundling data and related operations into a single unit, hiding internal details. This simplifies the system, increasing robustness.

Signup and view all the flashcards

Inheritance

Deriving a class from another, creating a hierarchy of classes that share characteristics and methods.

Signup and view all the flashcards

What is the benefit of loose coupling?

Loose coupling allows for more modular and flexible code, making it easier to change and maintain. It reduces the impact of changes in one class on other classes.

Signup and view all the flashcards

How does high cohesion benefit a class?

It makes the class more understandable, maintainable, and reusable. It focuses the class on a specific responsibility, making it easier to reason about its behavior.

Signup and view all the flashcards

Why is encapsulation important?

It hides implementation details and reduces the risk of errors by controlling access to data. It makes the system more robust and easier to maintain.

Signup and view all the flashcards

Study Notes

Steps of Object-Oriented Design

  • Object-oriented design identifies the classes, their methods, and messages for a use case.
  • Design is use-case driven.

Design Class Diagrams

  • Stereotype: categorizes model elements by characteristics (e.g., <<>>).
  • Persistent class: object exists after system shutdown (data remembered).
  • Entity class: identifies a problem domain class (usually persistent).
  • Boundary class/view class: exists at system boundary (e.g., input window, webpage).
  • Controller class: mediates between boundary and entity classes, acting as a switchboard.
  • Data access class: retrieves and sends data to/from a database.

Notation for a Design Class

Syntax for Name, Attributes, and Methods

Attributes

  • Visibility: indicates access (+ public, - private).
  • Attribute name: lower camel case (e.g., accountNo).
  • Type expression: class, string, integer, etc.
  • Initial value (if applicable); e.g., accountNo: String {key}.
  • Property (if applicable), e.g., {key}.

Method Signature

  • Visibility: indicates access (+ public, - private).

  • Method name: lower camel case (verb-noun), e.g., getName().

  • Parameters: variables passed to a method.

  • Return type: the data type returned by the method, e.g., getName(): string.

  • Class-level method: applies to the class, not objects (static method).

  • Class-level attribute: applies to the class, not objects (static attribute); underlined (e.g., -noOfPhoneSales: int).

  • Abstract class; Italicized, cannot be instantiated, only used for inheritance.

  • Concrete class: can be instantiated.

Studying That Suits You

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

Quiz Team

Description

Explore the essential steps and components of object-oriented design through this quiz. Understand the classification of design elements, including classes, methods, and their interactions. Test your knowledge on design class diagrams and the notation for defining attributes and methods.

More Like This

Use Quizgecko on...
Browser
Browser