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๋‹จ๊ณ„ - ์ž๋™์ฐจ ๊ฒฝ์ฃผ(๋ฆฌํŒฉํ† ๋ง) #6078

Open
wants to merge 7 commits into
base: baeksangha
Choose a base branch
from

Conversation

baeksangha
Copy link

5๋‹จ๊ณ„ ๋ฆฌํŒฉํ† ๋ง ์š”๊ตฌ์‚ฌํ•ญ

  • ํ•ต์‹ฌ ๋น„์ง€๋‹ˆ์Šค ๋กœ์ง์„ ๊ฐ€์ง€๋Š” ๊ฐ์ฒด๋ฅผ domain ํŒจํ‚ค์ง€, UI ๊ด€๋ จํ•œ ๊ฐ์ฒด๋ฅผ view ํŒจํ‚ค์ง€์— ๊ตฌํ˜„ํ•œ๋‹ค.
  • MVC ํŒจํ„ด ๊ธฐ๋ฐ˜์œผ๋กœ ๋ฆฌํŒฉํ† ๋งํ•ด view ํŒจํ‚ค์ง€์˜ ๊ฐ์ฒด๊ฐ€ domain ํŒจํ‚ค์ง€ ๊ฐ์ฒด์— ์˜์กดํ•  ์ˆ˜ ์žˆ์ง€๋งŒ, domain ํŒจํ‚ค์ง€์˜ ๊ฐ์ฒด๋Š” view ํŒจํ‚ค์ง€ ๊ฐ์ฒด์— ์˜์กดํ•˜์ง€ ์•Š๋„๋ก ๊ตฌํ˜„ํ•œ๋‹ค.

์ž‘์—… ๋‚ด์šฉ

  • carracing ํŒจํ‚ค์ง€๋ฅผ domain, util, view๋กœ ๊ตฌ๋ถ„
  • Position ๊ฐ์ฒด ์ถ”๊ฐ€ (๋ชจ๋“  ์›์‹œ๊ฐ’๊ณผ ๋ฌธ์ž์—ด์„ ํฌ์žฅํ•œ๋‹ค.)
  • Cars ๊ฐ์ฒด ์ถ”๊ฐ€ (๋ ˆ์ด์‹ฑ์— ์ฐธ์—ฌํ•œ ์ฐจ๋“ค์˜ ๋น„์ฆˆ๋‹ˆ์Šค ๋กœ์ง ๋‹ด๋‹น)
  • CarRacing ํด๋ž˜์Šค์˜ ์—ญํ•  ๋ฉ”์„œ๋“œ ๋ถ„๋ฆฌ

๊ถ๊ธˆํ•œ ์ 

4๋‹จ๊ณ„ ํ”ผ๋“œ๋ฐฑ์—์„œ getWinners์˜ ์‘๋‹ต ํด๋ž˜์Šค์œผ๋กœ winner ํด๋ž˜์Šค๋ฅผ ์ƒ์„ฑํ•˜๋Š” ๊ฒƒ์„ ๋ง์”€ํ•ด์ฃผ์…จ๋Š”๋ฐ, ๊ตฌ์„ฑ์„ ์–ด๋–ป๊ฒŒ ํ• ์ง€ ๊ณ ๋ฏผ๋์Šต๋‹ˆ๋‹ค.
Winner ํด๋ž˜์Šค๋ฅผ ๊ตฌ์„ฑํ•˜๊ณ  Car ๊ฐ์ฒด๋ฅผ ๋ฐ›์œผ๋ฉด Winner์—์„œ ์ž๋™์ฐจ์˜ ์ด๋ฆ„์„ ์–ป๊ธฐ ์œ„ํ•ด์„œ car.getName().getName();์„ ๋ฐ›๋Š” ํ˜•์‹์œผ๋กœ ๊ตฌํ˜„ํ•˜๋Š”๊ฑด๊ฐ€์š”? Winner ํด๋ž˜์Šค์— ์›์‹œ๊ฐ’๊ณผ ๋ฌธ์ž์—ด ํ˜•ํƒœ์˜ ํ•„๋“œ๊ฐ€ ๋“ค์–ด๊ฐ€์•ผ ํ• ์ง€, ํด๋ž˜์Šค๋กœ ํฌ์žฅ๋œ ํ•„๋“œ๋“ค์ด ๋“ค์–ด๊ฐ€์•ผ ํ• ์ง€ ๊ณ ๋ฏผ๋˜์–ด์„œ ์งˆ๋ฌธ๋“œ๋ฆฝ๋‹ˆ๋‹ค!

public class Winner {
    private final Car car;
    public String getCarName() {
        return car.getName().getName();
    }
}

- carracing ํŒจํ‚ค์ง€๋ฅผ domain, util, view๋กœ ๊ตฌ๋ถ„
- Position ๊ฐ์ฒด ์ถ”๊ฐ€ (๋ชจ๋“  ์›์‹œ๊ฐ’๊ณผ ๋ฌธ์ž์—ด์„ ํฌ์žฅํ•œ๋‹ค.)
- Cars ๊ฐ์ฒด ์ถ”๊ฐ€ (๋ ˆ์ด์‹ฑ์— ์ฐธ์—ฌํ•œ ์ฐจ๋“ค์˜ ๋น„์ฆˆ๋‹ˆ์Šค ๋กœ์ง ๋‹ด๋‹น)
- CarRacing ํด๋ž˜์Šค์˜ ์—ญํ•  ๋ฉ”์„œ๋“œ ๋ถ„๋ฆฌ
@nooose
Copy link
Member

nooose commented Mar 21, 2025

4๋‹จ๊ณ„ ํ”ผ๋“œ๋ฐฑ์—์„œ getWinners์˜ ์‘๋‹ต ํด๋ž˜์Šค์œผ๋กœ winner ํด๋ž˜์Šค๋ฅผ ์ƒ์„ฑํ•˜๋Š” ๊ฒƒ์„ ๋ง์”€ํ•ด์ฃผ์…จ๋Š”๋ฐ, ๊ตฌ์„ฑ์„ ์–ด๋–ป๊ฒŒ ํ• ์ง€ ๊ณ ๋ฏผ๋์Šต๋‹ˆ๋‹ค.
Winner ํด๋ž˜์Šค๋ฅผ ๊ตฌ์„ฑํ•˜๊ณ  Car ๊ฐ์ฒด๋ฅผ ๋ฐ›์œผ๋ฉด Winner์—์„œ ์ž๋™์ฐจ์˜ ์ด๋ฆ„์„ ์–ป๊ธฐ ์œ„ํ•ด์„œ car.getName().getName();์„ ๋ฐ›๋Š” ํ˜•์‹์œผ๋กœ ๊ตฌํ˜„ํ•˜๋Š”๊ฑด๊ฐ€์š”? Winner ํด๋ž˜์Šค์— ์›์‹œ๊ฐ’๊ณผ ๋ฌธ์ž์—ด ํ˜•ํƒœ์˜ ํ•„๋“œ๊ฐ€ ๋“ค์–ด๊ฐ€์•ผ ํ• ์ง€, ํด๋ž˜์Šค๋กœ ํฌ์žฅ๋œ ํ•„๋“œ๋“ค์ด ๋“ค์–ด๊ฐ€์•ผ ํ• ์ง€ ๊ณ ๋ฏผ๋˜์–ด์„œ ์งˆ๋ฌธ๋“œ๋ฆฝ๋‹ˆ๋‹ค!

