๐Ÿ“š TIL 13์ผ์ฐจ

temprmnยท2023๋…„ 6์›” 1์ผ
0
post-thumbnail

์˜ค๋Š˜์˜ ์ฃผ์š”์‚ฌํ•ญ (6/1, ๋ชฉ์š”์ผ)

  1. ํ‚ค์˜ค์Šคํฌ ๊ตฌํ˜„ ๊ณผ์ œ ์ด์–ด์„œ ํ•˜๊ธฐ
    • ๋‚ด์ผ(6/2) 13์‹œ ์ œ์ถœ ๋งˆ๊ฐ

๋ฒŒ์จ 6์›”. ๊ทธ๋ฆฌ๊ณ  ์บ ํ”„๋ฅผ ์‹œ์ž‘ํ•œ์ง€ ๋ฒŒ์จ 3์ฃผ๊ฐ€ ๋๋‚˜๊ฐ„๋‹ค. ์ง€๋‚œ ๋‹ฌ์€ ์ด์‚ฌ ์ค€๋น„์— ๋”๋ถˆ์—์„œ ์ผ๋“ค์ด ์ด๊ฒƒ์ €๊ฒƒ ๊ฒน์น˜๋Š” ๋ฐ”๋žŒ์— ์ •๋ง ์ •์‹ ์—†์ด ์ง€๋‚˜๊ฐ”๋Š”๋ฐ... ํ•˜์—ฌํŠผ ์ง€๊ธˆ ๋˜๋Œ์•„๋ณด๋ ค๋‹ˆ ์ •๋ง ์ƒ๊ฐ์ด ๋งŽ์•„์ง„๋‹ค.

๐Ÿ“ ๊ธฐ๋Šฅ ๊ตฌํ˜„ To-do list

ํ…Œ์ŠคํŠธ๊นŒ์ง€ ์™„๋ฃŒํ•œ ๊ฒƒ๋“ค์„ ์ฒดํฌ

โ˜‘๏ธ ๋ฉ”๋‰ดํŒ ์กฐํšŒ (๊ธฐ๋ณธ์œผ๋กœ ์ €์žฅ๋œ ์ •๋ณด ์กฐํšŒ)
โ˜‘๏ธ ์žฅ๋ฐ”๊ตฌ๋‹ˆ ์กฐํšŒ - ์กฐํšŒ ํ›„ ๊ตฌ๋งค or ๊ตฌ๋งค์ทจ์†Œ
โ˜‘๏ธ ์žฅ๋ฐ”๊ตฌ๋‹ˆ ์ดˆ๊ธฐํ™”
โ˜‘๏ธ ๋Œ€๊ธฐ๋ฒˆํ˜ธ ๋ฐœ๊ธ‰
โ˜‘๏ธ ์ฃผ๋ฌธ ์ทจ์†Œ

๐Ÿ“Œ ์ปจํŠธ๋กค๋Ÿฌ (+ ๋ทฐ์–ด)

โ˜‘๏ธ ์‚ฌ์šฉ์ž๊ฐ€ ์„ ํƒ ๊ฐ’ ์ž…๋ ฅ
โ˜‘๏ธ ์ž…๋ ฅ ๋ฐ›์€ ์„ ํƒ ๊ฐ’์— ๋Œ€ํ•œ ๊ฒฐ๊ณผ๋ฅผ ๋ฐ˜์˜
โ˜‘๏ธ ์ „์ฒด์ ์ธ ํ๋ฆ„ ์ œ์–ด (์ปจํŠธ๋กค๋Ÿฌ)

๊ทธ ์™ธ

โ˜‘๏ธ ์˜ˆ์™ธ์ฒ˜๋ฆฌ

๋ฐ˜๋ณต๋˜๋Š” ์„ ์–ธ๊ณผ ์ดˆ๊ธฐํ™”

