Domain Driven Design: Ubiquitous Language

April 18, 2024

Introduction

Ubiquitous Language is a core concept in Domain Driven Design (DDD). Eric Evans, the founder of DDD, defines Ubiquitous Language as “a language that is used by everyone (developers, analysts, domain experts) involved in a project”. This language represents the concepts and terminology of the domain and captures the essence of the domain.

image

Characteristics

  • Domain-specific: It reflects the concepts and terms of the domain.
  • Used by all team members: It is used as a common language by domain experts, software developers, testers, and other team members.
  • Clear and understandable: It is a simple and clear language that can be easily understood by all team members.
  • Evolves: It evolves and changes over time as knowledge and understanding of the domain increases.

Benefits

  • Better communication: It helps in better communication between domain experts and software developers.
  • Better domain modeling: It enables a better understanding of the domain and the creation of a more robust domain model.
  • Better software: It contributes to the development of software that better meets the needs of the domain.

Usage

Ubiquitous Language should be used throughout all phases of a software project. Here are some examples of how Ubiquitous Language can be used:

  • When specifying and expressing the requirements of the software.
  • When designing and architecting the software.
  • When writing and testing the code of the software.
  • When writing the documentation of the software.

Creation

The following steps can be followed to create Ubiquitous Language:

  1. Communicate with domain experts: Meet with domain experts to learn about the domain and its terminology.
  2. Identify key concepts and terms: Identify the key concepts and terms that form the basis of the domain.
  3. Clarify definitions and relationships: Clarify the definitions of each concept and term and their relationships with each other.
  4. Create a common language: Work with domain experts and software developers to create a common language.
  5. Continuously improve the language: Continuously improve the language as knowledge about the domain and software is gained.

Examples

Let’s assume that Ubiquitous Language is being created for an e-commerce project. In this project, terms and concepts such as “product”, “order”, and “customer” can be used. The meanings and usage of these terms can be documented as follows:

  • Customer: A person who shops on the e-commerce website.
  • Product: A good or service sold on the e-commerce website.
  • Order: A list of products that a customer wants to purchase.
  • Cart: A virtual space used to temporarily store the products that a customer wants to purchase.
  • Payment: The amount that a customer pays for an order.

These terms and concepts will be understood in the same way by all stakeholders in the project. When developers use these terms in the code, they will be using the language of the domain experts. This will ensure that the software better meets the real needs of the business domain.

Conclusion

Ubiquitous Language is one of the most important principles of DDD. Effective application of this principle ensures that the software is more understandable, flexible, and open to evolution.

Further Information

Twitter