Winner ๊ฐ์ฒด๋ฅผ ์–ด๋–ป๊ฒŒ ๋ฐ”๋ผ๋ณด๋ƒ์— ๋”ฐ๋ผ ๋‹ค๋ฅผ ๊ฒƒ ๊ฐ™์•„์š”
์•„๋งˆ ์ง€๊ธˆ ๊ตฌ์กฐ๋ผ๋ฉด view์—๊ฒŒ ๋„˜๊ฒจ ์šฐ์Šน์ž๋ฅผ ์ถœ๋ ฅ์‹œํ‚ค๊ธฐ ์œ„ํ•œ ๊ฐ์ฒด์ผ ๊ฐ€๋Šฅ์„ฑ์ด ๋†’์•„๋ณด์ž…๋‹ˆ๋‹ค.
์ฆ‰, ๋กœ์ง์€ ์กด์žฌํ•˜์ง€ ์•Š๋Š” DTO์ผ ๊ฐ€๋Šฅ์„ฑ์ด ๋†’์•„๋ณด์—ฌ์š”

์ž๋™์ฐจ์˜ ์ด๋ฆ„์„ ๋ทฐ์—๊ฒŒ๋กœ๋งŒ ์ž˜ ์ „๋‹ฌํ•  ์ˆ˜ ์žˆ๋‹ค๋ฉด CarName ๊ฐ์ฒด ๋˜๋Š” String์„ ๋„˜๊ฒจ์ค˜๋„ ํฐ ์ƒ๊ด€์€ ์—†๋‹ค๊ณ  ์ƒ๊ฐํ•ฉ๋‹ˆ๋‹ค.
์ƒํ•˜๋‹˜์€ ์–ด๋–ค ๋ฐฉ๋ฒ•์ด ๋‚˜์„ ๊ฒƒ ๊ฐ™๋‚˜์š”?

Copy link
Member

@nooose nooose left a comment

Choose a reason for hiding this comment

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

์•ˆ๋…•ํ•˜์„ธ์š” ์ƒํ•˜๋‹˜
๋งˆ์ง€๋ง‰ ๋‹จ๊ณ„์ธ ๋งŒํผ ํ”ผ๋“œ๋ฐฑ์ด ์กฐ๊ธˆ ๋งŽ์•„์กŒ๋Š”๋ฐ์š”
๊ฐœ์„ ํ•ด ๋ณด์‹œ๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค
์ˆ˜์ • ํ›„ ๋‹ค์‹œ ์š”์ฒญ ๋ถ€ํƒ๋“œ๋ฆด๊ฒŒ์š”! ๐Ÿ˜Š

