-
Notifications
You must be signed in to change notification settings - Fork 132
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] 토이, 쥬봉이 #330
base: ic_10_toy123
Are you sure you want to change the base?
Changes from all commits
77a0506
d128f7e
d5ba69a
3d5f009
108e79b
4e3b66e
0df2dae
bef067d
bd60560
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// | ||
// Banking.swift | ||
// | ||
// | ||
// Created by jyubong, Toy on 11/22/23. | ||
// | ||
|
||
public enum Banking: String, CaseIterable { | ||
case deposit = "예금" | ||
case loan = "대출" | ||
} | ||
Comment on lines
+8
to
+11
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
public protocol CustomerNumbering { | ||
var number: UInt { get } | ||
var banking: Banking? { get } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 굳이 옵셔널일 필요가 있을까요? |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,20 +8,29 @@ import Foundation | |
import BankManager | ||
|
||
struct BankClerk: CustomerReceivable { | ||
private let pace = 0.7 | ||
private let work: Banking | ||
private var pace: Double { | ||
switch work { | ||
case .deposit: | ||
return 0.7 | ||
case .loan: | ||
return 1.1 | ||
} | ||
} | ||
Comment on lines
+11
to
+19
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 저는 이 정보가 은행원보다는 |
||
private let startWork: (String) -> Void | ||
private let endWork: (String) -> Void | ||
|
||
init(startWork: @escaping (String) -> Void = { print($0) }, endWork: @escaping (String) -> Void = { print($0) }) { | ||
init(work: Banking, startWork: @escaping (String) -> Void = { print($0) }, endWork: @escaping (String) -> Void = { print($0) }) { | ||
self.work = work | ||
self.startWork = startWork | ||
self.endWork = endWork | ||
} | ||
|
||
func receive(customer: Customer) { | ||
let number = customer.number | ||
|
||
startWork("\(number)번 고객 업무 시작") | ||
startWork("\(number)번 고객 \(work.rawValue)업무 시작") | ||
Thread.sleep(forTimeInterval: pace) | ||
endWork("\(number)번 고객 업무 종료") | ||
endWork("\(number)번 고객 \(work.rawValue)업무 종료") | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,74 @@ | ||
## iOS 커리어 스타터 캠프 | ||
# 💰 은행창구 매니저 | ||
은행에서 여러명의 은행원이 동시에 고객의 업무를 나누어 처리하는 앱 | ||
|
||
### 은행 매니저 프로젝트 저장소 | ||
--- | ||
## 🔎 목차 | ||
- [팀원](#-팀원) | ||
- [타임라인](#-타임라인) | ||
- [UML](#-UML) | ||
- [실행 화면](#-실행-화면) | ||
- [트러블 슈팅](#-트러블-슈팅) | ||
- [참고 링크](#-참고-링크) | ||
|
||
- 이 저장소를 자신의 저장소로 fork하여 프로젝트를 진행합니다 | ||
--- | ||
## 👥 팀원 | ||
|쥬봉이🐱|토이🐶| | ||
|---|---| | ||
|<img src="https://avatars.githubusercontent.com/u/126065608?v=4" width="200" height="200">|<img src="https://avatars.githubusercontent.com/u/123448121?v=4" width="200" height="200">| | ||
|[쥬봉 GitHub](https://github.com/jyubong)|[토이 GitHub](https://github.com/DevWooHyeon)| | ||
|
||
|
||
## 📅 타임라인 | ||
|날짜|내용| | ||
|------|---| | ||
|23.11.13|- 공식문서 등 각자 공부| | ||
|23.11.14|- Queue, LinkedList 구현 <br> - Queue UnitTest| | ||
|23.11.15|- SPM <br> - SPM내 Protocol 및 BankManager 구현 <br> - Console App내 protocol을 채택한 실제 타입 구현| | ||
|23.11.16|- ConsoleManager 구현| | ||
|23.11.17|- 코드 리팩토링 <br> - BankClerk을 test에 용이하도록 수정(클로저 주입)| | ||
|23.11.20 ~ 23.11.21|- concurrency programming 공부(GCD, Operation 등)| | ||
|23.11.22|- GCD로 3명의 은행원이 비동기적으로 업무를 처리하도록 구현 | | ||
|23.11.23|- 은행원수만큼 스레드 제한하는 방법, DispatchQueue와 OperationQueue 비교 등 피드백 받은 부분 공부| | ||
|23.11.24|- ReadMe 작성 | | ||
|
||
## 👀 UML | ||
|
||
|
||
## 💻 실행 화면 | ||
| 첫번째 은행개점 | 두번째 은행개점 + 종료 | | ||
| -------- | -------- | | ||
| ![gcd1](https://hackmd.io/_uploads/BkB-_2TN6.gif) | ![gcd2](https://hackmd.io/_uploads/r1imu2pNa.gif) | | ||
|
||
|
||
## 🔥 트러블 슈팅 | ||
|
||
|
||
|
||
## 📚 참고 링크 | ||
[애플공식문서 - Protocols](https://docs.swift.org/swift-book/documentation/the-swift-programming-language/protocols/) | ||
[애플공식문서 - Generics](https://docs.swift.org/swift-book/documentation/the-swift-programming-language/generics) | ||
[애플공식문서 - Dispatch](https://developer.apple.com/documentation/DISPATCH) | ||
[애플공식문서 - Operation](https://developer.apple.com/documentation/foundation/operation) | ||
[애플공식문서 - OperationQueue](https://developer.apple.com/documentation/foundation/operationqueue) | ||
[야곰닷넷 Concurrency](https://yagom.net/courses/%eb%8f%99%ec%8b%9c%ec%84%b1-%ed%94%84%eb%a1%9c%ea%b7%b8%eb%9e%98%eb%b0%8d-concurrency-programming/) | ||
|
||
|
||
--- | ||
### 팀 회고 | ||
<details> | ||
<summary>우리팀이 잘한 점</summary> | ||
|
||
|
||
</details> | ||
|
||
<details> | ||
<summary>우리팀이 개선할 점</summary> | ||
|
||
|
||
</details> | ||
|
||
<details> | ||
<summary>서로에게 피드백</summary> | ||
|
||
|
||
</details> |
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.
한번에 최대 실행될 수 있는 작업의 수는 3개인데, 생성된 쓰레드의 수는 3개보다 훨씬 많네요.
총 3개의 쓰레드만 생성하고싶다면 어떻게 해야할까요?