-
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
Step 2 : 우선순위와 다중처리 (리나) #15
Conversation
semaphore를 제거하고, dispatchGroup으로 변경 및 teller의 dispatchQueue를 사용하는 곳 변경
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 Priority: Comparable, CaseIterable { | ||
case VVIP | ||
case VIP | ||
case normal |
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.
case 이름을 일반으로 하지 않은 이유가 있나요?
class Dashboard { | ||
struct Dashboard { |
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 Message: String { | ||
case close = "업무가 마감되었습니다. 오늘 업무를 처리한 고객은 총 %d명이며, 총 업무시간은 %.2f초입니다." | ||
case tellerStart = "%d번 고객 업무 시작" | ||
case tellerFinish = "%d번 고객 업무 완료" | ||
enum Message { | ||
static let close = "업무가 마감되었습니다. 오늘 업무를 처리한 고객은 총 %d명이며, 총 업무시간은 %.2f초입니다." | ||
static let tellerStart = "%d번 %@고객 %@업무 시작" | ||
static let tellerFinish = "%d번 %@고객 %@업무 완료" | ||
} |
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.
case 을 static let 으로 바꾼 이유는 무엇인가요?
private func initClients(_ number: Int) -> [Client]? { | ||
var clients: [Client] = [] | ||
|
||
for waitingNumber in 1...number { | ||
guard let businessType = BusinessType.allCases.randomElement(), let priority = Client.Priority.allCases.randomElement() else { | ||
return nil | ||
} | ||
|
||
clients.append(Client(waitingNumber: waitingNumber, businessType: businessType, priority: priority)) | ||
} | ||
return clients | ||
} |
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]를 저장하는 Clients라는 객체를 만들어볼 수 있을까요?
안녕하세요 도미닉!🙇🏻♀️ [1번]
case 이름은.. 저에게 프로퍼티명이라고 생각되어서요! [2번]
처음에는 싱글톤을 만들려고 했다가, ++ 그런데 혹시 이 부분을 enum으로해서 fake name space(아래 3번에서 사용한 enum처럼?!)처럼 사용하는게 더 나을까요? [3번]
enum에서 case들을 사용할때 rawValue로 접근하거나, var description 등을 만들어서 사용하는 것보다 [4번]
저도 어색하다고 생각했던 부분인데, 이런 방법이 있었군요! 리뷰해주셔서 감사합니다🙇🏻♀️ |
1번 - description을 프로퍼티명으로 많이 사용하셨던데 CustomStringConvertible 프로토콜을 활용해보는 건 어떨까요? DispatchQueue 와 한가지 더 기본적으로 제공되는 큐가 있는데 DispatchQueue 를 선택한 이유가 있을까요? |
빠른 답변 감사합니다!!👍 [1번]
아, 제가 사용하고싶었던 description이 [추가]
한 가지 더 기본적으로 제공되는 큐가 Operation Queue를 말씀하시는거겠죠?! Operation Queue도 Dispatch Queue와 비슷한 기능을 하고, 내부적으론 Dispatch Queue 위에서 동작한다고 알고 있습니다. |
고생하셨습니다~ |
* feat: 고객10명추가 버튼, 초기화 버튼을 view에 추가 * feat: businessHoursLabel를 view에 추가 * feat: waitLabel, workLabel을 BankView에 추가 * feat: CustomView 구현 * feat: customerStackView, waitStackView, workStackView view에 추가 * feat: baseStackView 구현 및 레이아웃 설정 * feat: CustomerView layout 설정 * refactor: baseStackView layout 조정, businessHoursLabel 컬러 변경 Co-authored-by: dudu <whqtkf12@naver.com>
[step2 구현]
Priority
생성 후 priority를 기준으로 Comparable extension하여 sorted 할 수 있도록 함리뷰 부탁드립니다🙇🏻♀️