Sarkel Tech
Software

Software Engeneering Requirements and Analysis

Date Published

Curving abstract shapes with an orange and blue gradient

Software Engineering: Requirements & Analysis

No matter how clean your code or architecture is, a system fails if it does not solve the actual problem faced by its users.

Key Pillars of Requirements & Analysis

1. Functional vs. Non-Functional Requirements

  • Functional Requirements: Specify the exact operations the system must perform or allow users to perform. They are documented with strong, definitive verbs such as must and shall.
    • Example: “A librarian must be able to search for books by author.”
  • Non-Functional Requirements: Define operational constraints such as performance, security, platform compatibility, and internationalization.
    • Example: “Book searches must return results in under 2 seconds.”
    • These are just as important as functional requirements. A feature-complete application will still fail if it is slow, insecure, or incompatible.

2. Requirement Elicitation Techniques

  • Interviews & Direct Observation: Clients often do not know exactly what they want. Engineers must observe real user workflows and build rapid prototypes to generate meaningful feedback.
  • Use Cases & User Stories: Model how actors—human users or external systems—interact across the application boundary to achieve a goal.
  • Domain Knowledge & Ubiquitous Language: Work directly with domain experts to establish a shared vocabulary and uncover hidden business rules. Techniques such as EventStorming visually map domain events, triggers, and business policies.

3. Requirements Quality & Specification

High-quality requirements must be:

  • Clear
  • Consistent
  • Correct
  • Complete
  • Realistic
  • Verifiable
  • Traceable

The agreed scope is captured in a Functional Specification or a prioritized agile backlog until a Requirements Freeze milestone is reached.

Example: E-Commerce Order Processing System

Step 1: Eliciting Requirements

Requirements define what the application must achieve and the constraints under which it operates.

Functional Requirements

  • A customer shall be able to browse available products in a product catalog.
  • The system must calculate the total cost of an order, including applicable taxes and discounts.
  • A customer must be able to place an order containing one or more order items.
  • The system shall verify inventory availability before finalizing any order.

Non-Functional Requirements

  • Performance: Order calculation and checkout processing must complete in under 2 seconds.
  • Security: All customer payment details must be encrypted in transit and at rest.
  • Scalability & Platform: The system shall run seamlessly across Linux server environments.

Step 2: Textual Analysis

A classic technique for deriving initial object-oriented designs is textual analysis of functional requirements:

  • Nouns become candidate classes or attributes.
  • Verbs become candidate methods.

Extracted Nouns

Extracted NounClass Candidate?Reason / Initial Assignment
CatalogYesManages the collection of available products.
ProductYesHolds individual item details: ID, name, price, stock quantity.
OrderYesRepresents a customer purchase transaction.
OrderItemYesHolds product references and quantities within an order.
Price / QuantityNoSimple numeric attributes rather than standalone entities.

Extracted Verbs

Extracted VerbAssociated ClassMethod Derived
browse / searchCatalogfind_products(query)
calculate totalOrdercalculate_total()
verify stockInventoryService / Cataloghas_sufficient_stock(quantity)
place / submitOrdercheckout()

Step 3: Initial Domain Class Design in Python

Following the Single Responsibility Principle (SRP), domain entities should remain lightweight. They should represent domain state and core business rules, isolated from database ORMs or web frameworks.

1from dataclasses import dataclass, field2from decimal import Decimal3from typing import List4 5 6# 1. Product Entity (Lightweight Domain Model)7@dataclass8class Product:9    id: str10    name: str11    price: Decimal12    stock_quantity: int13 14    def has_sufficient_stock(self, requested_qty: int) -> bool:15        return self.stock_quantity >= requested_qty16 17 18# 2. Value Object representing a line item within an order19@dataclass(frozen=True)20class OrderItem:21    product_id: str22    unit_price: Decimal23    quantity: int24 25    @property26    def subtotal(self) -> Decimal:27        return self.unit_price * Decimal(self.quantity)28 29 30# 3. Order Aggregate Root31@dataclass32class Order:33    order_id: str34    customer_id: str35    items: List[OrderItem] = field(default_factory=list)36    status: str = "PENDING"37 38    def add_item(self, product: Product, quantity: int) -> None:39        if not product.has_sufficient_stock(quantity):40            raise ValueError(41                f"Insufficient stock for product '{product.name}'."42            )43 44        item = OrderItem(45            product_id=product.id,46            unit_price=product.price,47            quantity=quantity48        )49        self.items.append(item)50 51    def calculate_total(52        self,53        tax_rate: Decimal = Decimal("0.08")54    ) -> Decimal:55        subtotal = sum(56            (item.subtotal for item in self.items),57            Decimal("0.00")58        )59        tax = subtotal * tax_rate60        return subtotal + tax

Key Takeaways from Phase 1

  • Clear Boundaries: Product and Order do not contain SQL queries, HTTP handlers, or JSON parsing. Those belong in outer infrastructure layers.
  • Iterative Design: This initial set of classes provides a clean baseline that will evolve as requirements freeze and development iterations proceed.

Résumé / Summary

This article introduces Phase 1: Requirements & Analysis in software engineering.

Its main points are:

  1. A system must solve the user’s real problem, not just be well-coded or well-architected.
  2. Requirements are divided into:
    • Functional requirements — what the system must do.
    • Non-functional requirements — constraints such as performance, security, and platform compatibility.
  3. Requirements are discovered through:
    • Interviews and direct observation.
    • Use cases and user stories.
    • Domain knowledge and ubiquitous language.
  4. High-quality requirements must be clear, consistent, correct, complete, realistic, verifiable, and traceable.
  5. A practical example—an E-Commerce Order Processing System—shows how to:
    • Elicit functional and non-functional requirements.
    • Extract candidate classes from nouns and methods from verbs.
    • Create a lightweight Python domain model following the Single Responsibility Principle.
  6. The resulting domain classes should remain free of infrastructure concerns such as SQL, HTTP, or JSON parsing. They form a baseline for later iterative development.