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 PortalCOMP3150Class Diagrams
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 11 of 17
    Topic Study Note Illustration
    11

    Class Diagrams

    A Class Diagram is a static UML diagram that shows the structure of a system by representing:

    πŸ“˜ Class Diagrams (OOAD – UML)


    πŸ”Ή 1. Definition

    A Class Diagram is a static UML diagram that shows the structure of a system by representing:

    • Classes
    • Attributes
    • Methods (operations)
    • Relationships between classes

    πŸ‘‰ Simple idea: It tells us what the system is made of and how parts are connected, not how they behave over time.


    πŸ”Ή 2. Purpose of Class Diagrams

    • Describe system structure
    • Show relationships between objects
    • Help in database and software design
    • Act as a blueprint for coding
    • Improve system understanding

    πŸ”Ή 3. Basic Structure of a Class ⭐

    A class is shown as a 3-part box:

    ----------------------
    | Class Name         |
    ----------------------
    | Attributes         |
    ----------------------
    | Methods            |
    ----------------------
    

    πŸ”Ή 4. Components of Class Diagram


    πŸ”Έ 4.1 Class Name

    • Top section of the box
    • Represents entity (e.g., Student, Book)

    πŸ”Έ 4.2 Attributes

    • Data members (variables)
    • Represent properties

    Example:

    • name
    • age
    • id

    πŸ”Έ 4.3 Methods (Operations)

    • Functions or behaviors

    Example:

    • login()
    • calculateFee()

    πŸ”Ή 5. Relationships in Class Diagrams ⭐


    πŸ”Έ 5.1 Association

    A general relationship between two classes.

    Example:

    Teacher β€”β€” Student
    

    πŸ‘‰ A teacher teaches students


    πŸ”Έ 5.2 Multiplicity

    Defines how many objects participate.

    Symbol Meaning
    1 One
    0..1 Zero or one
    * Many
    1..* One or many

    πŸ”Έ 5.3 Aggregation (Weak Has-A)

    • Whole-part relationship
    • Part can exist independently

    Example:

    Department β—‡β€”β€” Teacher
    

    πŸ”Έ 5.4 Composition (Strong Has-A)

    • Strong ownership
    • Part cannot exist without whole

    Example:

    House β—†β€”β€” Room
    

    πŸ”Έ 5.5 Inheritance (Generalization)

    • One class inherits another

    Example:

    Animal
      ↑
    Dog
    

    πŸ”Έ 5.6 Dependency

    • Temporary relationship
    • One class uses another

    πŸ”Ή 6. Example (Library System)


    πŸ”Ή Classes:

    • Book
    • Member
    • Librarian

    πŸ”Ή Class Diagram Representation:

    Book
    - title
    - author
    + issue()
    
    Member
    - name
    - id
    + borrowBook()
    
    Relationship:
    Member β€”β€” borrows β€”β€” Book
    

    πŸ”Ή 7. Types of Class Diagrams


    πŸ”Έ 7.1 Conceptual Class Diagram

    • High-level view
    • Used in analysis phase

    πŸ”Έ 7.2 Specification Class Diagram

    • More detailed
    • Used in design phase

    πŸ”Έ 7.3 Implementation Class Diagram

    • Close to actual code
    • Used in coding phase

    πŸ”Ή 8. Steps to Create Class Diagram


    πŸ”Ή Step 1: Identify Classes

    • Find nouns in problem statement

    πŸ”Ή Step 2: Define Attributes

    • Identify properties

    πŸ”Ή Step 3: Define Methods

    • Identify actions

    πŸ”Ή Step 4: Define Relationships

    • Association, inheritance, etc.

    πŸ”Ή Step 5: Add Multiplicity

    • Define quantity relationships

    πŸ”Ή 9. Advantages of Class Diagrams

    • Clear system structure
    • Easy to convert into code
    • Improves communication
    • Helps database design
    • Supports reuse

    πŸ”Ή 10. Important Rules / Guidelines

    • Keep classes simple and meaningful
    • Avoid too many attributes/methods
    • Maintain high cohesion & low coupling
    • Use proper relationships
    • Follow UML notation

    πŸ”Ή 11. Likely Exam Questions

    1. Define class diagram.
    2. Explain components of a class diagram.
    3. What is association?
    4. Difference between aggregation and composition.
    5. Explain inheritance in class diagrams.
    6. What is multiplicity?
    7. Draw class diagram for library system.
    8. Types of class diagrams.
    9. Steps to create class diagram.
    10. Advantages of class diagrams.

    πŸ”Ή 12. Quick Revision Summary 🧠

    • Class Diagram = Structure of system

    • Shows:

      • Classes
      • Attributes
      • Methods
      • Relationships

    Key Relationships:

    • Association
    • Aggregation
    • Composition
    • Inheritance

    πŸ‘‰ Trick to Remember: "CARM-I" (C β†’ Class, A β†’ Attributes, R β†’ Relationships, M β†’ Methods, I β†’ Inheritance)


    ← Previous topic 10
    Architectural and Detailed Design
    Next topic 12 β†’
    State Machines and Diagrams

    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
    520words
    Beginnerlevel
    On This Page

    No headings found

    Study Toolkit

    Subject Portal

    Object Oriented Analysis and Design