-
Notifications
You must be signed in to change notification settings - Fork 133
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
Step3 : 업무 중 대기 (리나) #19
Conversation
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.
고생하셨습니다.
몇가지 코멘트 남겨놨습니다.
추가로 두가지 질문 더 드릴께요.
- client 는 구조체인데 init 함수를 따로 만들어준 이유가 있나요?
- initTellers 는 Clients 에서 client 들을 init 하는 것처럼 Tellers 객체를 만들어서 선언하지 않은 이유가 있나요?
for teller in self.tellers { | ||
if self.clients.count == 0 { | ||
for teller in tellers { | ||
if clients.count == 0 { |
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.
self. 를 지운 이유는 무엇인가요?
guard let businessType = BusinessType.allCases.randomElement(), let priority = Client.Priority.allCases.randomElement() else { | ||
return | ||
} | ||
list.append(Client(waitingNumber: waitingNumber, businessType: businessType, priority: priority)) | ||
let clinet = Client(waitingNumber: waitingNumber, businessType: businessType, priority: priority) | ||
list.append(clinet) | ||
} | ||
} | ||
} |
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.
보통 하나의 파일에 하나의 타입만을 저장합니다.
Clients 를 따로 파일로 빼내는 것은 어떨까요?
@@ -22,6 +22,8 @@ enum Message { | |||
static let close = "업무가 마감되었습니다. 오늘 업무를 처리한 고객은 총 %d명이며, 총 업무시간은 %.2f초입니다." | |||
static let tellerStart = "%d번 %@고객 %@업무 시작" | |||
static let tellerFinish = "%d번 %@고객 %@업무 완료" | |||
static let loanStart = "%d번 %@고객 %@심사 시작" | |||
static let loanFinish = "%d번 %@고객 %@심사 완료" | |||
} | |||
|
|||
enum BusinessType: CaseIterable, CustomStringConvertible { |
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.
보통 하나의 타입을 하나의 파일에 저장합니다. enum 들도 따로 파일로 저장하는 건 어떨까요?
continue | ||
} | ||
|
||
switch command { | ||
case .start: | ||
let randomNumber = Int.random(in: minClientCount...maxClientCount) | ||
let clients = Clients.init(count: randomNumber) | ||
let clients = Clients(count: randomNumber) | ||
bank.operateBank(teller: tellerCount, client: clients.list) |
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.
bank.operateBank 라는 부분은 조금 어색한 것 같네요.
은행이 은행을 운용한다는 뜻으로 보이는데 조금 개선해볼 수 있을까요?
안녕하세요 도미닉! 매번 빠른 피드백 감사합니다.🙇🏻♀️ [1번]
step1에서는 고객의 등급은 일반 [2번]
[3번]
그 곳에서 dispatchQueue의 사용을 시도할때 입력했다가 지우지 않았었는데, [4번]
네이밍은 항상 어렵네요💦 추가 수정
하단의 추가 커밋도 확인 부탁드리겠습니다!! |
놓쳤었네요. 고생하셨어요~ |
|
안녕하세요~🙇🏻♀️
[Step3]
HeadOffice를 싱글턴으로 생성
Teller는 Client의 BusinessType에 따라 handleLoan 또는 handDeposit 호출
step3에 필요한 문구가 추가되었고, 다시보니 고치면 좋을 것 같은 것도 수정해보았습니다!
[고민]
기존에 만들어두었던 enum 중 BusinessType은
고객이 어떤 업무를 보는지 가지고 있는 형태로, 은행원이 확인하고 이에 따른 행동을 하기 위해 만든 enum이었습니다.
여기에 시간 정보도 담고 있었는데요.
기존에 있던 대출 1.1초가 0.3초, 0.3초, 0.5초로 나뉘어져 동작을 하는데
0.3초 두번은 Teller가 업무를 보는 것이라 동일하게 생각해 2번 동작하고,
0.5초는 본사가 진행하는 것이라, HeadOffice가 가지고 있으면서 사용합니다.
그런데 이 0.3초 두번과 0.5초 한번을 따로 관리해야할지...
0.3초 두번이 은행원이 시간은 똑같이 쓰지만 다른 행동으로 봐야할지;;
지금과 같은 방법으로 진행해도 괜찮을지 고민입니다🤦🏻♀️
리뷰부탁드립니다!
감사합니다😄