Skip to content

Comments

[4, 5단계 - 체스] 레넌(조형래) 미션 제출합니다.#388

Merged
choihz merged 26 commits intowoowacourse:broraefrom
brorae:step2
Apr 11, 2022
Merged

[4, 5단계 - 체스] 레넌(조형래) 미션 제출합니다.#388
choihz merged 26 commits intowoowacourse:broraefrom
brorae:step2

Conversation

@brorae
Copy link

@brorae brorae commented Apr 6, 2022

안녕하세요, 코니!

1,2,3단계에서 반영하지 못한 부분까지 반영하느라 늦었네요 :(
이번 단계도 잘 부탁드리겠습니다.

가장 큰 변화로 체스게임에서 Move하는 로직을 변경했습니다.
이전 코드에서는 각 Piece에 위치를 보내서 이동 가능 리스트를 뽑는 로직이었습니다. 코니의 피드백처럼 가독성이 많이 떨어진다고 생각이 들어서 Piece에 위치를 보내서 이동 가능한지만 boolean 값을 반환하도록 처리해주었습니다. StraightMovablePiece와FixedMovablePiece는 직관적이지 못한 것 같아 제거했습니다.

나머지 피드백은 1,2,3단계 피드백에 댓글로 남겨두었습니다.

웹 부분을 처음 다루어 봐서 좀 힘겨웠지만, 필수요구사항까지는 열심히 해보았습니다.
DB에 관한 테스트는 아직 작성하지 못했는데, 리뷰요청이 너무 늦어질 것 같아 일단 보내두고 꾸준히 업데이트하겠습니다!

감사합니다.

Copy link

@choihz choihz left a comment

Choose a reason for hiding this comment

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

안녕하세요, 레넌!

이번 단계도 잘 구현해 주셨네요 👍 몇 가지 피드백 남겼는데 확인 부탁드리고, 이외에도 더 궁금한 점이나 의견이 있으시다면 언제든 코멘트 또는 DM 주세요~

Comment on lines 23 to 25
public class WebController {

private ChessGame chessGame;
Copy link

Choose a reason for hiding this comment

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

웹 컨트롤러가 ChessGame을 직접 인스턴스 변수로 들고 있으며, 도메인 로직들을 직접 제어하는 모습이 보이고 있어요. 레넌은 컨트롤러와 서비스, 도메인 레이어를 어떤 기준으로 나누신 걸까요? 지금 관심사가 적절히 잘 분리되어 있나요?

Copy link
Author

Choose a reason for hiding this comment

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

코니의 말씀대로 도메인 로직이 WebController에서 노출되고 있어서, Service에서 처리할 수 있도록 수정했습니다.
서비스에서는 Dao만 인스턴스 필드로 두고, Dao와의 연결만을 담당하도록 코드를 작성했었습니다.
서비스에서 ChesGame을 인스턴스 필드로 두어도 되는지 고민하다가 Controller에 비즈니스 로직이 들어간 것 같습니다.

Copy link

@choihz choihz left a comment

Choose a reason for hiding this comment

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

안녕하세요, 레넌!

피드백을 잘 반영해 주셔서 이제 이번 미션은 마무리해도 될 것 같습니다. 몇 가지 코멘트와 질문을 남겨 두었는데, 혹시 더 공부하며 의견을 나누고 싶은 부분이 있으시다면 미션 완료 여부와 상관 없이 언제든 코멘트 또는 DM 주세요.

그동안 어려운 체스 미션 하시느라 정말 고생 많으셨어요. 즐거운 방학 보내시고, 다음에 다시 만나요~ 👋


private int checkExistId(ResultSet resultSet) throws SQLException {
if (!resultSet.next()) {
throw new RuntimeException();
Copy link

Choose a reason for hiding this comment

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

예외에 적절한 메시지를 담아 주는 것이 좋겠죠?

Comment on lines +21 to +23
private static final String WHITE_SCORE_MESSAGE = "WHITE : ";
private static final String BLACK_SCORE_MESSAGE = "BLACK : ";
private static final String VICTORY_MESSAGE = " 승리!!";
Copy link

Choose a reason for hiding this comment

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

이런 값들을 ChessService에서 알고 있어야 할까요? 여태까지 했던 많은 미션들에서 출력에 관한 것은 출력을 담당하는 곳에서 처리하도록 배우거나 혹은 리뷰를 받으셨을 것 같은데요, 웹 환경에서도 그렇게 하는 편이 좋지 않을까요? 어떤 장점이 있을까요?


private final BoardService boardService;
private final GameService gameService;
private final ChessGame chessGame;
Copy link

Choose a reason for hiding this comment

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

우리가 보편적으로 사용하고 있는 웹 서비스들처럼 이 체스 프로그램을 지금 배포한다면, 오로지 하나의 체스 게임만이 존재하게 될 거예요. 여러 명이 접속해도 하나의 체스 게임을 공유하게 되기 때문에 제대로 게임할 수가 없죠. (물론 지금도 로컬에서 실행하여 여러 창을 띄워보면 바로 확인 가능하지요.) 어떻게 하면 이 구조를 개선할 수 있을지 고민해 보아요.


@Test
void connection() {
final Connection connection = Connector.getConnection();
Copy link

Choose a reason for hiding this comment

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

프로덕션 코드에서 사용하는 Connector를 테스트 코드에서도 그대로 사용했을 때 어떤 문제가 발생할 수 있을까요? 이를 해결하려면 어떻게 해야 할까요?

@choihz choihz merged commit 768d9c8 into woowacourse:brorae Apr 11, 2022
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.

2 participants