image from Use Cases in the Work of a Tech Lead

Use Cases in the Work of a Tech Lead

Welcome back to the #TechLead series! In the previous article, we discussed the basics of Event Storming - Big Picture. Today, we continue our journey through the world of use cases, focusing on practical application and examples.

Use Cases – A Quick Recap

Use cases are extremely useful tools in system analysis and design. They allow us to gather business-technical information needed to implement a specific functionality in one place.

Use cases describe a list of actions to achieve a desired result, categorizing information such as goals, steps, exceptions, and errors. They act as a bridge between business and technical aspects, outlining technological elements in a way that is easy to present while avoiding unnecessary details at this stage.

Practical Scenario of Use Cases

To better understand the practical application of this tool, let’s analyze a common industry scenario. Imagine we are working on an e-commerce system that needs to synchronize products with an external PIM system every two hours.

Our model looks as follows:

Title: Synchronizing Products with the PIM System

Trigger: Two hours have passed since the last synchronization

Main Scenario:

  1. Query the client’s system for products added in the last two hours
  2. External system returns new products
  3. Check for duplicates returned by PIM
  4. Save products in the e-commerce system
  5. Start the publishing process on the website

Exceptions:

  1. 1a. External system returns error 429.
    • Queue the query for one minute later.
  2. 1b. External system returns error 500.
    • Log the communication error.
    • Notify administrators if synchronization fails for one hour. Quality Attributes:
  • Scalability: The system handles up to 200 products per synchronization session.
  • Performance: Synchronization completed in under 10 seconds.

This model looks simple but effectively simplifies the problem and highlights the most important aspects of the use case.

Simplified Use Cases by Martin Fowler

While use cases are powerful tools, they are not without flaws. Practitioners once had a tendency to expand scenarios indefinitely, leading to unreadable use cases. Martin Fowler first proposed a solution in his 1997 book, “UML Distilled”.

Unlike traditional approaches, Fowler’s use cases focus on system functionalities rather than actors. Fowler’s use case diagrams show typical interactions between a user and a computer system, capturing a user-visible function and achieving a discrete user goal.

Given When Then Approach

Another approach to use cases is Given When Then, a very specific and formalized perspective, ideal for cases where the end-user is not the only recipient of the scenario. This method describes use cases in three sections:

  • Given (Input Data)
  • When (User Actions)
  • Then (Expected Results)

Jakub Nabrdalik showcased this approach well in his presentation titled Things that work for me so well I cannot believe you are not using it:

This structure offers numerous benefits, especially facilitating test automation. By precisely describing input data, user actions, and expected results, a use case can easily be transformed into a test scenario. Given When Then also improves communication between the project team, testers, and developers, making it ideal for systems that include user interactions and test management.

Utilizing Use Cases

Use cases are valuable practices that enable quick summarization of the scope of work for a specific task. Their structure ensures consistency and clarity in analyzing individual functionalities.

For example, in the Upstream Kanban technique:

A developer can take on a task and analyze its implementation. Then, they create a description of the scenario in the form of use cases. This way, during a meeting aimed at further refinement, the team already has a preliminary idea of the functionality. As a result, communication is more effective and productive.

Recommendations

Use cases are truly multifunctional tools – they serve not only as the basis for documentation but also, when properly prepared, help in effective planning, analysis, and task execution.

If you’re interested in this topic, I encourage you to explore additional materials:

comments powered by Disqus