Conversation
src/cafeordersimulator/beverage.py
Outdated
| 다양한 Beverage들을 구현하기 위한 Abstractive class | ||
| """ | ||
|
|
||
| def getdescription(self) -> str: |
There was a problem hiding this comment.
| def getdescription(self) -> str: | |
| def get_description(self) -> str: |
으로 끊어주면 어떨까요?
|
|
||
| Args: | ||
| None | ||
|
|
||
| Returns: | ||
| None | ||
| """ |
There was a problem hiding this comment.
input이나 return이 없는 경우, 작성하지 않는 것을 표준으로 하겠습니다!
There was a problem hiding this comment.
넵 확인했습니다 다음 커밋 시 반영하겠습니다.
src/cafeordersimulator/beverage.py
Outdated
|
|
||
|
|
||
| class HouseBlend(Beverage): | ||
| """summary |
|
Thx for your comment @Kimdongui |
Co-authored-by: Kim dong hyun, 김동현 <rkdqus2006@naver.com>
| Args: | ||
| None |
| if self._beverage.get_size() == "tall": | ||
| beverage_cost += 0.10 | ||
| elif self._beverage.get_size() == "grande": | ||
| beverage_cost += 0.15 | ||
| elif self._beverage.get_size() == "venti": | ||
| beverage_cost += 0.20 |
There was a problem hiding this comment.
이부분 딕셔너리를 활용하는 건 별로일까요..?
| 설명을 덧붙이는 함수 | ||
|
|
||
| Returns: | ||
| beverage의 이름 + ", 모카" |
|
|
||
|
|
||
| def main() -> None: | ||
| """summary |
| from abc import ABCMeta, abstractmethod | ||
|
|
||
|
|
||
| class Beverage(metaclass=ABCMeta): |
There was a problem hiding this comment.
https://docs.python.org/ko/3/library/abc.html
: abstractmethod 이 데코레이터를 사용하려면 클래스의 메타 클래스가 [ABCMeta]이거나 여기에서 파생된 것이어야 합니다.
라고 공식문서에 적혀있습니다.
| def __init__(self): | ||
| self.size = "tall" | ||
|
|
||
| def get_description(self) -> str: |
There was a problem hiding this comment.
경현 said : 해당 메서드도 abstractmethod 데코레이터가 필요할 것 같습니다.
| self._beverage = bevarage | ||
|
|
||
| @property | ||
| def beverage(self) -> Beverage: |
There was a problem hiding this comment.
추상클래스에서 property 나 abstractmethod 데코레이터로 감싸진 메서드는 재정의되야 인스턴스를 생성할 수 있다고 알고있는데, CondimentDecorator를 상속받은 Mocha에서 beverage를 재정의안해주는데 인스턴스가 생성될까요?
| Description: | ||
| 다양한 Beverage들을 구현하기 위한 Abstractive class | ||
| """ | ||
|
|
There was a problem hiding this comment.
get_description은 abstract 메소드가 안붙어있는 이유가 있나요?
| Description: | ||
| cost 계산시 size에 따라서 cost를 계산해준다. | ||
| Returns: | ||
| beverage cost + size depends cost |
There was a problem hiding this comment.
Description과 Returns 사이에 공백 있고 없고 통일하면 좋을 것 같습니다.
|
|
Changes?
데코레이터 패턴을 위한 코드 추가
Why we need?
데코레이터 패턴 학습
Test?
cafe_order_test.py를 통해 테스트
Checklist
Anything Else? (Optional)
없음