Skip to content
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

Model View Controller refactoring Flow #34

Open
77unny opened this issue Mar 14, 2020 · 3 comments
Open

Model View Controller refactoring Flow #34

77unny opened this issue Mar 14, 2020 · 3 comments

Comments

@77unny
Copy link
Collaborator

77unny commented Mar 14, 2020

@reesekimm
Model, View, Controller 의 역할 및 흐름을 다시한번 정의 해보았습니다.
모델과 뷰사이의 역할을 정의하자니 컨트롤러에서도 역할을 정의해야 흐름이 쉽게 그려지더라구요.. ㅎㅎ
확인 부탁드립니당!

VendingMachine Diagram

추가) view 영역에서 '타입' => 구독한 모델 로 이해하시면 됩니다!

@77unny
Copy link
Collaborator Author

77unny commented Mar 14, 2020

그리다보니까 진짜 현실에서 자판기의 역할, 그리고 사람이 가지고 있는 지갑의흐름이 매우 매우 매우 비슷하네요?!!!

@reesekimm
Copy link
Collaborator

reesekimm commented Mar 15, 2020

@baekCode 고생하셨어요!
내일부터 코드 작성 들어가믄 되겠네요~!

한가지 .. 구매 이벤트가 발생했을 때 walletModel도 구매한 아이템 가격을 알아야 wallet data를 업데이트 할 수 있을텐데.. 이거 생각해봐야겠네여ㅎ
controller가 item data를 알고 있어야 하나 싶기도 하고요.

@reesekimm
Copy link
Collaborator

구매 이벤트가 발생했을 때 walletModel도 구매한 아이템 가격을 알아야 wallet data를 업데이트 할 수 있을텐데.. 이거 생각해봐야겠네여ㅎ
controller가 item data를 알고 있어야 하나 싶기도 하고요.

이슈 해결 (3/16 월)

크롱에게 자문을 구하고 @baekCode 와 논의해본 결과,
VendingMachineModel에서 초기 data fetch 성공시 localStorage에 cache하고 controller 가 참조할 수 있도록 처리하기로 결정

onPurchase 이벤트 발생시

  • VendingMachineModel은 ItemPanelView, StatePanelView에게 notify
  • WalletModel은 controller로부터 구매된 아이템 가격을 전달받아 WalletView에게 notify

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants