Skip to content

[로또] 이만재 미션 제출합니다.#4

Open
leemanjae02 wants to merge 38 commits intogdgoc-skhu-missions:leemanjae02from
leemanjae02:main
Open

[로또] 이만재 미션 제출합니다.#4
leemanjae02 wants to merge 38 commits intogdgoc-skhu-missions:leemanjae02from
leemanjae02:main

Conversation

@leemanjae02
Copy link
Copy Markdown

궁금한 점

  • 같이 프로그래밍 하게 된 페어분 덕분에 MVC 패턴으로 구현을 해봤습니다!
  • 저번 GDSC 강의에서 MVC 패턴에 관한 강의를 듣게되어 이번에 한 번 구현해보고자 페어분의 도움을 받아 구현했는데 현업에서는 어떤 패턴으로 구현하는지 궁금합니다!
  • 모델은 뷰가 하는 역할을 모르고 뷰는 모델이 하는 역할을 모르고 컨트롤러는 모든 정보를 알고 있어야 한다는 강의 내용이 기억나서 최대한 서로 의존하지 않도록 작성해 보았는데 혹시 놓친 부분이나 수정했으면 좋을 부분들을 알려주시면 열심히 공부해서 수정하겠습니다 !

구현 실패한 부분

  • ApplicationTest 테스트를 통과하지 못했습니다..
/Users/akswo/Study/GDSC pair/javascript-lotto/src/Purchase.js:67
새로운 오류를 던져(_Message.ERROR_MESSAGE.non_divisible_money);
^

Error: [ERROR] 구입금액은 1,000 단위로 입력해야 합니다.
Purchase.checkNotMultipleOfThousand에서 (/Users/akswo/Study/GDSC pair/javascript-lotto/src/Purchase.js:67:15)
Purchase.validate에서 (/Users/akswo/Study/GDSC pair/javascript-lotto/src/Purchase.js:40:12)
새로운 구매 (/Users/akswo/Study/GDSC pair/javascript-lotto/src/Purchase.js:30:10)
Game._callee2$ (/Users/akswo/Study/GDSC pair/javascript-lotto/src/Game.js:73:31)
tryCatch에서 (/Users/akswo/Study/GDSC pair/javascript-lotto/src/Game.js:16:1062)
Generator.<anonymous> (/Users/akswo/Study/GDSC pair/javascript-lotto/src/Game.js:16:3012)
Generator.next에서 (/Users/akswo/Study/GDSC pair/javascript-lotto/src/Game.js:16:1699)
asyncGeneratorStep에서 (/Users/akswo/Study/GDSC pair/javascript-lotto/src/Game.js:17:103)
_next에서 (/Users/akswo/Study/GDSC pair/javascript-lotto/src/Game.js:18:194)
  • ApplicationTest 테스트를 통과하지 못했는데 PurchaseTest에서는 통과가 되는데 ApplicationTest 테스트에서 통과하지 못하는 이유를 찾지 못했습니다 PurchaseTest 테스트 코드를 잘못 작성한 것인지 궁금합니다.

HarrySeop and others added 30 commits May 7, 2024 23:41
Comment on lines +10 to +12
static showLottoNumbers(lotto) {
Console.print(`[${lotto.join(', ')}]`);
}
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

로또 당첨번호를 보여줄 때 원본 배열이 아니라 재조합을 통해 출력했는데 원본 배열로 출력할 수 있을 것 같아서 리팩토링 하면서 같이 수정해보겠습니다!

Comment on lines +42 to +44
- [ ] ,가 맨 앞에 오는 경우
- [ ] ,가 맨 뒤에 오는 경우
- [ ] ,가 중복되서 입력 되는 경우
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

이 부분을 정규식과 if문으로 검사를 하려고 생각해봤지만 동작이 되는 코드를 작성하기 위해 우선순위를 미뤄두었다가 구현하지는 못했습니다.
조건에 따른 검사를 할 때 정규식을 사용하면 되겠다는 생각이 먼저 드는 편인데 정규식을 사용해 조건을 검사하는 것이 복잡한 정규식일 경우 가독성이 안 좋지 않을까? 하는 생각에 정규식을 사용하는 것이 좋은 코드인지는아직 잘 모르겠습니다.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