Comment on lines 3 to 4
public class Position {
private int value;
Copy link
Member

Choose a reason for hiding this comment

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

์–‘์ˆ˜๋ฅผ ํ‘œํ˜„ํ•˜๋Š” ๊ฐ’ ๊ฐ์ฒด ์ข‹์Šต๋‹ˆ๋‹ค ๐Ÿ‘

Comment on lines 17 to 19
public void increment() {
this.value++;
}
Copy link
Member

Choose a reason for hiding this comment

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

๊ฐ’ ๊ฐ์ฒด๋ฅผ ๋ถˆ๋ณ€์œผ๋กœ ๋งŒ๋“ค์–ด๋ณด๋Š” ๊ฒƒ์€ ์–ด๋–จ๊นŒ์š”?

increment() ๋ฉ”์†Œ๋“œ๋Š” ๊ฐ์ฒด์˜ ๋‚ด๋ถ€ ์ƒํƒœ๋ฅผ ๋ณ€๊ฒฝํ•˜๋Š” ๊ฐ€๋ณ€๋ฐฉ์‹์œผ๋กœ ๋™์ž‘ํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค
๊ฐ’ ๊ฐ์ฒด๋Š” ๋ถˆ๋ณ€์„ฑ์„ ๊ฐ€์ง€๊ฒŒ ์„ค๊ณ„ํ•˜๋Š” ๊ฒƒ์ด ์ข‹์€๋ฐ์š”
๊ธฐ์กด ๊ฐ’ ์ž์ฒด๊ฐ€ ๋ณ€ํ•˜๊ธฐ๋ณด๋‹ค๋Š” ์ƒˆ๋กœ์šด ๊ฐ’์„ ๋งŒ๋“ค์–ด๋‚ด๋Š” ๋ฐฉ์‹์ด ๋” ์ ์ ˆํ•  ๊ฒƒ ๊ฐ™์•„์š”

์˜ˆ๋ฅผ ๋“ค์–ด, 1 + 1 = 2์—์„œ ๊ธฐ์กด์˜ 1(๊ฐ’)์ด 2๋กœ ๋ณ€ํ•˜๋Š” ๊ฒƒ์ด ์•„๋‹ˆ๋ผ, ์ƒˆ๋กœ์šด 2(๊ฐ’)๊ฐ€ ์ƒ์„ฑ๋˜๋Š” ๊ฒƒ์ฒ˜๋Ÿผ์š”!

var newPosition = position.increment();

์ด๋ ‡๊ฒŒ ํ•˜๋ฉด ๋ถˆ๋ณ€์„ฑ์„ ์œ ์ง€ํ•  ์ˆ˜ ์žˆ๊ณ , ๊ฐ์ฒด์˜ ์˜ˆ์ƒ์น˜ ๋ชปํ•œ ๋ณ€๊ฒฝ์„ ๋ฐฉ์ง€ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค! ๐Ÿš€

https://tecoble.techcourse.co.kr/post/2021-05-16-dto-vs-vo-vs-entity/

๊ด€๋ จํ•ด์„œ ์ฝ์–ด๋ณด์‹œ๋ฉด ๋„์›€์ด ๋ ๊ฑฐ์˜ˆ์š”

Copy link
Author

@baeksangha baeksangha Mar 23, 2025 โ€ข

Choose a reason for hiding this comment

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

ํฌ๋น„๋‹˜ ๋ผ์ด๋ธŒ ๊ฐ•์˜์—์„œ ์ œ๊ฐ€ ํ•œ๊ฒƒ์ฒ˜๋Ÿผ ํ‘œํ˜„ํ•˜์‹œ๊ธธ๋ž˜ ๋”ฐ๋ผ ์“ฐ๊ธด ํ–ˆ๋Š”๋ฐ, ๊ฐ์ฒด์˜ ๊ฐ€๋ณ€์„ฑvs๋ถˆ๋ณ€์„ฑ ์ธก๋ฉด์—์„œ ๋ถˆ๋ณ€์„ฑ์„ ๊ฐ€์ง„ ๊ฐ์ฒด๋Š” ๊ทธ๋งŒํผ ์ธ์Šคํ„ด์Šค๊ฐ€ ๋งŽ์ด ์ƒ์„ฑ๋˜๋‹ˆ ๊ฐ์ฒด ์ƒ์„ฑ ๋น„์šฉ์ด๋‚˜ GC์— ๋ถ€๋‹ด์ด ์žˆ์„ ์ˆ˜ ์žˆ๋‹ค๊ณ  ์ƒ๊ฐํ–ˆ์Šต๋‹ˆ๋‹ค.
๊ณต์œ  ์ฃผ์‹  ๋ฌธ์„œ๋ฅผ ์ฝ์–ด๋ณด๋‹ˆ VO ๊ฐ์ฒด๋Š” ๋ถˆ๋ณ€์„ฑ์ด ๋ณด์žฅ๋˜์–ด์•ผ ํ•˜๋Š” ๊ฒƒ์ด ๋งž๋Š” ๊ฒƒ ๊ฐ™๋„ค์š”. ์ฝ์–ด๋ณด๊ณ  ์ฝ”๋“œ ์ˆ˜์ •ํ–ˆ์Šต๋‹ˆ๋‹ค. adb180a ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค. ์•ž์œผ๋กœ๋„ ์ด๋Ÿฌํ•œ ์ƒํ™ฉ์„ ๋งž๋‹ฅ๋œจ๋ฆฐ๋‹ค๋ฉด ๊ฐ์ฒด ์ƒ์„ฑ ๋น„์šฉ์€ ๋ฌด์‹œํ•  ์ˆ˜ ์žˆ๋‹ค๊ณ  ๋ณด๊ณ (์•„๋ฌด๋ž˜๋„ ํด๋ž˜์Šค์—์„œ ๊ฐ์ฒด๋ฅผ ๋ฌดํ•œํžˆ ๋งŽ์ด ์ƒ์„ฑํ•˜์ง„ ์•Š์œผ๋‹ˆ..) ๋ถˆ๋ณ€์„ฑ์„ ๋ณด์žฅํ•˜๋„๋ก ๊ฐ์ฒด๋ฅผ ์„ค๊ณ„ํ•˜๋Š”๊ฒŒ ๋‚˜์„๊นŒ์š”?

Comment on lines 25 to 27
public String repeatSymbol(String symbol) {
return symbol.repeat(value);
}
Copy link
Member

Choose a reason for hiding this comment

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

MVC ํŒจํ„ด ๊ธฐ๋ฐ˜์œผ๋กœ ๋ฆฌํŒฉํ† ๋งํ•ด view ํŒจํ‚ค์ง€์˜ ๊ฐ์ฒด๊ฐ€ domain ํŒจํ‚ค์ง€ ๊ฐ์ฒด์— ์˜์กดํ•  ์ˆ˜ ์žˆ์ง€๋งŒ, domain ํŒจํ‚ค์ง€์˜ ๊ฐ์ฒด๋Š” view ํŒจํ‚ค์ง€ ๊ฐ์ฒด์— ์˜์กดํ•˜์ง€ ์•Š๋„๋ก ๊ตฌํ˜„ํ•œ๋‹ค.

view ๊ฐ์ฒด๋ฅผ ์ง์ ‘์ ์œผ๋กœ ์˜์กดํ•˜์ง€๋Š” ์•Š์ง€๋งŒ ์ถœ๋ ฅ์„ ์œ„ํ•œ ๋ฉ”์†Œ๋“œ๋„ค์š”
์ด๋Ÿฌํ•œ ๊ฐ„์ ‘์ ์ธ ์˜์กด๋„ ์ œ๊ฑฐํ•˜๋ฉด ์ข‹๊ฒ ์Šต๋‹ˆ๋‹ค!

Copy link
Author

Choose a reason for hiding this comment

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

c871377 ์š”๋Ÿฐ ์‹์œผ๋กœ ์ˆ˜์ •ํ•ด ๋ณด์•˜์Šต๋‹ˆ๋‹ค.

@@ -0,0 +1,32 @@
package edu.nextstep.camp.carracing.domain;

public class Position {
Copy link
Member

Choose a reason for hiding this comment

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

var position1 = new Position(5);
var position2 = new Position(5);
position1.equals(position2); // false

๊ฐ’์€ ๊ฐ™์•„๋ณด์ด๋Š”๋ฐ ์™œ ๋‹ค๋ฅด๋‹ค๊ณ  ๋‚˜์˜ฌ๊นŒ์š”?
๋™๋“ฑ์„ฑ์„ ๋ณด์žฅ์‹œ์ผœ ๋ณด๋ฉด ์ข‹๊ฒ ์Šต๋‹ˆ๋‹ค!

Copy link
Member

Choose a reason for hiding this comment

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

๋ชจ๋“  ๋กœ์ง์— ๋‹จ์œ„ ํ…Œ์ŠคํŠธ๋ฅผ ๊ตฌํ˜„ํ•œ๋‹ค

์œ„ ์ฝ”๋ฉ˜ํŠธ ์ฐธ๊ณ ํ•ด์„œ ํ…Œ์ŠคํŠธ๋„ ๊ฐ™์ด ์ž‘์„ฑํ•ด ๋ณด๋ฉด ์ข‹๊ฒ ์Šต๋‹ˆ๋‹ค!

Copy link
Author

Choose a reason for hiding this comment

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

bb17bfe
๋™๋“ฑ์„ฑ ๋ณด์žฅ์„ ์œ„ํ•ด equals์™€ hashcode ๋ฉ”์„œ๋“œ ์˜ค๋ฒ„๋ผ์ด๋”ฉํ•ด์ฃผ๊ณ , ํ…Œ์ŠคํŠธ ์ฝ”๋“œ๋„ ์ถ”๊ฐ€ํ–ˆ์Šต๋‹ˆ๋‹ค. ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค!

}

public static void printResultMessage() {
System.out.println('\n' + RESULT_MESSAGE);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
System.out.println('\n' + RESULT_MESSAGE);
System.out.println(System.lineSeparator() + RESULT_MESSAGE);

OS ํ™˜๊ฒฝ์— ๋”ฐ๋ผ ๊ฐœํ–‰ ๋ฌธ์ž๊ฐ€ ๋‹ค๋ฅด๋ฏ€๋กœ, ํ•˜๋“œ์ฝ”๋”ฉ๋œ \n ๋Œ€์‹ 
lineSeparator()๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด ์ข‹๊ฒ ์Šต๋‹ˆ๋‹ค!

Copy link
Author

@baeksangha baeksangha Mar 22, 2025 โ€ข

Choose a reason for hiding this comment

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

๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค. System.lineSeperator()๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ์‹์œผ๋กœ ๋ณ€๊ฒฝํ–ˆ์Šต๋‹ˆ๋‹ค. ๋ชฐ๋ž๋˜ ์‚ฌ์‹ค์ด๋„ค์š” โ˜บ๏ธ 83009f8

Comment on lines 49 to 53
for (Car car : this.values) {
if (car.isMaxPosition(winnerPosition)) {
result.add(car.getName().getName());
}
}
Copy link
Member

Choose a reason for hiding this comment

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

indent(์ธ๋ดํŠธ, ๋“ค์—ฌ์“ฐ๊ธฐ) depth๋ฅผ 2๋ฅผ ๋„˜์ง€ ์•Š๋„๋ก ๊ตฌํ˜„ํ•œ๋‹ค. 1๊นŒ์ง€๋งŒ ํ—ˆ์šฉํ•œ๋‹ค.
์˜ˆ๋ฅผ ๋“ค์–ด while๋ฌธ ์•ˆ์— if๋ฌธ์ด ์žˆ์œผ๋ฉด ๋“ค์—ฌ์“ฐ๊ธฐ๋Š” 2์ด๋‹ค.
ํžŒํŠธ: indent(์ธ๋ดํŠธ, ๋“ค์—ฌ์“ฐ๊ธฐ) depth๋ฅผ ์ค„์ด๋Š” ์ข‹์€ ๋ฐฉ๋ฒ•์€ ํ•จ์ˆ˜(๋˜๋Š” ๋ฉ”์†Œ๋“œ)๋ฅผ ๋ถ„๋ฆฌํ•˜๋ฉด ๋œ๋‹ค.

๋ฉ”์†Œ๋“œ๋ฅผ ์ถ”์ถœํ•˜๋ฉด์„œ depth๋ฅผ ์ค„์—ฌ๋ณด๋ฉด ์ข‹๊ฒ ์Šต๋‹ˆ๋‹ค.
์š”๊ตฌ์‚ฌํ•ญ์ด๋‹ˆ ๋ฆฌํŒฉํ† ๋ง ํ•ด๋ณด์‹œ์ฃ !

}

public static void printWinners(Cars winners) {
System.out.println(String.join(", ", winners.getWinnerNames()) + "๊ฐ€ ์ตœ์ข… ์šฐ์Šนํ–ˆ์Šต๋‹ˆ๋‹ค.");
Copy link
Member

Choose a reason for hiding this comment

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

join ์‚ฌ์šฉ์œผ๋กœ ๊น”๋”ํ•˜๋„ค์š”! ๐Ÿ’ฏ

Comment on lines 16 to 28
public static void main(String[] args) {
List<String> carNames = inputCarNames();
int tryCount = getTryCount();

Cars cars = Cars.fromNames(carNames);

ResultView.printResultMessage();
for (int i = 0; i < tryCount; i++) {
cars.moveCars();
cars.printCarStatus();
}
ResultView.printWinners(cars.getWinners());
}
Copy link
Member

Choose a reason for hiding this comment

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

์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ์‹คํ–‰์˜ ์ง„์ž…์ ์ธ main ๋ฉ”์†Œ๋“œ๊ฐ€ ๋„๋ฉ”์ธ ์˜์—ญ์— ์œ„์น˜ํ•˜๋Š” ๊ฒƒ์€ ์–ด์ƒ‰ํ•ด ๋ณด์—ฌ์š”
main์€ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์˜ ์ตœ์ดˆ ์‹คํ–‰์ด ๋˜๋Š” ์˜์—ญ์ž…๋‹ˆ๋‹ค
image
์‹ค์ œ ๋กœ์ง์„ ์ˆ˜ํ–‰ํ•˜๋Š” ๋„๋ฉ”์ธ ๋ชจ๋ธ๊ณผ๋Š” ๋ถ„๋ฆฌ๋˜๋Š” ๊ฒƒ์ด ์ž์—ฐ์Šค๋Ÿฌ์›Œ ๋ณด์ด๋Š”๋ฐ,
๊ทธ๋ฆผ์—์„œ๋„ ๋„๋ฉ”์ธ ์˜์—ญ๋ณด๋‹ค๋Š” ์ปจํŠธ๋กค๋Ÿฌ ๊ณ„์ธต๊ณผ ๋” ๊ฐ€๊นŒ์šด ๋Š๋‚Œ์„ ์ค๋‹ˆ๋‹ค.

ํ•ด๋‹น ํด๋ž˜์Šค๋ฅผ ๋‹ค๋ฅธ ํŒจํ‚ค์ง€ ๊ณ„์ธต์œผ๋กœ ์ด๋™์‹œ์ผœ๋ณด๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค ๐Ÿš€

Copy link
Author

Choose a reason for hiding this comment

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

8b55e9a
domain ๊ฐ์ฒด ์ƒ์œ„๋กœ ์ด๋™ํ•˜๊ณ , ํด๋ž˜์Šค๋ช…๋„ CarRacingApplication์œผ๋กœ ๋ณ€๊ฒฝํ–ˆ์Šต๋‹ˆ๋‹ค. ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค.

Comment on lines +17 to +18
public static Cars fromNames(List<String> carNames) {
List<Car> cars = new ArrayList<>();
Copy link
Member

Choose a reason for hiding this comment

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

์ •์  ํŒฉํ† ๋ฆฌ ๋ฉ”์†Œ๋“œ๋กœ ๊ฐ„๊ฒฐํ•˜๊ฒŒ ํ‘œํ˜„์ด ๊ฐ€๋Šฅํ•˜๋„ค์š”! ๐Ÿ‘ ๐Ÿ‘

Comment on lines +25 to +29
public void moveCars() {
for (Car car : this.values) {
car.move(generateRandomNumber());
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Car์˜ ์›€์ง์ž„์€ ํ…Œ์ŠคํŠธํ•˜๊ธฐ ์‰ฝ๊ฒŒ ๋งŒ๋“ค์–ด์กŒ์ง€๋งŒ
Cars์˜ moveCars๋Š” ๋žœ๋ค์„ ๋‚ด๋ถ€์ ์œผ๋กœ ์ƒ์„ฑํ•˜๊ณ  ์žˆ์–ด ํ…Œ์ŠคํŠธํ•  ๋•Œ ์ œ์–ดํ•˜๊ธฐ๊ฐ€ ํž˜๋“ค ๊ฒƒ ๊ฐ™์•„์š”

Cars๋„ ๋„๋ฉ”์ธ ๋ชจ๋ธ์ด๋‹ˆ ํ…Œ์ŠคํŠธํ•˜๊ธฐ ์‰ฌ์šด ๊ตฌ์กฐ๋กœ ์žฌ๊ตฌ์„ฑํ•˜๋ฉด ์–ด๋–จ๊นŒ์š”?

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.

None yet

2 participants