Skip to content
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

[5기]3주차 Wordle 과제 제출 - 싸무엘 #36

Open
wants to merge 59 commits into
base: main
Choose a base branch
from

Conversation

samkimuel
Copy link

느낀 점

  • 긴 시간동안 페어 프로그래밍을 하면서 상대에 집중하고, 내가 하는 일에도 집중하는 게 중요하다는 것을 느꼈습니다.
  • 나와 다르게 생각하고, 다른 방식으로 개발하는 상대를 이해하면서 소통하는 방법을 조금은 알게 된 것 같습니다.

배운 점

  • 상대를 배려하는 말
  • 테스트 하기 쉬운 코드를 어떻게 작성하는지에 대해 배운 것 같습니다.
  • 안일하게 생각하고 넘어갈 수 있는 부분을 디테일한 관점으로 볼 수 있었습니다.
  • 페어와 이해 정도를 맞추는 커뮤니케이션 과정은 필수적이고 중요하다는 것을 알게 되었습니다.

많은 시간을 투자한 부분

  • 클래스, 메서드 분리
  • 더 좋은 네이밍으로 수정

아쉬운 점

  • 구현 - 리팩토링 - 테스트 사이클
  • 커밋 단위

samkim-jn and others added 30 commits June 6, 2024 11:06
Copy link

@yeojiin yeojiin left a comment

Choose a reason for hiding this comment

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

싸무엘님 반갑습니다~ 페어 프로그래밍에 이어 리뷰까지 하게 되었는데 제가 코드 리뷰 경험이 많지 않아 부족한 점이 많아요....🥲
리뷰를 통해 많이 배워가고 제 코드에 적용해보고 싶은 부분도 많이 배웠습니다!
특히, 여러 케이스를 검증한 테스트 코드 부분이 흥미로웠고, Map을 사용하셔서 정답을 찾아가는 과정이 인상 깊었습니다! 같은 과제를 다르게 풀이한 걸 보고 아주 재밌게 리뷰했습니다! 😁
중간 중간 달았던 댓글 중 자유롭게 의견을 듣고 싶어서 남긴 부분도 있으니 다음 리뷰 때 싸무엘님의 견해를 듣고 싶네요~

이번 과제하시느라 고생 많으셨습니다~~~ 👏👏👏👏

docs/회고.md Outdated Show resolved Hide resolved
src/main/java/wordle/model/WordsReader.java Show resolved Hide resolved
import java.time.LocalDate;
import java.util.List;

