Let’s start a series of posts about Domain-Driven Design 💻
As software engineers, we usually focus on the technical side and sometimes forget that the purpose of software is to provide value and business profit.
So, first lesson: It’s very important to understand how companies work, the business domain 🏢, and the problems we are solving.
Let's start with the business domain. What is it? 🤔
Basically, it is the main area of activity for a company. For example, Spotify's business domain is music streaming 🎵, Starbucks is known for its coffee ☕, and Zara for its clothing 👗. Other companies operate in multiple business domains, such as Amazon, which operates in retail and cloud computing.
Pretty clear so far, right? 👍
This is the first step. But you all know that the best approach to achieving goals is "divide and conquer". So, a domain is built from the combination of different subdomains.
What is a subdomain, then?
A subdomain is a fine-grained area of business activity. There are three types:
- Core subdomains 🥇
- Generic subdomains 🔄
- Supporting subdomains 🧩
However, these 'areas' are not equally important.
As you are probably imagining, the core subdomain is the most important. Essentially, it’s what a company does differently from its competitors. The sophisticated algorithm that Shazam uses to quickly match sounds to a large database is an example. There should be high entry barriers for a company's core business; it should be hard for competitors to copy or imitate the company's solution. If not, the profit is at risk! 🚨
Generic subdomains are business activities that all players are performing in much the same way. Examples? Authentication, encryption, payments. There is no need for innovation or optimization here. It's better to use a solution that has been tested and is secure, rather than creating a custom solution and reinventing the wheel.
Finally, supporting subdomains are those that are very simple. These areas of activity do not provide any competitive advantage for the company: CRUD operations, data extraction, transformation, etc. As the name suggests, they simply support the business.
Hope you liked it and learned something new. We will continue with different concepts in the following posts! 💡