TOPIC 3

KK24803 Software Design: Component Diagram Notes

Learning Outcome

  • Understand what a component diagram is

  • Identify symbols/notations

  • Explain the purpose of component diagrams

  • Create a simple component diagram

What is a Component Diagram?

  • A component diagram illustrates how a system is partitioned into components.

  • It showcases the relationships and interactions between these components.

  • Analogy: Component diagrams are likened to big building blocks of a system, where each part connects to others.

  • Example: In a mobile banking system, the main components could include:

    • Login Component

    • Payment Component

    • Database Component

  • Perspective: Instead of focusing on minute details, component diagrams reflect the broader system architecture.

Why Use Component Diagrams?

  • They provide a clear representation of the system architecture.

  • They aid developers in comprehending the system structure.

  • They support the planning phase of system design.

  • They demonstrate interdependencies between different components.

When to Use Component Diagram

  • Component diagrams are particularly useful in the following scenarios:

    • Designing system architecture.

  • Component Diagram is NOT Suitable For:

    • Detailed logic (use sequence diagrams instead).

    • User interaction (use use case diagrams instead).

    • Explaining the system to team/stakeholders.

    • Breaking down the system into modules.

Component Diagram Example

  • Example:

    • Student Career Guidance System

Definition of a Component

  • A component is a small, replaceable part of a larger system.

  • Example: A lightbulb fitting into a lamp; knowledge of the lightbulb's inner workings is unnecessary outside of its connection.

  • Each component has specific interfaces—these are connection points or functionalities used to interact with it.

  • Representation:

    • A component is depicted as a rectangle labeled with <<component>>.

    • The functional details of the component remain hidden from external view.

    • The name of the component is centered in the rectangle.

    • An icon may be included at the upper-right corner.

  • Single vs. Multiple Components:

    • Components can be shown individually or as grouped sets.

Interfaces

  • An interface is a set of public features available for a class or system to utilize.

  • Interfaces define the available functionalities without detailing their implementation.

  • There are two main types of interfaces:

    • Provided Interfaces: Offer functionalities that can be utilized by other components.

    • Required Interfaces: Specify functionalities that are necessary for the system to operate effectively.

  • Linking Interfaces:

    • Provided and required interfaces can be connected using an assembly connector.

Example of Interfaces in a Component:
  • Payment Component

    • Provides: Process Payment

  • Application Component

    • Requires: Process Payment

Dependency Relationship

  • Definition: A dependency signifies that one component (Component A) relies on another (Component B) for its functionality.

  • Analogy: A laptop (Component A) depending on a printer (Component B) to print documents.

  • Representation:

    • Dependency is represented by a dashed arrow.

    • If one component malfunctions, the dependent component may also be affected.

Connection Types Between Components

  • Component connections can be represented by various lines:

    • Dashed Arrow: Indicates a dependency.

    • Solid Line: Indicates an interface connection.

    • Connector: Represents communication and interaction between components.

Steps to Create a Component Diagram

  1. Identify system components.

  2. Draw components as boxes.

  3. Identify interfaces.

  4. Connect components accordingly.

  5. Add dependencies between components.

Example: Mobile Banking App
  • Components:

    • Mobile App

    • Authentication Service

    • Transaction Service

    • Database

  • Connections:

    • Mobile App → Authentication

    • Mobile App → Transaction

    • Transaction → Database

Summary

  • A component diagram provides a simplistic view of a system's structure.

  • It showcases various components and their interrelationships.

  • These diagrams are invaluable in the realm of software architecture, particularly for grasping the larger context of a system's design.

Acknowledgment

  • Thank you for engaging with these notes.


In a component diagram, the symbol used to represent a component is a rectangle labeled with <<component>>. This allows for clear identification of parts of the system being illustrated. Understanding this symbol is crucial for interpreting and creating effective component diagrams in software design.

  1. What is a component diagram primarily used to illustrate?

    • A) System performance

    • B) Relationships and interactions between system components

    • C) User interactions

    • D) Detailed logic of components
      Answer: B

  2. Which symbol represents a component in a component diagram?

    • A) Circle

    • B) Diamond

    • C) Rectangle labeled with <>

    • D) Star
      Answer: C

  3. Component diagrams are NOT suitable for:

    • A) Designing system architecture

    • B) Breaking down systems into modules

    • C) Explaining detailed logic

    • D) Understanding interdependencies
      Answer: C

  4. What is an example of a component in a mobile banking system?

    • A) User interface

    • B) Database component

    • C) Payment method

    • D) Computer hardware
      Answer: B

  5. Which type of arrow indicates a dependency relationship between components?

    • A) Solid line

    • B) Dashed arrow

    • C) Double line

    • D) Dotted line
      Answer: B

  6. What is included in a component's representation?

    • A) Detailed functional information

    • B) Specific interfaces

    • C) External view of operations

    • D) Connection points
      Answer: D

  7. What represents an interface in a component diagram?

    • A) Solid line connection

    • B) Dashed line connection

    • C) Multiple rectangles

    • D) An icon only
      Answer: A

  8. Required interfaces in a component diagram specify:

    • A) Functionalities utilized by components

    • B) Functionalities necessary for operation

    • C) Optional functionalities

    • D) User interface elements
      Answer: B

  9. What does a solid line symbolize in component connection types?

    • A) Dependency

    • B) Interface connection

    • C) Conditional relationship

    • D) Optional connection
      Answer: B

  10. Which stage is component diagrams particularly useful?

    • A) Testing phase

    • B) Development phase

    • C) Planning phase

    • D) Maintenance phase
      Answer: C

  11. How many main types of interfaces are there?

    • A) One

    • B) Two

    • C) Three

    • D) Four
      Answer: C

  12. In a dependency relationship, if Component A fails, what happens to Component B?

    • A) It is unaffected

    • B) It malfunctions

    • C) It operates independently

    • D) It enhances performance
      Answer: B

  13. What do you use to represent communication between components?

    • A) Solid line

    • B) Dashed arrow

    • C) Connector

    • D) Rectangle
      Answer: C

  14. When creating a component diagram, what is the first step?

    • A) Identify interfaces

    • B) Draw components as boxes

    • C) Identify system components

    • D) Connect components
      Answer: C

  15. What is an example provided in the component diagram notes?

    • A) Banking System

    • B) E-commerce Site

    • C) Student Career Guidance System

    • D) Inventory Management System
      Answer: C

  16. Which type of diagram is preferred for user interactions?

    • A) Component Diagram

    • B) Sequence Diagram

    • C) Use Case Diagram

    • D) Class Diagram
      Answer: C

  17. Component diagrams help in:

    • A) Detail design analysis

    • B) Code documentation

    • C) System architecture visualization

    • D) Hardware specification
      Answer: C

  18. Which component type requires payment processing in a system?

    • A) Authentication Component

    • B) Payment Component

    • C) Data Storage Component

    • D) UI Component
      Answer: B

  19. What is the purpose of categorizing components?

    • A) To confuse the design

    • B) To present a clear structure

    • C) To eliminate complexity

    • D) To show component hierarchy
      Answer: B

  20. A component's functional details are:

    • A) Fully exposed to users

    • B) Hidden from external view

    • C) Partially visible

    • D) Only for documentation
      Answer: B