The Data Flow

Let’s learn about the data flow of clean architecture.

In this chapter, we’ll introduce a very simple system designed with clean architecture. The purpose of this introductory chapter is to familiarize ourselves with the main concepts of clean architecture, such as separation of concerns and inversion of control, which are both very important in system design.

In this chapter, as we describe how data flows in the system, we’ll purposefully omit details so that we may focus on the global idea and not worry too much about its implementation. We’ll look more closely at our example again—including why we make specific choices—in the chapters that follow. For now, we’ll focus on the big picture.

For this course, we’ve chosen to design a simple web application that provides a system for renting rooms. Let’s call our application Rent-o-Matic. The URL http://www.rentomatic.com is where our application is located.

Let’s now imagine that a user wants to see the available rooms on Rent-0-Matic. They open the application on their browser and, using the menus on the website, find the page that contains a list of all the rooms our company rents. We’ll say that the URL is /rooms?status=available for this page. When the user’s browser accesses this URL, an HTTP request is sent to our system. We have a component that waits for HTTP connections called the web framework.

Web framework

The purpose of the web framework is to understand the HTTP request and to retrieve the data that we need to provide a response. In our example, the request has two crucial parts: the endpoint itself (/rooms) and a single query string parameter (status=available). Endpoints act as commands to our system. So, when a user accesses one of them, they send a signal to our system that a specific service has been requested—in our case, to provide a list of all the rooms that are available for rent.

Get hands-on with 1400+ tech skills courses.