์–ด์ œ ๊ตฌ์กฐ ์„ค๊ณ„ ํ•ด๋‘”๊ฒŒ ๋„์›€์ด ๋งŽ์ด๋˜์—ˆ๋‹ค. ๋ฌผ๋ก  ์ด๊ฑฐ๋Œ€๋กœ ๋Œ์•„๊ฐ€๋ผ๋Š” ๋ฒ•์€ ์—†์ง€๋งŒ. ์˜ค๋Š˜์€ ์ฝ”๋“œ๋ฅผ ์“ฐ๋ฉด์„œ ๊ฐ์ฒด๋ฅผ ์ด๋ ‡๊ฒŒ ๊ณ„์† ์„ ์–ธ, ์ดˆ๊ธฐํ™”ํ•ด๋„ ๋˜๋‚˜? ํ•˜๋Š” ์ƒ๊ฐ์ด ๋“ค์—ˆ๋‹ค. ์™œ๋ƒํ•˜๋ฉด ๋‹ค๋ฅธ ๊ณณ์—์„œ ๊ณ„์† ์ดˆ๊ธฐํ™”๋ฅผ ํ•ด์ฃผ๋ฉด ์„œ๋กœ ๋‹ค๋ฅธ ๊ฐ์ฒด๊ฐ€ ๋˜๋‹ˆ๊นŒ...

/* Main.java */
Order order = new Order();

/* Screen.java */
private Order order = new Order();

/* Kiosk.java */
private Order order = new Order();

๊ฐ€์žฅ ๋งŽ์ด ์„ ์–ธ ๋ฐ ์ดˆ๊ธฐํ™”๊ฐ€ ๋˜๊ณ  ์žˆ๋Š” ๊ฑด Order ๊ฐ์ฒด์˜€๋‹ค. Main ํด๋ž˜์Šค์—๋Š” ํ…Œ์ŠคํŠธ์šฉ์œผ๋กœ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ์—ˆ๋‹ค์ง€๋งŒ, ํ•˜์—ฌํŠผ ํ˜„์žฌ๋กœ์ฌ ๊ทธ๋ ‡๋‹ค. ์•„๋งˆ ๋‹น์žฅ์€ ๋ˆˆ์— ๋„๋Š” ๋ฌธ์ œ๊ฐ€ ์—†์„ ๊ฒƒ ๊ฐ™์ง€๋งŒ, ์ƒ์„ฑ์ž๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ๋ฌธ์ œ๊ฐ€ ๋‘๋“œ๋Ÿฌ์ง€๊ฒŒ ๋‚˜ํƒ€๋‚˜์ง€ ์•Š์„๊นŒ?

๋‚ด๊ฐ€ ์ƒ๊ฐํ•ด๋ณธ ๋ฐฉ๋ฒ•์€ ๋‹ค์Œ๊ณผ ๊ฐ™๋‹ค.

  1. ์‹ฑ๊ธ€ํ†ค ํŒจํ„ด ์‚ฌ์šฉ
  2. ํด๋ž˜์Šค๋ฅผ static์œผ๋กœ ์ •์˜
  3. ์ƒ์„ฑ์ž ๋งค๊ฐœ๋ณ€์ˆ˜๋กœ ์ดˆ๊ธฐํ™”ํ•œ ๊ฐ์ฒด ์ „๋‹ฌ

๋‚˜๋Š” 3๋ฒˆ์„ ์„ ํƒํ•ด์„œ ์ˆ˜์ •ํ•ด๋ณด์•˜๋‹ค.

/* Main.java */
// ๋ฉ”์ธ์—์„œ ๊ฐ์ฒด ์ƒ์„ฑ ํ›„ ์ƒ์„ฑ์ž๋กœ ์ „๋‹ฌ
Order order = new Order();
Screen screen = new Screen(order);
Kiosk kiosk = new Kiosk(order, screen);
/* Screen.java */
private Order order;

Screen(Order order) {
    this.order = order;
}

/* Kiosk.java */
private Order order;
private Screen screen;

Kiosk(Order order, Screen screen) {
    this.order = order;
    this.screen = screen;
}
profile
`ISFJ` T 49% F 51% /

0๊ฐœ์˜ ๋Œ“๊ธ€