Mastering UML Use Case Modeling: Online Library System Architecture

System architecture begins with understanding the “who” and “what” of a software application. In the world of Unified Modeling Language (UML), the Use Case Diagram is the primary tool used to capture functional requirements and user interactions. This tutorial explores the architecture of an Online Library Management System, demonstrating how to model complex relationships like authentication, notifications, and conditional behaviors using standard modeling techniques.

1. Identifying the Actors

The foundation of any use case diagram is the identification of actors. An actor represents a role that a user or an external system plays in relation to the software. In our library scenario, we distinguish between human actors and external system actors.

  • Member: The primary consumer of the service. Their interactions are focused on consuming resources (books) and managing their own account (fines).
  • Librarian: The operational manager. They handle the physical and digital inventory, processing loans and returns.
  • System Administrator: The technical overseer. While their tasks are administrative, they share common security requirements with other actors.
  • Email Service: A crucial external actor. This is not a human user but a service (like SMTP) that the library system interacts with to send notifications.

2. Defining Primary Use Cases

Once actors are defined, we map out their goals. These are the functional use cases.

The Member’s Workflow

A member’s journey through the library system is cyclical. It begins with finding a resource, which leads to Search Catalog. If a book is found, the member may Borrow Book. Conversely, if they have finished reading, they Return Book. The system also handles administrative tasks like Pay Fine and inventory management via Reserve Book.

The Librarian’s Workflow

The librarian’s scope is broader regarding inventory control. Their primary actions include Add New Book to the catalog, Process Loan (handling the checkout), and Process Return. They also manage the queue of people waiting for books via Manage Reservations.

3. Establishing Relationships: The Power of Abstraction

A good diagram is not just a list of buttons; it shows how the system behaves under the hood. In this architecture, we utilize two specific relationship types: Include and Extend.

Common Behaviors with «Include»

The diagram reveals that many different actions share common prerequisites. Instead of drawing a login arrow from every single use case to the actor, we abstract this behavior into a separate use case called Authenticate User.

Any action that requires a secure identity—such as Borrow Book, Reserve Book, or Process Loan—has an «include» relationship with authentication. This means the authentication logic is mandatory for these actions to proceed.

Similarly, the Send Notification use case is triggered by the lifecycle of a book. Whether a member borrows a book or returns one, the system must update their record and potentially send a confirmation email. This is modeled as an «include» relationship, ensuring the notification logic is executed every time the parent action completes.

Optional Behaviors with «Extend»

Not every action is strictly linear. The diagram introduces optional, conditional behaviors using the «extend» relationship.

Consider the Borrow Book use case. A user can borrow a book, but they might also want to extend a loan they already have. This is the Renew Book use case. It is an extension of the borrowing process, valid only if specific conditions are met (e.g., the book is not reserved by someone else).

A similar logic applies to Return Book. Sometimes, a book cannot be found on the shelf. The user may choose to Report Lost Book instead of physically returning it. This is an optional branch of the return process.

4. Visualizing the Architecture

When constructing this diagram using modeling tools, the visual hierarchy is essential. The “System Boundary” box encloses all internal use cases, clearly separating the system’s internal logic from the external actors. The “Email Service” actor sits outside the boundary, connected only to the specific use cases that trigger external communication.

By using the «include» and «extend» relationships, we create a modular design. If the notification system changes from email to SMS, we only modify the Send Notification use case, and all connected use cases automatically inherit the new behavior.

5. Implementation and Tooling

While diagrams can be drawn by hand, modern development relies on model-driven engineering. Tools like Visual Paradigm or VPasCode allow you to generate these diagrams programmatically. By defining actors, use cases, and relationships in a structured text format (like PlantUML), you ensure that your diagrams remain synchronized with your code documentation. This approach minimizes human error and allows for version control of your architectural design.