Java Omnibus
OOAD & Architecture / OOA / OOD process / Domain Modelling and CRC Cards
OOA/OOD Process Java Order Management
OOA / OOD Process

Domain modelling works best when you discover responsibilities before you lock in implementation details.

Domain modelling is where the vocabulary of the system starts to stabilize. Instead of talking in generic terms like 'service' or 'helper,' the team begins naming the actual concepts that matter: Order, Payment, Shipment, Reservation, Refund, Notification. CRC cards remain useful because they force a direct question: what is each concept responsible for, and with whom does it collaborate?

Why This Topic Matters

Why it matters in real Java systems

Without domain modelling, many Java systems end up with generic service layers wrapped around passive records. CRC-style thinking pulls responsibility back toward meaningful concepts and exposes early where a design is becoming too procedural.

Core Explanation

The design idea behind this process step

Domain modelling in OOAD is less about drawing boxes and more about choosing concepts that deserve first-class representation. CRC cards help because they keep the conversation simple: class, responsibility, collaborator. That format surfaces bloated objects, missing concepts, and unclear ownership quickly.

In a Java system, this process often influences aggregates, value objects, services, and package structure later on. It is much easier to build a coherent model if those responsibilities were argued in plain language before code existed.

The most valuable outcome is not a card deck. It is a shared, testable understanding of who owns which decisions.

Concept Breakdown

Key ideas to keep in view

Concept

Classes should reflect the domain

A class name should carry business meaning, not just technical convenience.

Concept

Responsibilities come before methods

Before listing APIs, ask what each object should know and do within the scenario.

Concept

Collaborations reveal seams

If one concept depends on too many others to do its job, the boundary may still be wrong.

Java Example

Java example in the Order Management domain

Java example: domain concepts discovered through CRC-style thinking
package org.javaomnibus.ecommerce.process;

public final class Order {
    private final OrderId orderId;
    private final CustomerId customerId;
    private PaymentStatus paymentStatus = PaymentStatus.PENDING;

    public Order(OrderId orderId, CustomerId customerId) {
        this.orderId = orderId;
        this.customerId = customerId;
    }

    public void markPaymentAuthorized() {
        if (paymentStatus != PaymentStatus.PENDING) {
            throw new IllegalStateException("Payment is already resolved");
        }
        paymentStatus = PaymentStatus.AUTHORIZED;
    }
}

public final class InventoryReservation {
    public void reserve(Order order) {
        // reserve stock for the order
    }
}

public enum PaymentStatus {
    PENDING, AUTHORIZED
}
Code Walkthrough

Step by step

  1. Order owns a business state transition rather than acting as a passive container.
  2. InventoryReservation exists because stock reservation is a distinct responsibility.
  3. The separation came from asking CRC questions, not from applying a framework template.
  4. The resulting classes are easier to grow because each was named around domain intent.
Real-World Usage

Where this process step shows up in practice

  • Domain discovery workshops before building a new Java service
  • Refactoring sessions where teams rename technical placeholders into domain concepts
  • Early package design for a modular monolith or bounded-context split
Trade-Offs

When to be careful

CRC cards can feel informal compared to heavier modeling approaches, but that simplicity is often their advantage. Use them to clarify responsibility, not to replace deeper design work entirely.

Common Mistakes

Frequent mistakes to watch for

  • Naming classes after layers instead of domain meaning
  • Assigning every responsibility to a single service because it feels convenient
  • Treating collaborators as implementation dependencies instead of conceptual relationships
  • Stopping at nouns and never discussing behavior
Related Pages

Related concepts


What To Read Next