정규식이 복잡하다면 적용해볼 수 있는 방법이 무엇일까요?

@hyesungoh
Copy link
Copy Markdown

    같이 프로그래밍 하게 된 페어분 덕분에 MVC 패턴으로 구현을 해봤습니다!
    저번 GDSC 강의에서 MVC 패턴에 관한 강의를 듣게되어 이번에 한 번 구현해보고자 페어분의 도움을 받아 구현했는데 현업에서는 어떤 패턴으로 구현하는지 궁금합니다!
  • 경험은 많을 수록 좋다고 생각해요 잘하셨어요 👍

  • 말씀하시는 현업이 어떤 분야인지에 따라 달라요.

    • 하지만 그보다 중요한 것은 어떤 패턴이 무슨 문제를 해결하고, 그 문제가 우리가 겪는 문제인지. 팀 전체의 의견이 조율되어야 해요
    • 궁극적으로 소프트웨어 설계 패턴이 왜 생겼는지 고민해보면 좋을 거 같아요.
  • 단편적으로 말씀을 드리자면 MVVM 패턴이 모바일 진영에서는 많이 쓰이고,
    현대의 웹 프론트엔드에서는 다양한 패턴이 각 요구사항마다 사용돼요 https://www.patterns.dev/#patterns

Copy link
Copy Markdown

@hyesungoh hyesungoh left a comment

Choose a reason for hiding this comment

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

  • 클래스 내부 private 메서드일 수 있을 것들이 많이 보여요

  • 각 클래스(모델)이 하는 역할이 명확하지 않은 느낌이 들어요

    • 역할과 책임을 기준으로 더 고심해볼 수 있을까요?
  • 많은 코드에서 클래스 내부 필드를 조작하고 사용하는데, 이에 따른 단점은 어떤 것이 생길까요?


전체적으로 패턴에 구현체를 끼워 맞춘 코드가 된 느낌입니다.

좋은 코드, 문제를 해결하는 코드가 되기 위해서는 어떻게 해야할까요?

Comment on lines +1 to +5
export const MONEY = Object.freeze({
unit: 1000,
zero: 0,
blank: '',
});
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Object.freeze를 사용하신 이유에 대해서 기술해 주세요 ~

사용했을 때의 장점, 단점

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

현재의 코드가 읽기 쉽고, 수정에 용이한 코드라 생각되시나요?

  • 왜 그렇게 생각하시는 지 말씀해주세요

MVC 패턴이 해당 요구사항에 적합했다고 생각하시나요?

  • 그렇다면 이유에 대해서 말씀해주세요

Comment on lines +19 to +38
async start() {
await this.initPurchaseAmount();
this.showLottoNumbers();
await this.initWinningNumbers();
await this.initBonusNumber();
this.showResult();
}

async initPurchaseAmount() {
const inputUserMoney = await InputView.getInputMoney();
this.purchase = new Purchase(inputUserMoney);
OutputView.showLottoCount(this.purchase.getQuantity());
}

showLottoNumbers() {
this.lottos = LottoGenerator.generate(this.purchase.getQuantity());
this.lottos.forEach((lotto) => {
OutputView.showLottoNumbers(lotto);
});
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

start를 기준으로 흐름을 따라가다 보면 뇌에 기억하고 있어야 하는 것들이 계속 늘어나, 흐름을 파악하기 어려울 수 있을 거 같다고 생각되는데요.

두뇌가 한 번에 기억할 수 있는 것을 개선하기 위해서는 어떤 방법이 있을까요?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

이 클래스는 유틸성이 강한 것 같은데, 클래스로 만든 이유가 무엇인가요?

모든 것을 클래스로 만들면 어떤 단점이 생길까요?

Comment on lines +42 to +44
- [ ] ,가 맨 앞에 오는 경우
- [ ] ,가 맨 뒤에 오는 경우
- [ ] ,가 중복되서 입력 되는 경우
Copy link
Copy Markdown

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