CSC 312

Object Oriented Analysis and Design (OOAD)

Overview

  • Object-Oriented Analysis and Design (OOAD) is a methodology focusing on using objects as the central building blocks for software development.

  • Emphasizes understanding and modeling real-world entities, their behaviors, and interactions.

  • Consists of two main phases:

    • Analysis

    • Design

Object-Oriented Analysis

Goals

  • Objective: To understand system requirements by identifying the involved objects and their interactions.

Key Steps

  1. Identify Objects

    • Example: Library Management System

      • Book:

      • Attributes: title, author, ISBN.

      • Methods: checkout, return.

      • Member:

      • Attributes: name, member ID.

      • Methods: register, borrow.

      • Library:

      • Attributes: collection of books, list of members.

      • Methods: add book, remove book.

  2. Use Case Diagram

    • Visual representation showing interactions between actors and the system.

Object-Oriented Design

Goals

  • Objective: To define the structure of the system and detail how the identified objects interact.

Key Steps

  1. Class Diagram

    • Illustrates the relationships between classes.

  2. Implementation

    • Define classes in code.

Benefits of OOAD

  1. Modularity: Objects can be developed and tested independently, enhancing maintainability.

  2. Reusability: Classes can be reused across different systems, reducing redundancy.

  3. Scalability: Supports adding new features or modifying existing ones with minimal impact on the system.

  4. Clarity: Models resemble real-world scenarios, making it easier for stakeholders to understand.

Key Concepts in OOAD

  1. Object: Fundamental units that combine state (attributes) and behavior (methods).

    • Example: Student, staff, courses in a university system.

  2. Classes: Blueprints for creating objects, defining attributes and methods common to all objects of that type.

    • Example: A car class represents general characteristics and behaviors of cars.

  3. Encapsulation: Hides the internal state, requiring all interactions to be performed through an object's methods.

    • Example: Bank account class that hides the balance, allowing operations through methods.

  4. Inheritance: Mechanism where a new class (subclass) inherits attributes and methods from an existing class (superclass).

    • Example: In a transportation system, Vehicle could be a superclass with subclasses like Car and Truck.

  5. Polymorphism: Ability to present the same interface for different underlying data types.

    • Example: Different animals make distinct sounds, yet all can be referenced as sound.

Principles in OOAD

Principle of Least Commitment

  • Suggests systems should defer decisions until the latest possible moment, promoting flexibility.

  • Example: Users can add items to an online shopping cart without immediate purchase.

Principle of Least Astonishment

  • States software should behave consistently with users’ expectations, enhancing usability.

    • Examples:

    • File Management: Moving a file to “recycle bin” instead of immediate deletion.

    • Web Navigation: Clicking a link should navigate, not trigger an unexpected alert.

Unified Modeling Language (UML)

Overview

  • UML: A standard language for specifying, visualizing, constructing, and documenting software systems.

  • UML is not a programming language but a pictorial language for making software blueprints.

  • UML diagrams can also model non-software systems, e.g., process flows.

Goals of UML

  • Provides a simple modeling mechanism to visualize, specify, construct, and document complex systems.

  • Evolved to standardize object-oriented development methodologies.

Conceptual Model of UML

Definition

  • A conceptual model consists of concepts and their relationships, aiding understanding before creating UML diagrams.

Key Elements

  1. UML Building Blocks

    • Things: Structural, behavioral, grouping, annotational.

      • Structural Things: Define the static part of the model (e.g., Class, Interface).

      • Behavioral Things: Describe dynamic parts (e.g., Interaction, State Machine).

      • Grouping Things: The only mechanism available is a Package.

      • Annotational Things: Captures descriptions and comments (with Note).

  2. Relationships

    • Define associations between elements of a UML model.

    • Types include:

      • Dependency: A change in one element affects another.

      • Association: Describes the links connecting UML elements.

      • Generalization: Inheritance relationships.

      • Realization: Connection between two elements where one describes responsibility not implemented by another.

  3. Diagrams

    • Outputs of UML modeling, used to represent systems visually.

    • Types of UML diagrams:

    1. Class Diagram

    2. Object Diagram

    3. Use Case Diagram

    4. Sequence Diagram

    5. Collaboration Diagram

    6. Activity Diagram

    7. Statechart Diagram

    8. Deployment Diagram

    9. Component Diagram

UML Architecture

Perspectives

  • Different users (developers, testers, business users) have varying perspectives.

Key Perspectives Include

  • Design: Consists of classes, interfaces, collaborations.

  • Implementation: Defines components as assembled physical systems.

  • Process: Flow of the system.

  • Deployment: Represents the physical nodes forming the hardware.

Types of UML Modeling

Structural Modeling

  • Captures the static features of a system.

  • Includes diagrams:

    • Class Diagrams

    • Object Diagrams

    • Deployment Diagrams

    • Package Diagrams

    • Composite Structure Diagrams

    • Component Diagrams

Behavioral Modeling

  • Describes interactions and dynamic behavior.

  • Includes diagrams:

    • Activity Diagrams

    • Interaction Diagrams

    • Use Case Diagrams

Architectural Modeling

  • Represents overall system framework.

  • Contains structural and behavioral elements.

Notations in UML Diagrams

Structural Notations

  • Representation of classes, interfaces, use cases, components, etc.

Example of Class Notation

  • A class has four sections:

    • Name

    • Attributes

    • Operations

    • Additional Components (optional)

Behavioral Notations

  • Representation includes interaction representation, state machines, etc.

Example: Interaction Notations

  • Depicts message exchanges with sequence numbers.

Example: State Machine Notation

  • Describes different states a component goes through along with events that cause state changes.

Relationships In UML Models

Types of Relationships

  • Dependency: Illustrated with a dotted arrow, indicating an effect of one element on another.

  • Association: Represented by a solid line, shows relationships between UML elements.

  • Generalization: Illustrated with a hollow arrowhead, indicating parent-child relationships.

UML Standard Diagrams

  • Structural Diagrams: Class, Object, Component, Deployment.

  • Behavioral Diagrams: Use Case, Sequence, Collaboration, Statechart, Activity.

Conclusion

  • UML is a comprehensive modeling language crucial for object-oriented analysis and design, offering tools for effective visualization and documentation of complex systems. It incorporates various diagrams to convey both structural and behavioral aspects effectively.