# Use Cases

We now need to create a **use case** for our **functional requirements.**

A **use case** in software development is a structured description of how a user (or system) interacts with a software application to achieve a specific goal. It defines:

* **Actors:** Who interacts with the system (e.g., user, external system).
* **Preconditions:** Conditions that must be met before the use case starts.
* **Main Flow:** The step-by-step process of how the interaction occurs.
* **Alternative Flows (if needed):** Variations or exceptions to the main flow.
* **Postconditions:** The expected outcome or result after the use case is completed.

***

{% hint style="info" %}
## Example of a Use Case - Rock Collection (REQUIRED)

**Actor:** User (Geologist / Rock Nerd)

**Preconditions:** Internet access; API with rock/mineral data is available.

**Main Flow:**

1. **Search Rock/Mineral** – User enters a rock/mineral name (e.g., Obsidian, Quartz); system retrieves and displays details.
2. **Store Rock** – User adds the rock to their collection; system confirms storage.
3. **Compare Rocks** – User selects rocks; system retrieves and displays comparisons (e.g., hardness, composition, rarity).
4. **Visualise Data** – System generates a graph comparing selected rocks.
5. **Remove Rock** – User deletes a rock from the collection; system updates storage.

**Postconditions:** Rock data is retrieved, stored, compared, or removed successfully.
{% endhint %}

## Example of a Use-Case Diagram (NOT required)

<figure><img src="https://115028830-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhF2chp1dcxIJhlOQSKVq%2Fuploads%2FmGyfd2IWRje83hZxZgXQ%2Fimage.png?alt=media&#x26;token=99fad2a3-4f04-4db1-9005-4e0b9c83d198" alt=""><figcaption><p>Example: Use Case Diagram</p></figcaption></figure>
