> For the complete documentation index, see [llms.txt](https://heunnajo.gitbook.io/spring/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://heunnajo.gitbook.io/spring/1/undefined-3.md).

# 주문과 할인 도메인 설계

1. **주문과** **할인** **도메인** **설계**

![주문, 할인 도메인 설계](https://3827409906-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MdFkJ5hOZX5yyMKQHqf%2F-MdQP1vo0QsecCo0wZXr%2F-MdQXENzqdrNPwRP51Li%2Fimage.png?alt=media\&token=03657847-2e19-4391-9e29-beaade2bcff1)

1. **클라이언트는** **주문** **서비스에** **주문** **생성을** **요청한다.**
2. **회원** **조회** **:** **할인을** **위해서는** **회원등급** **필요하다!**\
   &#x20;**=>** **주문서비스는** **회원** **저장소에서** **회원을** **조회한다.**
3. **할인** **적용** **:** **주문** **서비스는** **회원** **등급에** **따른** **할인** **여부를** **할인** **정책에** **위임한다.**
4. **주문** **결과** **반환** **:** **주문서비스는** **할인** **결과를** **포함한** **주문** **결과를** **반환한다.**\
   **(실제로는 상품 item 객체가 존재하고, 주문 데이터는 DB에 저장하지만 예제를 단순화하기 위함)**

**2. 주문 도메인 전체(역할과 구현 분리한 그림)**\
**역할을 먼저 만들고 그 다음에 구현을 만든다!위의 역할 다이어그램에 구현을 추가하면 다음과 같다!**

![역할과 구현을 분리](blob:https://app.gitbook.com/a73ca3d4-048d-46ab-834d-3b5fd85b77fa)

이제 구현으로 넘어와서 정적 다이어그램(클래스 다이어그램)과 동적 다이어그램(객체 다이어그램)을 그려본다!

3\. 클래스 다이어그램 - 주문 도메인 클래스 다이어그램\
실제 등장하는 클래스들의 관계를 다이어그램으로 나타낸다!

![](https://3827409906-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MdFkJ5hOZX5yyMKQHqf%2F-MdQY2Lq8TsooziJ-p1i%2F-MdQ_cAbfHPC_mZZbcnz%2Fimage.png?alt=media\&token=97d26ece-324f-4276-8ab0-3e90c628744a)

**4. 객체 다이어그램**

![메모리 저장소, 정액 할인 정책](blob:https://app.gitbook.com/c3a73637-9240-46b7-bbd9-813cfee0d008)

![DB 저장소, 정률 할인 정책](blob:https://app.gitbook.com/a7297ff9-d3ba-4712-86b4-912606e078d2)
