Domain Models

Let’s learn about the importance of domain models in clean architecture.

The Room domain model

Let’s start with a simple definition of the Room domain model. As we mentioned before, clean architecture models are lighter than their counterparts in common web frameworks.

Implementing test case for initialization

Following the TDDTest-Driven Development methodology, the first thing we’ll write is the test. The test ensures that the model initializes with the correct values.

Press + to interact
import uuid
from rentomatic.domain.room import Room
def test_room_model_init():
code = uuid.uuid4()
room = Room(
code,
size=200,
price=10,
longitude=-0.09998975,
latitude=51.75436293,
)
assert room.code == code
assert room.size == 200
assert room.price == 10
assert room.longitude == -0.09998975
assert room.latitude == 51.75436293

Let’s make a note to create ...