public class WordService {
Copy link

Choose a reason for hiding this comment

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

wordService라는 명칭 대신 단어를 로드하는 기능을 하고 있으니 WordLoader와 같은 명칭은 어떨까요?😄
객체가 어떤 기능을 하는지 좀 더 가시적으로 판단이 가능할 거 같습니다!

Copy link
Author

Choose a reason for hiding this comment

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

좋은 의견주셔서 감사합니다 👍🏻 👍🏻
네이밍에 대한 고민을 하다가 일단 Service 라고 해놓고 나중에 바꾸자고 넘어갔었는데 더 명확하게 표현하는 게 좋겠네요.

src/main/java/wordle/model/Words.java Outdated Show resolved Hide resolved
src/main/java/wordle/model/Letters.java Show resolved Hide resolved
import java.util.List;
import java.util.Map;

public class LetterCounter {
Copy link

Choose a reason for hiding this comment

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

메소드 배치하실 때 어떤 기준으로 하시는 편인지 궁금합니다!
저도 피드백 받은 부분인데 상수 -> 일반 필드 -> 기본 생성자 -> 인자가 있는 생성자 -> public 메소드 -> private 메소드 -> 오버라이딩한 메소드 순으로 배치하는 것을 추천해 주시더라구요.
이번 기회에 같이 전체적으로 적용해보면 좋을 거 같아요~~ 🙈

Copy link
Author

Choose a reason for hiding this comment

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

public 메서드, private 메서드는 순서상관없이 연관성 있는 메서드끼리 묶어놓는 편이고, 다른 순서는 동일해요!
public 메서드와 참조하는 private 메서드의 거리가 멀 때 확인이 불편해서 최대한 가깝게 놓는 편이에요.

src/test/java/wordle/LettersTest.java Outdated Show resolved Hide resolved
Comment on lines 17 to 33
public void addGreenTile(Letters letters) {
for(Letter letter : letters.getLetters()) {
tiles[letter.getPosition()] = GREEN_TILE;
}
}

public void addYellowTile(Letters letters) {
for(Letter letter : letters.getLetters()) {
tiles[letter.getPosition()] = YELLOW_TILE;
}
}

public void addGrayTile(Letters letters) {
for (Letter letter : letters.getLetters()) {
tiles[letter.getPosition()] = GRAY_TILE;
}
}
Copy link

Choose a reason for hiding this comment

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

이건 개인적인 궁금증인데 싸무엘님은 이렇게 로직이 중복되는 코드가 있으면 분리해서 작성하는 걸 선호하시나요?
아니면 addTile(letters, tiletype) 이런 식으로 하나의 메소드를 변수를 넘겨 구분하는 걸 선호하시는 편인지 궁금합니다!
실무에서도 이 고민을 많이 해서 여쭤보아요~ 😁

Copy link
Author

Choose a reason for hiding this comment

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

클라이언트(TileService)에서 Tile에 대해 꼭 알 필요는 없다고 생각해서 이렇게 구현했던 것 같네요 ㅎㅎ..
저는 어떤 방식을 선호한다기보다 클라이언트에서 해당 클래스에 대해 알 필요가 있는가를 기준으로 작성하는 것 같아요!
여기서는 tileType을 받아도 괜찮을 것 같아 보이긴 하는데 그렇게 되면 if, switch, enum 등을 사용해서 어떻게 맛있게 처리할까 생각해야겠네요 ㅋㅋㅋ

src/test/java/wordle/TileServiceTest.java Outdated Show resolved Hide resolved
docs/회고.md Outdated Show resolved Hide resolved
Copy link
Author

@samkimuel samkimuel left a comment

Choose a reason for hiding this comment

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

얄뭉님 리뷰 답변이 늦었네요 죄송해요ㅠㅠ
세심한 리뷰 너무 감사해요. 다시 한 번 생각하고 고민해보면서 많이 배울 수 있었어요 🙇🏻
리뷰 반영한 부분이나 제 답변에서 모호한 게 있으면 언제든 물어봐주세요! 😄
당신은 최고의 리뷰어 💯

public class Application {

public static void main(String[] args) {
Wordle wordle = new Wordle(new Console(), new WordService(new WordsReader()), new WordleValidator(), new TileService(new TileStorage()));
Copy link
Author

Choose a reason for hiding this comment

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

말씀해주신 장점을 생각해 주입 패턴을 사용했는데, 현재 Wordle 에서는 동적으로 바뀌지 않아 Wordle 클래스 내부에서 생성 책임을 가져가도 괜찮을 것 같기도 하네요 🤔
생각해보니 동적으로 바뀌어야할 상황을 가정한다면 추상화를 하는게 좋아보이네요,, 당연하게 생각하고 넘어갔었던 부분인데 상기 시켜주셔서 감사합니다!

import java.util.List;
import java.util.Map;

public class LetterCounter {
Copy link
Author

Choose a reason for hiding this comment

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

public 메서드, private 메서드는 순서상관없이 연관성 있는 메서드끼리 묶어놓는 편이고, 다른 순서는 동일해요!
public 메서드와 참조하는 private 메서드의 거리가 멀 때 확인이 불편해서 최대한 가깝게 놓는 편이에요.


public class LetterCounter {

private final Map<Character, Integer> letterCountMap;
Copy link
Author

Choose a reason for hiding this comment

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

철자와 철자 개수를 각각 Map의 key, value로 만들었어요!

private final List<Letter> letters;

public Letters(String word) {
String lowerCase = word.toLowerCase();
Copy link
Author

Choose a reason for hiding this comment

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

대소문자 비교때문에 소문자로 변환해야겠다고 생각해서 추가했는데, 얄뭉님은 대소문자 구분을 어떻게 하셨을까요?

Comment on lines 39 to 43
public String combine() {
return letters.stream()
.map(letter -> String.valueOf(letter.getValue()))
.collect(Collectors.joining(""));
}
Copy link
Author

Choose a reason for hiding this comment

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

저는 joining을 처음 써봤는데 이번에 딱구님에게 배웠습니다 ㅎㅎ 🚌

src/test/java/wordle/TileServiceTest.java Outdated Show resolved Hide resolved
Comment on lines 17 to 33
public void addGreenTile(Letters letters) {
for(Letter letter : letters.getLetters()) {
tiles[letter.getPosition()] = GREEN_TILE;
}
}

public void addYellowTile(Letters letters) {
for(Letter letter : letters.getLetters()) {
tiles[letter.getPosition()] = YELLOW_TILE;
}
}

public void addGrayTile(Letters letters) {
for (Letter letter : letters.getLetters()) {
tiles[letter.getPosition()] = GRAY_TILE;
}
}
Copy link
Author

Choose a reason for hiding this comment

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

클라이언트(TileService)에서 Tile에 대해 꼭 알 필요는 없다고 생각해서 이렇게 구현했던 것 같네요 ㅎㅎ..
저는 어떤 방식을 선호한다기보다 클라이언트에서 해당 클래스에 대해 알 필요가 있는가를 기준으로 작성하는 것 같아요!
여기서는 tileType을 받아도 괜찮을 것 같아 보이긴 하는데 그렇게 되면 if, switch, enum 등을 사용해서 어떻게 맛있게 처리할까 생각해야겠네요 ㅋㅋㅋ

Comment on lines 51 to 53
inputLetters = new Letters(input);

if (isInputLettersInvalid(words, inputLetters)) {
Copy link
Author

Choose a reason for hiding this comment

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

입력 String 을 Letters 변환해서 해당 클래스를 통해 검증을 진행하려고 했다가 validator에 검증 역할을 위임하면서 불필요한 프로세스가 늘어나게 되어버렸네요,,, 😢
놓치고 있던 부분인데 세심하게 봐주셔서 감사합니다! 최고최고 👍🏻

Comment on lines 10 to 13
private final Console console;
private final WordService wordService;
private final WordleValidator wordleValidator;
private final TileService tileService;
Copy link
Author

Choose a reason for hiding this comment

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

생성 시점에 초기화한다면 말씀해주신 부분에서 확실히 장점이 있네요. 캐시처럼 사용할수도 있구요!
Word -> Letters 변환 책임은 WordService의 역할이 맞을까 고민했었는데 좋은 방법인 것 같습니다 👍🏻

Comment on lines 25 to 26
Words words = wordService.getWords();
Letters answerLetters = createAnswerLetters(words);
Copy link
Author

Choose a reason for hiding this comment

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

마감 이슈로 일단 메서드 분리만 해보자해서 내부 메서드로 추출하고 개선은 못했는데 위에서 의견주신 것과 동일하게 위임하면 좋을 것 같아요 ㅎㅎ 좋은 의견 감사합니다 👍🏻

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.

4 participants