Skip to content

Conversation

@GeunwoongSim
Copy link
Contributor

#️⃣ 연관된 이슈

📝 작업 내용

  1. README 작성, 각 기능에서 필요한 작업들 정리
  2. 기능 별 파일 구분 (ex. 회고 등록 / 회고 삭제 / 회고 출력 ...)
  3. 코드 정리 (리팩토링)
  • 회고 추가
  • 날짜 유효성검사
  • 회고 조회
  • 회고 수정
  • 회고 삭제
  • 회고 전체 출력
  • 프로그램 종료

🎨 스크린샷

기능 스크린샷
GIF

💬 추가 설명

전체적으로 리팩토링을 진행했습니다
README 작성으로 프로젝트 이해하시는데 조금은 도움이 될거에요...

아직 에러처리는 방법을 모르겠어서 우선 아는 만큼만 진행했습니다ㅠㅠ

- 여기선 회고 시스템의 작동만 담당하고 실제 작동은 executeMenu에서 실행
- class이니까 protocol 사용도 좋을듯
*/
class ReflectionSystem {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

상속을 하지 않을거라면 final 키워드를 앞에 붙이는게 좋을 것 같습니다.

Comment on lines +13 to +18
if menu == 1 { addReflection() }
if menu == 2 { searchReflection() }
if menu == 3 { editReflection() }
if menu == 4 { deleteReflection() }
if menu == 5 { printAllReflection() }
if menu == 6 { exitProgram() }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

메뉴를 열거형으로 만들어서 Switch 문을 활용하면 좋을 것 같습니다 !

Suggested change
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()
}

Copy link
Member

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문이 유지보수에도 좋은 구조일 것 같아요!

Copy link
Contributor

@Monfi98 Monfi98 left a 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
```
## 추가되면 좋은 기능
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이런 설명 좋습니다! 파일 시스템도 깔끔하게 정리하셨네요!! Good!!

Comment on lines +1 to +12
/*
File: AddReflection.swift
Purpose: 특정 날짜에 회고 내용을 추가

Data (사용하는 자료)
- date: String
- reflection: Reflection
- searchResult: Reflection? // 회고가 존재하지 않으면 nil

etc
- searchResult의 경우 추가한 회고에 대한 정보를 이용할만한게 있을까하여 남겨놓음
*/
Copy link
Member

@doyeonk429 doyeonk429 Feb 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

주석 스타일 깔끔하고 보기 좋습니다. Swift document 주석 스타일을 참고해보셔도 좋을 것 같아요!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] 회고 시스템 리팩토링

4 participants