Mastering Use Case Modeling: Online Store Architecture with UML

Read this post in:

Mastering Use Case Modeling: Online Store Architecture with UML

Designing complex software systems requires a clear understanding of how users interact with them. One of the most effective ways to visualize these interactions is through a Use Case Diagram. In this tutorial, we will explore the system architecture of a classic “Online Store” example, analyzing the actors, system boundaries, and specific use cases that define the user experience.

Whether you are a business analyst defining requirements or a developer designing the backend logic, understanding the “Use Case View” is the first step toward building a robust application. We will walk through the concepts, visualize the relationships, and provide the code to generate this diagram using modern modeling tools.

1. Understanding the System Boundary

The foundation of any Use Case Diagram is the System Boundary. In our Online Store example, this is represented by the large rectangular box labeled “Online Store”. This boundary is critical because it defines what is “inside” the system and what is “outside.”

  • Inside the Box: These are the functions or capabilities the system provides to the users. They are internal processes exposed to the outside world.
  • Outside the Box: These are the Actors. Actors are external entities that interact with the system but are not part of it.

This visual separation helps developers and stakeholders agree on the scope of the project. For instance, the “Payment Provider” is an external system, while “Place Order” is an internal function of our store.

2. Identifying Actors: Who Interacts?

Actors represent the roles played by people or external systems that interact with the software. In our diagram, we identify two distinct actors:

  1. The Shopper: This is the primary user of the system. The Shopper is interested in browsing items, managing their shopping cart, and purchasing goods.
  2. The Payment Provider: This represents an external system (like Stripe or PayPal) or a third-party service. The Store relies on this actor to process financial transactions securely.

In UML, actors are typically depicted as stick figures. A key rule in modeling is that actors should not be inside the system boundary; they initiate the interaction.

3. Defining Use Cases: What is the System?

Use cases are the “ovals” inside the system boundary. They describe a specific goal a user wants to achieve. In the Online Store scenario, we have four key use cases:

  • Browse products: The ability for a user to view the catalog.
  • Manage cart: The ability to add, remove, or modify items before purchasing.
  • Place order: The critical transaction process where the cart is validated and the order is created.
  • View order: The ability for the user to see the status of their purchase.

The “Place Order” Relationship

Notice the connection between the Payment Provider and the Place order use case. This indicates that the system interacts with the Payment Provider specifically during the ordering process. The shopper triggers the order, but the system delegates the payment validation to the external provider.

4. Generating the Diagram with PlantUML

Modern engineering workflows often utilize “Diagram as Code” approaches. This allows developers to define their architecture in text files, which can then be version-controlled and rendered into images. Below is the PlantUML code that generates the exact diagram shown in this tutorial.

@startuml
skinparam usecaseBackgroundColor #F0F8FF
skinparam usecaseBorderColor #00008B
skinparam stickmanStyle #00008B

package "Online Store" {
    usecase "Browse products" as UC1
    usecase "Manage cart" as UC2
    usecase "Place order" as UC3
    usecase "View order" as UC4
}

actor "Shopper" as Actor1
actor "Payment Provider" as Actor2

Actor1 -- UC1
Actor1 -- UC2
Actor1 -- UC3
Actor1 -- UC4
Actor2 -- UC3

@enduml

When you run this code in a PlantUML renderer, it automatically draws the system boundary, places the actors outside the box, and connects them to the appropriate use cases. This ensures consistency across your documentation.

5. Why Use Case Views Matter

This view communicates the system’s goals and boundary without getting bogged down in the technical details. It does not need to show every internal step of the checkout process (such as validating a credit card number or checking stock levels). Instead, it provides a high-level map of the system’s functionality.

Using tools like Visual Paradigm UML or the VPasCode Tool allows you to translate these high-level concepts into executable specifications. By modeling the “Place Order” interaction first, you can identify dependencies on external systems early in the development lifecycle.

Conclusion

By mastering the Use Case View, you create a shared language between business stakeholders and technical teams. The Online Store example demonstrates how simple shapes and lines can effectively communicate complex system requirements, ensuring that everyone agrees on what the system is supposed to do before a single line of code is written.