architecture

Clean-architecture 계층 entities layer

코드모헨 2024. 4. 29. 17:31
clean architecture의 가장 안쪽의 있는 계층
Entities layer에 대해 정리한다.

clean architecture layers -출처 clean-architectures-in-python

 

1. 어떤 내용이 들어갈까?

이 계층은 도메인 모델의 구현체가 들어가게 된다.

간단히 말하자면 앱을 만들때 상호작용하는 특정한 구현체들이 들어간다 보면된다.

 

※ 단, String 같은 파이썬에서 전반적이고 일반적인 사용되는 모델이 들어가는게 아니라, 앱 기준으로 특징을 기준으로 고립시켜 사용할 모델을 넣는다.

ex) 예약 플랫폼에서 delux Room, suite room 

 

책 clean-architectures-in-python에서는 다음과 같이 말하고 있다.

If your project was a tool to analyse medieval manuscripts, however, you might need to isolate sentences and their features, and at this point it might be reasonable to define a specific entity.

 

 

2. 엔티티 계층의 특징

일반적인 django의 model과는 다르다.

 

entities는 django의 model과 다르게 storage에 직접적으로 연결되어 있지 않다.

django에서는 migration을 통해 db와 연결하지만 entities는 그저 파이썬 class일 뿐인다.

그렇기에 entities db에 바로 json을 dump할수 없다.

그래서 lightweight model이라 부른다. 

'architecture' 카테고리의 다른 글

Clean-architecture 계층 Use Case layer  (0) 2024.04.29
클린 아키텍쳐 파이썬- django  (0) 2024.04.25