ScholarQuill logoScholarQuillUniversity Notes
  • Notes
  • Past Papers
  • Blogs
  • Todo
Login
ScholarQuill logoScholarQuillUniversity Notes
Login
NotesPast PapersBlogsTodo
More
SubjectsDiscussionCGPA CalculatorGPA CalculatorStudent PortalCourse Outline
About
About usPrivacy PolicyReportContact
Notes
Past Papers
Blogs
Todo
Analytics
    Current Subject
    🧩
    Object Oriented Analysis and Design
    COMP3150
    Progress0 / 17 topics
    Topics
    1. Principles of Object Technology2. OOP Review3. Principles of Modeling4. OOA&D Overview5. OO Development Process6. Requirements Engineering: Use Cases and Prototyping7. Class Models8. Interaction Diagrams9. Verification and Validation10. Architectural and Detailed Design11. Class Diagrams12. State Machines and Diagrams13. Implementation and Package Diagrams14. Activity Diagrams15. OO Patterns16. Object Diagram, Component Diagram, and Deployment Diagram17. Network Diagram
    COMP3150›Class Diagrams
    Object Oriented Analysis and DesignTopic 11 of 17

    Class Diagrams

    3 minread
    520words
    Beginnerlevel

    📘 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 load past papers

    Click on Show Past Papers to see past papers.
    On This Page
      Reading Stats
      Est. reading time3 min
      Word count520
      Code examples0
      DifficultyBeginner