ScholarQuill logoScholarQuillUniversity Notes
My Semester
Explore Notes
Past Papers12 New
Video CoursesNew
Search
Settings
Study Tools
GPA/CGPA Calculator
Schedule & To-Do
Student Portal
Contact
Contact
ScholarQuill logo
My Semester
Explore Notes
Past Papers12 New
Video CoursesNew
Search
Settings
GPA/CGPA Calculator
Schedule & To-Do
Student Portal
Contact
ScholarQuill logoScholarQuillUniversity Notes
Study PortalCOMP3150Oo Patterns
Ctrl + K
Login
Explore
Search
Semester
Papers
CGPA
    COMP3150

    Object Oriented Analysis and Design

    Progress0 / 17 done
    Topics17
    1Principles of Object Technology2OOP Review3Principles of Modeling4OOA&D Overview5OO Development Process
    6Use Cases and Prototyping7Class Models8Interaction Diagrams9Verification and Validation10Architectural and Detailed Design11Class Diagrams12State Machines and Diagrams13Implementation and Package Diagrams14Activity Diagrams15OO Patterns16Object Diagram, Component Diagram, and Deployment Diagram17Network Diagram
    3 min read
    Topic 15 of 17
    Topic Study Note Illustration
    15

    OO Patterns

    Object-Oriented (OO) Patterns are reusable solutions to common software design problems that occur in object-oriented systems.

    📘 OO Patterns (Object-Oriented Design Patterns)


    🔹 1. Definition

    Object-Oriented (OO) Patterns are reusable solutions to common software design problems that occur in object-oriented systems.

    👉 Simple idea: Instead of solving the same design problem again and again, we use a proven template (pattern).


    🔹 2. Why OO Patterns are Important ⭐

    • Reusable solutions (save time)
    • Improve code quality
    • Reduce design errors
    • Make system easier to maintain
    • Encourage best practices

    🔹 3. Key Idea

    A design pattern is NOT code. It is a:

    "Blueprint for solving a recurring design problem"


    🔹 4. Types of OO Design Patterns

    Design patterns are mainly divided into 3 categories:


    🔷 4.1 Creational Patterns (Object Creation)

    👉 These patterns deal with how objects are created


    🔸 1. Singleton Pattern ⭐

    Definition: Ensures only one instance of a class exists.

    Example:

    • Database connection
    • Printer spooler
    class Database {
      private static Database instance;
    }
    

    👉 Only one object is shared globally.


    🔸 2. Factory Pattern

    Definition: Creates objects without exposing creation logic.

    Example: Car factory → produces different cars


    🔸 3. Builder Pattern

    Definition: Builds complex objects step by step.

    Example: Burger customization (bun, cheese, sauce)


    🔷 4.2 Structural Patterns (Class/Object Structure)

    👉 These patterns deal with how classes and objects are structured


    🔸 1. Adapter Pattern ⭐

    Definition: Converts one interface into another compatible interface.

    Example: Mobile charger adapter


    🔸 2. Decorator Pattern

    Definition: Adds new behavior to an object without changing its structure.

    Example: Adding toppings to pizza 🍕


    🔸 3. Facade Pattern

    Definition: Provides a simple interface to a complex system.

    Example: ATM hides banking system complexity


    🔷 4.3 Behavioral Patterns (Object Communication)

    👉 These patterns deal with how objects interact and communicate


    🔸 1. Observer Pattern ⭐

    Definition: One-to-many relationship where one object notifies others.

    Example: YouTube channel subscription 🔔


    🔸 2. Strategy Pattern

    Definition: Defines multiple algorithms and selects one at runtime.

    Example: Payment methods (Card, UPI, Cash)


    🔸 3. Command Pattern

    Definition: Encapsulates a request as an object.

    Example: Remote control buttons 📺


    🔹 5. Real-Life Example of Patterns ⭐

    🎯 ATM System

    • Singleton → ATM machine instance
    • Strategy → Withdrawal methods (cash/card)
    • Facade → ATM hides banking system complexity

    🔹 6. Benefits of OO Patterns

    • Reusability
    • Flexibility
    • Better communication among developers
    • Faster development
    • Standardized solutions

    🔹 7. Problems Without Patterns

    • Duplicate code
    • Poor structure
    • Difficult maintenance
    • Hard to scale system

    🔹 8. Important Rules / Guidelines

    • Use patterns only when needed
    • Do NOT overuse patterns
    • Choose correct pattern for correct problem
    • Keep design simple

    🔹 9. Pattern vs Algorithm

    Feature Design Pattern Algorithm
    Purpose Design solution Step-by-step logic
    Level High-level design Low-level implementation
    Focus Structure & interaction Computation

    🔹 10. Likely Exam Questions

    1. Define OO design patterns.
    2. Why are design patterns important?
    3. Explain Singleton pattern.
    4. What is Factory pattern?
    5. Explain Adapter pattern with example.
    6. What is Observer pattern?
    7. Difference between design pattern and algorithm.
    8. Types of design patterns.
    9. Explain Strategy pattern.
    10. Real-life applications of OO patterns.

    🔹 11. Quick Revision Summary 🧠

    🔹 OO Patterns = Reusable design solutions

    🔹 Types:

    • Creational → Object creation
    • Structural → Object structure
    • Behavioral → Object interaction

    👉 Trick to Remember: "CSB" → Creational, Structural, Behavioral


    ← Previous topic 14
    Activity Diagrams
    Next topic 16 →
    Object Diagram, Component Diagram, and Deployment Diagram

    Past Papers

    Open this section to view and download past papers

    Click on Show Past Papers to load available exam papers.

    Reading Progress
    0%
    3mremaining
    524words
    Beginnerlevel
    On This Page

    No headings found

    Study Toolkit

    Subject Portal

    Object Oriented Analysis and Design