-
Notifications
You must be signed in to change notification settings - Fork 0
[#10] 2주차 회고 시스템 리팩토링 #12
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
base: main
Are you sure you want to change the base?
Conversation
| - 여기선 회고 시스템의 작동만 담당하고 실제 작동은 executeMenu에서 실행 | ||
| - class이니까 protocol 사용도 좋을듯 | ||
| */ | ||
| class ReflectionSystem { |
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.
상속을 하지 않을거라면 final 키워드를 앞에 붙이는게 좋을 것 같습니다.
| if menu == 1 { addReflection() } | ||
| if menu == 2 { searchReflection() } | ||
| if menu == 3 { editReflection() } | ||
| if menu == 4 { deleteReflection() } | ||
| if menu == 5 { printAllReflection() } | ||
| if menu == 6 { exitProgram() } |
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.
메뉴를 열거형으로 만들어서 Switch 문을 활용하면 좋을 것 같습니다 !
| if menu == 1 { addReflection() } | |
| if menu == 2 { searchReflection() } | |
| if menu == 3 { editReflection() } | |
| if menu == 4 { deleteReflection() } | |
| if menu == 5 { printAllReflection() } | |
| if menu == 6 { exitProgram() } | |
| enum MenuOption: Int { | |
| case addReflection = 1 | |
| case searchReflection | |
| case editReflection | |
| case deleteReflection | |
| case printAllReflection | |
| case exitProgram | |
| } | |
| switch menu { | |
| case .addReflection: | |
| addReflection() | |
| case . searchReflection: | |
| searchReflection() | |
| case .editReflection: | |
| editReflection() | |
| case .deleteReflection: | |
| deleteReflection() | |
| case . printAllReflection: | |
| printAllReflection() | |
| case . exitProgram: | |
| exitProgram() | |
| } |
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을 사용하면 좋지만, enum을 사용할 필요성을 못 느끼신다면 적어도 If문보다는 switch-case문이 유지보수에도 좋은 구조일 것 같아요!
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.
CLI 뷰 작성을 잘하셨네요 ! 코드를 보니 사용자관점에서 고민을 하신 흔적이 잘 보입니다.
보면서 드는 생각은,,,
아마 강사님께서 파일을 나누셔서 그런거겠지만, 코드양에 비해 파일이 너무 세분화 되어있다고 생각합니다. BasicFunction, UserInput 등 묶는 것이 유지보수 측면에서도 좋아보입니다 !
P.S. 처음부터 쪼개서 작성하기 보다는 "코드를 작성하다보니 코드양이 비대해지네? 나눠봐야겠다"가 좋은 학습 방향일 것 같습니다.
| ┣ 📜 main.swift | ||
| ┗ 📜 Templete.swift | ||
| ``` | ||
| ## 추가되면 좋은 기능 |
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.
이런 설명 좋습니다! 파일 시스템도 깔끔하게 정리하셨네요!! Good!!
| /* | ||
| File: AddReflection.swift | ||
| Purpose: 특정 날짜에 회고 내용을 추가 | ||
|
|
||
| Data (사용하는 자료) | ||
| - date: String | ||
| - reflection: Reflection | ||
| - searchResult: Reflection? // 회고가 존재하지 않으면 nil | ||
|
|
||
| etc | ||
| - searchResult의 경우 추가한 회고에 대한 정보를 이용할만한게 있을까하여 남겨놓음 | ||
| */ |
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.
주석 스타일 깔끔하고 보기 좋습니다. Swift document 주석 스타일을 참고해보셔도 좋을 것 같아요!
#️⃣ 연관된 이슈
📝 작업 내용
🎨 스크린샷
💬 추가 설명
전체적으로 리팩토링을 진행했습니다
README 작성으로 프로젝트 이해하시는데 조금은 도움이 될거에요...
아직 에러처리는 방법을 모르겠어서 우선 아는 만큼만 진행했습니다ㅠㅠ