Skip to content

[문자열 계산기] 박호건 미션 제출합니다.#4

Open
moongua404 wants to merge 8 commits into
Java-JavaScript-Language-Stuty:mainfrom
moongua404:moongua404
Open

[문자열 계산기] 박호건 미션 제출합니다.#4
moongua404 wants to merge 8 commits into
Java-JavaScript-Language-Stuty:mainfrom
moongua404:moongua404

Conversation

@moongua404

Copy link
Copy Markdown
Contributor

No description provided.

- 과제 내용 첨부
- 비지니스 로직 및 기능 목록 정리
- 구현하며 UML / Class Diagram 작성해도 좋을 것 같음
- MVC 패턴에 맞게 파일 구조를 설정
- model, view, controller, service, utils 패키지 및 클래스 생성
- service는 interface와 구현체로 분리
- config 파일로 의존성 주입
- 정적 팩터리 메서드를 통해 구분자 추출
- input view 구현
- Service를 쓸 필요가 없어서 삭제
- Controller의 run으로 전체 기능 연결
- View 및 Model 보완
- utils 보완
- Console.readline함수를 try catch로 감싸서 예외처리
- Pattern.quote를 통해 이스케이프 문자 처리
- 예외 메시지 상수로 추출
- 기타 상수 모델 필드로 추출
@moongua404

Copy link
Copy Markdown
Contributor Author

1. 신경써서 구현한 부분

  • 최대한 담백하고 깔끔하게, 그리고 가독성 좋게 코드를 짜려고 노력했습니다.
    • MVC 패턴을 도입했습니다. (로직이 복잡하지 않아 Service는 만들지 않았습니다)
    • app config를 통해 의존성을 통합적으로 관리하려했습니다 (DI를 통해 의존성을 분리했습니다)
    • 상수 문자열을 enum으로 관리했습니다. 사소한 상수는 static 필드로 뒀습니다.

2. 피드백이 필요한 부분

  • 제가 부족하거나 빠뜨린 부분은 무엇이든 피드백을 받고 싶습니다
  • 그 중에서 가장 피드백 받고싶은 부분은 코드의 가독성입니다
    • 변수명, 함수명 등이 직관적으로 다가오는지
    • 코드의 흐름이 이해하기 쉬운지, 자연스러운지

3. 내가 고려한 예외

  • Overflow (정수, 실수 및 계산 결과)
  • 여러개의 custom 구분자
  • 빈 입력값
  • 연속된 수식 (ex. 3,,4)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

오 이런식으로 디렉터리 설계 커밋을 하기도 하는군요 배워갑니다~~^^

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

이 파일은 왜 필요한건가요?? 당신의 지식을 쪽쪽 뽑아가고 싶습니다 친절히 알려주시면 정말 감사할것 같습니다 ^0^
@moongua404

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

제 지식이라기에는... 그냥 저도 이전 스터디에서 다른 사람이 잘 짜 보이는거 비슷하게 짠거긴 합니다...ㅋㅋㅋ
의존성을 통합적으로 관리하기 위함입니다. 이 파일을 만들지 않으면 Conroller와 이에 필요한 의존성(Service, View ...)을 Application에서 직접 생성한 후 이에 대한 의존성을 주입해서 사용해야하는데, AppConfig 파일을 만든 후 여기서 의존성을 만들고 반환하게 된다면 Application에서는 AppConfig 만으로 Controller와 이에 필요한 의존성을 관리할 수 있게 됩니다.

private String expression;

public static Expression parse(String line) {
Expression expression = new Expression();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Static factory method 패턴 맞나요? 긴가민가해서.. 이 파일 코드도 다 깔끔하고 잘 보입니다~~

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

정적 팩터리 메서드로 생각하고 구현했습니다!

@daeGULLL

daeGULLL commented Feb 9, 2025

Copy link
Copy Markdown

내공과 배움이 느껴지는 깔끔한코드였습니다~~ 변수명도 이해가 잘되고 플로우도 자연스러웠어요 많이 배워갑니다~~~~

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

이 파일은 왜 필요한건가요?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

잘못 만든 것 같네요....ㅋㅋㅋㅋ 예외가 발생할 상황이 많을 경우 Enum으로 관리하려고 했는데 지우는걸 깜빡했습니다...

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants