-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature/define cafe order system #12
base: main
Are you sure you want to change the base?
Conversation
src/cafeordersimulator/beverage.py
Outdated
다양한 Beverage들을 구현하기 위한 Abstractive class | ||
""" | ||
|
||
def getdescription(self) -> str: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def getdescription(self) -> str: | |
def get_description(self) -> str: |
으로 끊어주면 어떨까요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넵 피드백 감사합니다
src/cafeordersimulator/beverage.py
Outdated
|
||
Args: | ||
None | ||
|
||
Returns: | ||
None | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
input이나 return이 없는 경우, 작성하지 않는 것을 표준으로 하겠습니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넵 확인했습니다 다음 커밋 시 반영하겠습니다.
src/cafeordersimulator/beverage.py
Outdated
|
||
|
||
class HouseBlend(Beverage): | ||
"""summary |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
summary
단어 제거 부탁합니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넵 알겠습니다!
Thx for your comment @Kimdongui |
Co-authored-by: Kim dong hyun, 김동현 <rkdqus2006@naver.com>
Args: | ||
None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이부분 제거되어도 좋을듯합니다!
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이부분 딕셔너리를 활용하는 건 별로일까요..?
설명을 덧붙이는 함수 | ||
|
||
Returns: | ||
beverage의 이름 + ", 모카" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type
도 같이 명시 하면 좋을 것 같습니다!
|
||
|
||
def main() -> None: | ||
"""summary |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
제거!
from abc import ABCMeta, abstractmethod | ||
|
||
|
||
class Beverage(metaclass=ABCMeta): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
경현 said : 해당 메서드도 abstractmethod
데코레이터가 필요할 것 같습니다.
self._beverage = bevarage | ||
|
||
@property | ||
def beverage(self) -> Beverage: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
추상클래스에서 property
나 abstractmethod
데코레이터로 감싸진 메서드는 재정의되야 인스턴스를 생성할 수 있다고 알고있는데, CondimentDecorator
를 상속받은 Mocha
에서 beverage
를 재정의안해주는데 인스턴스가 생성될까요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
검색 키워드 : 프로퍼티
Description: | ||
다양한 Beverage들을 구현하기 위한 Abstractive class | ||
""" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get_description
은 abstract 메소드가 안붙어있는 이유가 있나요?
Description: | ||
cost 계산시 size에 따라서 cost를 계산해준다. | ||
Returns: | ||
beverage cost + size depends cost |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Description과 Returns 사이에 공백 있고 없고 통일하면 좋을 것 같습니다.
|
Changes?
데코레이터 패턴을 위한 코드 추가
Why we need?
데코레이터 패턴 학습
Test?
cafe_order_test.py를 통해 테스트
Checklist
Anything Else? (Optional)
없음