Skip to Content
파이썬으로 살펴보는 아키텍처 패턴
book

파이썬으로 살펴보는 아키텍처 패턴

by 오현석, 해리 퍼시벌, 밥 그레고리
June 2021
Beginner to intermediate
356 pages
8h 13m
Korean
Hanbit Media, Inc.
Content preview from 파이썬으로 살펴보는 아키텍처 패턴
348
3
부록
E.5
의미론 검증하기
문법은 메시지의 구조에 대해 다루지만,
의미론
은 메시지의
을 검증한다. ‘
4
번 족구에 버스
를 지각하라’라는 문장은 ‘
5
번 주문에 찻주전자를 할당하라’와 문장 구조는 같지만 아무 뜻도 없
다.
다음
JSON
블롭을
Allocate
명령으로 읽어도 명령이
의미가 없어서
성공적으로 실행하지 못
할 수도 있다.
{
“orderid”: “superman”,
“sku”: “zygote”,
“qty”: -1
}
계약 기반 프로그래밍
contract
-
based
programming
의 일종을 사용해 메시지 핸들러 계층에서 의미를 검
증하는 경향이 있다.
사전조건(
src
/
allocation
/
ensure
.
py
)
“””
이 모듈에는 핸들러에 적용할 수 있는 사전조건이 있다.
"""
class MessageUnprocessable(Exception): # ①
def __init__(self, message):
self.message = message
class ProductNotFound(MessageUnprocessable): # ②
""""
데이터베이스에 존재하지 않는 상품에 대한 액션을
수행하려고 시도하면 예외가 발생한다.
""""
def __init__(self, message):
super().__init__(message)
self.sku ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

효율적인 리눅스 명령어 사용의 기술

효율적인 리눅스 명령어 사용의 기술

Daniel J Barrett
쿠버네티스를 활용한 클라우드 네이티브 데브옵스

쿠버네티스를 활용한 클라우드 네이티브 데브옵스

최경현, 저스틴 도밍거스, 존 어런들

Publisher Resources

ISBN: 9791162244319