๋ณธ๋ฌธ์œผ๋กœ ๊ฑด๋„ˆ๋›ฐ๊ธฐ

๐ŸŒˆ Chapter 1: ๊ฐ์ฒด, ์„ค๊ณ„

๐Ÿ“š ํ‹ฐ์ผ“ ํŒ๋งค ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ๊ตฌํ˜„ํ•˜๊ธฐโ€‹

์กฐ๊ฑด

  • ์ด๋ฒคํŠธ์— ๋‹น์ฒจ๋œ ๊ด€๋žŒ๊ฐ์€ ์ดˆ๋Œ€์žฅ์„ ํ‹ฐ์ผ“์œผ๋กœ ๊ตํ™˜ํ•œ ํ›„ ์ž…์žฅ๊ฐ€๋Šฅ
  • ๋‹น์ฒจ๋˜์ง€ ์•Š์€ ๊ด€๋žŒ๊ฐ์€ ํ‹ฐ์ผ“์„ ๊ตฌ๋งคํ•œ ํ›„ ์ž…์žฅ๊ฐ€๋Šฅ
  • ๋‹ค์Œ์€ ์ด๋ฒคํŠธ ๋‹น์ฒจ์ž์—๊ฒŒ ๋ฐœ์†ก๋˜๋Š” ์ดˆ๋Œ€์žฅ ๊ตฌํ˜„ํ•œ๋‹ค.
public class Invitation { // ์ดˆ๋Œ€์žฅ
private LocalDateTime when; // ์ดˆ๋Œ€ ์ผ์ž
}
  • Ticket ํด๋ž˜์Šค ์ถ”๊ฐ€
public class Ticket {
private Long fee;

public Long getFee() {
return fee;
}
}
  • ์ด๋ฒคํŠธ ๋‹น์ฒจ์ž๋Š” ํ‹ฐ์ผ“์œผ๋กœ ๊ตํ™˜ํ•  ์ˆ˜ ์žˆ๋Š” ์ดˆ๋Œ€์žฅ, ์ด๋ฒคํŠธ์— ๋‹น์ฒจ๋˜์ง€ ์•Š์€ ๊ด€๋žŒ๊ฐ์€ ํ˜„๊ธˆ์„ ๋ณด์œ ํ•˜๊ณ  ์žˆ์„ ๊ฒƒ์ด๋‹ค. (๊ด€๋žŒ๊ฐ์ด ๊ฐ€์ง€๊ณ  ์˜ฌ ์ˆ˜ ์žˆ๋Š” ์†Œ์ง€ํ’ˆ์€ ์ดˆ๋Œ€์žฅ, ํ˜„๊ธˆ, ํ‹ฐ์ผ“์ด๋‹ค.)
  • ๊ด€๋žŒ๊ฐ์ด ์†Œ์ง€ํ’ˆ์„ ๋ณด๊ด€ํ•œ Bag ํด๋ž˜์Šค๋ฅผ ์ถ”๊ฐ€ํ•œ๋‹ค.
public class Bag {
private Long amount; // ํ˜„๊ธˆ
private Invitation invitation; // ์ดˆ๋Œ€์žฅ
private Ticket ticket; // ํ‹ฐ์ผ“

public boolean hasInvitation() { // ์ดˆ๋Œ€์žฅ ๋ณด์œ ์—ฌ๋ถ€ ํ™•์ธ
return invitation != null;
}

public boolean hasTicket() { // ํ‹ฐ์ผ“ ๋ณด์œ ์—ฌ๋ถ€ ํ™•์ธ
return ticket != null;
}

public void setTicket(Ticket ticket) { // ์ดˆ๋Œ€์žฅ์„ ํ‹ฐ์ผ“์œผ๋กœ ๊ตํ™˜
this.ticket = ticket;
}

public void minusAmount(Long amount) { // ํ˜„๊ธˆ ๊ฐ์†Œ
this.amount -= amount;
}

public void plusAmount(Long amount) { // ํ˜„๊ธˆ ์ฆ๊ฐ€
this.amount += amount;
}
}
  • ์ด๋ฒคํŠธ์— ๋‹น์ฒจ๋œ ๊ด€๋žŒ๊ฐ์€ ํ˜„๊ธˆ๊ณผ ์ดˆ๋Œ€์žฅ์„ ๊ฐ€์ง€๊ณ  ์žˆ์ง€๋งŒ ์ด๋ฒคํŠธ์— ๋‹น์ฒจ๋˜์ง€ ์•Š์€ ๊ด€๋žŒ๊ฐ์€ ์ดˆ๋Œ€์žฅ์ด ์—†๋‹ค.
  • ๋”ฐ๋ผ์„œ Bag ์ธ์Šคํ„ด์Šค์˜ ์ƒํƒœ๋Š” ํ˜„๊ธˆ๊ณผ ์ดˆ๋Œ€์žฅ์„ ํ•จ๊ผ ๋ณด๊ด€ํ•˜๊ฑฐ๋‚˜, ํ˜„๊ธˆ๋งŒ ๋ณด๊ด€ํ•˜๋Š” ๋‘ ๊ฐ€์ง€ ์ค‘ ํ•˜๋‚˜์ด๋‹ค. Bag์˜ ์ธ์Šคํ„ด์Šค๋ฅผ ์ƒ์„ฑํ•˜๋Š” ์‹œ์ ์— ์ด ์ œ์•ฝ์„ ๊ฐ•์ œํ•  ์ˆ˜ ์žˆ๋„๋ก ์ƒ์„ฑ์ž๋ฅผ ์ถ”๊ฐ€.
public class Bag {
public Bag (long amount) {// ํ˜„๊ธˆ๋งŒ
this(null, amount);
}

public Bag(Invitation invitation, long amount) { // ์ดˆ๋Œ€์žฅ๊ณผ ํ˜„๊ธˆ
this.invitation = invitation;
this.amount = amount;
}
}
  • ๋‹ค์Œ์€ ๊ด€๋žŒ๊ฐ์ด๋ผ๋Š” ๊ฐœ๋…์„ ๊ตฌํ˜„ํ•˜๋Š” Audience ํด๋ž˜์Šค๋ฅผ ๊ตฌํ˜„ํ•œ๋‹ค.
public class Audience {
private Bag bag;

public Audience(Bag bag) {
this.bag = bag;
}

public Bag getBag() { // ๊ด€๋žŒ๊ฐ์€ ๊ฐ€๋ฐฉ์„ ์†Œ์ง€ํ•  ์ˆ˜ ์žˆ๋‹ค.
return bag;
}
}
  • ๋งคํ‘œ์†Œ์—๋Š” ๊ด€๋žŒ๊ฐ์—๊ฒŒ ํŒ๋งคํ•  ํ‹ฐ์ผ“๊ณผ ํ‹ฐ์ผ“์˜ ํŒ๋งค ๊ธˆ์•ก์ด ๋ณด๊ด€๋ผ ์žˆ์–ด์•ผ ํ•œ๋‹ค.
  • ๋งคํ‘œ์†Œ๋ฅผ ๊ตฌํ˜„ํ•˜๊ธฐ ์œ„ํ•ด TicketOffice ํด๋ž˜์Šค๋ฅผ ์ถ”๊ฐ€ํ•œ๋‹ค.
public class TicketOffice {
private Long amount; // ํŒ๋งค ๊ธˆ์•ก
private List<Ticket> tickets = new ArrayList<>(); // ํ‹ฐ์ผ“์˜ ๋ชฉ๋ก

public TicketOffice(Long amount, Ticket, ...tickets) {
this.amount = amount;
this.tickets.addAll(Arrays.asList(tickets));
}

public Ticket getTicket() {
return tickets.remove(0); // ํŽธ์˜๋ฅผ ์œ„ํ•ด tickets ์ปฌ๋ ‰์…˜์˜ ๋งจ ์ฒซ ๋ฒˆ์งธ ์œ„์น˜์— ์ €์žฅ๋œ ํ‹ฐ์ผ“์„ ๋ฐ˜ํ™˜
}

public void minusAmount(Long amount) { // ํŒ๋งค ๊ธˆ์•ก์„ ๋”ํ•œ๋‹ค.
this.amount -= amount;
}

public void plusAmount(Long amount) { // ํŒ๋งค ๊ธˆ์•ก์„ ์ฐจ๊ฐ
this.amount += amount;
}
}
  • ํŒ๋งค์›์€ ๋งคํ‘œ์†Œ์—์„œ ์ดˆ๋Œ€์žฅ์„ ํ‹ฐ์ผ“์œผ๋กœ ๊ตํ™˜ํ•ด ์ฃผ๊ฑฐ๋‚˜ ํ‹ฐ์ผ“์„ ํŒ๋งคํ•˜๋Š” ์—ญํ• ์„ ํ•œ๋‹ค.
  • ํŒ๋งค์›์„ ๊ตฌํ˜„ํ•œ TicketSeller ํด๋ž˜์Šค๋Š” ์ž์‹ ์ด ์ผํ•˜๋Š” ๋งคํ‘œ์†Œ(ticketOffice)๋ฅผ ์•Œ๊ณ  ์žˆ์–ด์•ผ ํ•œ๋‹ค.
public class TicketSeller {
private TicketOffice ticketOffice;

public TicketSeller(TicketOffice ticketOffice) {
this.ticketOffice = ticketOffice;
}

public TicketOffice getTicketOffice() {
return ticketOffice;
}
}
  • ๋งˆ์ง€๋ง‰์œผ๋กœ ์†Œ๊ทน์žฅ์„ ๊ตฌํ˜„ํ•˜๋Š” Theater ํด๋ž˜์Šค์ด๋‹ค.
public class Theater {
private TicketSeller ticketSeller;

public Theater(TicketSeller ticketSeller) {
this.ticketSeller = ticketSeller;
}

public void enter(Audience audience) {
if (audience.getBag().hasInvitation()) { // ์ดˆ๋Œ€์žฅ์ด ์žˆ์œผ๋ฉด
Ticket ticket = ticketSeller.getTicketOffice().getTicket();
audience.getBag().setTicket(ticket); // ํŒ๋งค์›์ด ํ‹ฐ์ผ“์„ ์ค€๋‹ค.
} else { // ์ดˆ๋Œ€์žฅ์ด ์—†์œผ๋ฉด
Ticket ticket = ticketSeller.getTicketOffice().getTicket();
audience.getBag().minusAmount(ticket.getFee()); // ๊ด€๋žŒ๊ฐ์ด ๋ˆ์„ ์ง€๋ถˆํ•œ๋‹ค.
ticketSeller.getTicketOffice().plusAmount(ticket.getFee()); // ํŒ๋งค์›์ด ๋ˆ์„ ๋ฐ›๋Š”๋‹ค.
audience.getBag().setTicket(ticket); // ํ‹ฐ์ผ“์„ ์ค€๋‹ค.
}
}
}
  • ๋ช‡ ๊ฐ€์ง€ ๋ฌธ์ œ์ ์„ ๊ฐ€์ง€๊ณ  ์žˆ๋‹ค.

๐Ÿ“š ๋ฌด์—‡์ด ๋ฌธ์ œ์ธ๊ฐ€โ€‹

๐ŸŽˆ ์˜ˆ์ƒ์„ ๋น—๋‚˜๊ฐ€๋Š” ์ฝ”๋“œโ€‹

  • ๊ด€๋žŒ๊ฐ๊ณผ ํŒ๋งค์›์ด ์†Œ๊ทน์žฅ์˜ ํ†ต์ œ๋ฅผ ๋ฐ›๋Š” ์ˆ˜๋™์ ์ธ ์กด์žฌ๋ผ๋Š” ๋ฌธ์ œ๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ๋‹ค. (์†Œ๊ทน์žฅ์€ ๊ด€๋žŒ๊ฐ์˜ ๊ฐ€๋ฐฉ์„ ์—ด์–ด ์ดˆ๋Œ€์žฅ์ด ์žˆ๋Š” ์ง€ ํ™•์ธํ•œ๋‹ค.)
  • ์ดํ•ด ๊ฐ€๋Šฅํ•œ ์ฝ”๋“œ๋ž€ ๊ทธ ๋™์ž‘์ด ์•ผ์ƒ์—์„œ ํฌ๊ฒŒ ๋ฒ—์–ด๋‚˜์ง€ ์•Š๋Š” ์ฝ”๋“œ์ด์ง€๋งŒ ์•ž์˜ ์˜ˆ์ œ๋Š” ์˜ˆ์ƒ์„ ๋ฒ—์–ด๋‚œ๋‹ค.
  • ์œ„ ์˜ˆ์ œ ์ฝ”๋“œ๋ฅผ ์ดํ•ดํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” ์—ฌ๋Ÿฌ ๊ฐ€์ง€ ์„ธ๋ถ€์ ์ธ ๋‚ด์šฉ๋“ค์„ ํ•œ๊บผ๋ฒˆ์— ๊ธฐ์–ตํ•˜๊ณ  ์žˆ์–ด์•ผ ํ•œ๋‹ค. (Theater์˜ enter ๋ฉ”์„œ๋“œ๋ฅผ ์ดํ•ดํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” Audience๊ฐ€ Bag์„ ๊ฐ€์ง€๊ณ  ์žˆ๊ณ , Bag์•ˆ์— ํ˜„๊ธˆ๊ณผ ํ‹ฐ์ผ“, TicketSeller๊ฐ€ TicketOffice์—์„œ ํ‹ฐ์ผ“์„ ํŒ๋งคํ•˜๋Š” ๋“ฑ..) ํ•˜๋‚˜์˜ ํด๋ž˜์Šค๋‚˜ ๋ฉ”์„œ๋“œ์—์„œ ๋„ˆ๋ฌด ๋งŽ์€ ์„ธ๋ถ€์‚ฌํ•ญ์„ ๋‹ค๋ฃจ๊ณ  ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ์ฝ”๋“œ๋ฅผ ์ฝ๊ณ  ์ดํ•ดํ•ด์•ผ ํ•˜๋Š” ์‚ฌ๋žŒ์—๊ฒŒ ํฐ ๋ถ€๋‹ด์ด ๋œ๋‹ค.
  • ๊ฐ€์žฅ ์‹ฌ๊ฐํ•œ ๋ฌธ์ œ๋Š” Audience์™€ TicketSeller๋ฅผ ๋ณ€๊ฒฝํ•  ๊ฒฝ์šฐ Theater๋„ ํ•จ๊ป˜ ๋ณ€๊ฒฝํ•ด์•ผ ํ•œ๋‹ค๋Š” ์ ์ด๋‹ค.

๐ŸŽˆ ๋ณ€๊ฒฝ์— ์ทจ์•ฝํ•œ ์ฝ”๋“œโ€‹

  • ์˜ˆ๋ฅผ ๋“ค์–ด ๊ด€๋žŒ๊ฐ์ด ๊ฐ€๋ฐฉ์„ ๋“ค๊ณ  ์žˆ๋‹ค๋Š” ๊ฐ€์ •์ด ๋ฐ”๋€Œ์—ˆ๋‹ค๊ณ  ๊ฐ€์ •ํ•˜๋ฉด Audience ํด๋ž˜์Šค์—์„œ Bag์„ ์ œ๊ฑฐํ•ด์•ผ ํ•  ๋ฟ๋งŒ ์•„๋‹ˆ๋ผ Bag์— ์ง์ ‘ ์ ‘๊ทผํ•˜๋Š” Theater์˜ enter ๋ฉ”์„œ๋“œ ์—ญ์‹œ ์ˆ˜์ •ํ•ด์•ผ ํ•œ๋‹ค.
  • ์ง€๋‚˜์น˜๊ฒŒ ์„ธ๋ถ€์ ์ธ ์‚ฌ์‹ค์— ์˜์กดํ•ด์„œ ๋™์ž‘ํ•œ๋‹ค. ์ด์ฒ˜๋Ÿผ ๋‹ค๋ฅธ ํด๋ž˜์Šค๊ฐ€ Audience์˜ ๋‚ด๋ถ€์— ๋Œ€ํ•ด ๋” ๋งŽ์ด ์•Œ๋ฉด ์•Œ์ˆ˜๋ก Audience๋ฅผ ๋ณ€๊ฒฝํ•˜๊ธฐ ์–ด๋ ค์›Œ์ง„๋‹ค.
  • ์ด๊ฒƒ์€ ๊ฐ์ฒด ์‚ฌ์ด์˜ ์˜์กด์„ฑ(dependency)๊ณผ ๊ด€๋ จ๋œ ๋ฌธ์ œ๋‹ค. ์˜์กด์„ฑ์€ ๋ณ€๊ฒฝ์— ๋Œ€ํ•œ ์˜ํ–ฅ์„ ์•”์‹œํ•œ๋‹ค.
  • ๊ฐ์ฒด ์‚ฌ์ด์˜ ์˜์กด์„ฑ์„ ์™„์ „ํžˆ ์—†์• ๋Š” ๊ฒƒ์ด ์ •๋‹ต์€ ์•„๋‹ˆ๋‹ค. ๊ฐ์ฒด์ง€ํ–ฅ ์„ค๊ณ„๋Š” ์„œ๋กœ ์˜์กดํ•˜๋ฉด์„œ ํ˜‘๋ ฅํ•˜๋Š” ๊ฐ์ฒด๋“ค์˜ ๊ณต๋™์ฒด๋ฅผ ๊ตฌ์ถ•ํ•˜๋Š” ๊ฒƒ์ด๋‹ค. ๋”ฐ๋ผ์„œ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์˜ ๊ธฐ๋Šฅ์„ ๊ตฌํ˜„ํ•˜๋Š” ๋ฐ ํ•„์š”ํ•œ ์ตœ์†Œํ•œ์˜ ์˜์กด์„ฑ๋งŒ ์œ ์ง€ํ•˜๊ณ  ๋ถˆํ•„์š”ํ•œ ์˜์กด์„ฑ์„ ์ œ๊ฑฐํ•˜๋Š” ๊ฒƒ์ด๋‹ค.
  • ๊ฐ์ฒด ์‚ฌ์ด์˜ ์˜์กด์„ฑ์ด ๊ณผํ•œ ๊ฒฝ์šฐ๋ฅผ ๊ฐ€๋ฆฌ์ผœ ๊ฒฐํ•ฉ๋„(coupling)๊ฐ€ ๋†’๋‹ค๊ณ  ๋งํ•œ๋‹ค. ๊ฒฐํ•ฉ๋„๋Š” ์˜์กด์„ฑ๊ณผ ๊ด€๋ จ๋ผ ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ๊ฒฐํ•ฉ๋„ ์—ญ์‹œ ๋ณ€๊ฒฝ๊ณผ ๊ด€๋ จ์ด ์žˆ๋‹ค. ๊ฒฐํ•ฉ๋„๊ฐ€ ๋†’์œผ๋ฉด ํ•จ๊ป˜ ๋ณ€๊ฒฝ๋  ํ™•๋ฅ ๋„ ๋†’์•„์ง€๊ธฐ ๋•Œ๋ฌธ์— ๋ณ€๊ฒฝํ•˜๊ธฐ ์–ด๋ ค์›Œ์ง„๋‹ค.
  • ๋”ฐ๋ผ์„œ ์„ค๊ณ„์˜ ๋ชฉํ‘œ๋Š” ๊ฐ์ฒด ์‚ฌ์ด์˜ ๊ฒฐํ•ฉ๋„๋ฅผ ๋‚ฎ์ถฐ ๋ณ€๊ฒฝ์ด ์šฉ์ดํ•œ ์„ค๊ณ„๋ฅผ ๋งŒ๋“œ๋Š” ๊ฒƒ์ด๋‹ค.

๐Ÿ“š ์„ค๊ณ„ ๊ฐœ์„ ํ•˜๊ธฐโ€‹

  • ์˜ˆ์ œ ์ฝ”๋“œ๋Š” ๊ธฐ๋Šฅ์€ ์ œ๋Œ€๋กœ ์ˆ˜ํ–‰ํ•˜์ง€๋งŒ ์ดํ•ดํ•˜๊ธฐ ์–ด๋ ต๊ณ  ๋ณ€๊ฒฝํ•˜๊ธฐ๊ฐ€ ์‰ฝ์ง€ ์•Š๋‹ค.
  • ์ฝ”๋“œ๋ฅผ ์ดํ•ดํ•˜๊ธฐ ์–ด๋ ค์šด ์ด์œ ๋Š” Theater๊ฐ€ ๊ด€๋žŒ๊ฐ์˜ ๊ฐ€๋ฐฉ๊ณผ ํŒ๋งค์›์˜ ๋งคํ‘œ์†Œ์— ์ง์ ‘ ์ ‘๊ทผํ•˜๊ธฐ ๋•Œ๋ฌธ์ด๋‹ค. ์ฆ‰, ์˜๋„๋ฅผ ์ •ํ™•ํ•˜๊ฒŒ ์†Œํ†ตํ•˜์ง€ ๋ชปํ•˜๊ธฐ ๋•Œ๋ฌธ์— ์ฝ”๋“œ๊ฐ€ ์ดํ•ดํ•˜๊ธฐ ์–ด๋ ค์›Œ์ง„ ๊ฒƒ์ด๋‹ค.
  • ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•์€ Theater๊ฐ€ Audience์™€ TicketSeller์— ๊ด€ํ•ด ๋„ˆ๋ฌด ์„ธ์„ธํ•œ ๋ถ€๋ถ„๊นŒ์ง€ ์•Œ์ง€ ๋ชปํ•˜๋„๋ก ์ •๋ณด๋ฅผ ์ฐจ๋‹จํ•˜๋ฉด ๋œ๋‹ค. Theater๊ฐ€ ์›ํ•˜๋Š” ๊ฒƒ์€ ๊ด€๋žŒ๊ฐ์ด ์†Œ๊ทน์žฅ์— ์ž…์žฅํ•˜๋Š” ๊ฒƒ๋ฟ์ด๋‹ค.
  • ์ฆ‰, ๊ด€๋žŒ๊ฐ๊ณผ ํŒ๋งค์›์„ ์ž์œจ์ ์ธ ์กด์žฌ๋กœ ๋งŒ๋“ค๋ฉด ๋œ๋‹ค.

๐ŸŽˆ ์ž์œจ์„ฑ์„ ๋†’์ด์žโ€‹

  • ์ฒซ ๋ฒˆ์งธ ๋‹จ๊ณ„๋Š” Theater์˜ enter ๋ฉ”์„œ๋“œ์—์„œ TicketOffice์— ์ ‘๊ทผํ•˜๋Š” ๋ชจ๋“  ์ฝ”๋“œ๋ฅผ TicketSeller ๋‚ด๋ถ€๋กœ ์ˆจ๊ธฐ๋Š” ๊ฒƒ์ด๋‹ค.
  • TicketSeller์— sellTo ๋ฉ”์„œ๋“œ๋ฅผ ์ถ”๊ฐ€ํ•˜๊ณ  Theater์— ์žˆ๋˜ ๋กœ์ง์„ ์ด ๋ฉ”์„œ๋“œ์— ์˜ฎ๊ธด๋‹ค.
public class TicketSeller {
private TicketOffice ticketOffice;

public TicketSeller(TicketOffice ticketOffice) {
this.ticketOffice = ticketOffice;
}

public void sellTo(Audience audience) {
if (audience.getBag().hasInvitation()) {
Ticket ticket = ticketOffice.getTicket();
audience.getBag().setTicket(ticket);
} else {
Ticket ticket = ticketOffice.getTicket();
audience.getBag().minusAmount(ticket.getFee());
ticketOffice.plusAmount(ticket.getFee());
audience.getBag().setTicket(ticket);
}
}
}
  • ticketOffice๋Š” ์ ‘๊ทผ ๊ฐ€๋Šฅํ•œ ํผ๋ธ”๋ฆญ ๋ฉ”์„œ๋“œ๊ฐ€ ๋” ์ด์ƒ ์กด์žฌํ•˜์ง€ ์•Š๊ธฐ ๋•Œ๋ฌธ์— ์™ธ๋ถ€์—์„œ๋Š” ticketOffice์— ์ง์ ‘ ์ ‘๊ทผํ•  ์ˆ˜ ์—†๊ฒŒ ๋˜์—ˆ๋‹ค. TicketSeller๋Š” ticketOffice์—์„œ ํ‹ฐ์ผ“์„ ๊บผ๋‚ด๊ฑฐ๋‚˜ ํŒ๋งค ์š”๊ธˆ์„ ์ ๋ฆฝํ•˜๋Š” ์ผ์„ ์Šค์Šค๋กœ ์ˆ˜ํ–‰ํ•  ์ˆ˜๋ฐ–์— ์—†๋‹ค.
  • ์ด์ฒ˜๋Ÿผ ๊ฐœ๋…์ ์ด๊ฑฐ๋‚˜ ๋ฌผ๋ฆฌ์ ์œผ๋กœ ๊ฐ์ฒด ๋‚ด๋ถ€์˜ ์„ธ๋ถ€์ ์ธ ์‚ฌํ•ญ์„ ๊ฐ์ถ”๋Š” ๊ฒƒ์„ ์บก์Šํ™”(encapsulation)๋ผ๊ณ  ๋ถ€๋ฅธ๋‹ค. ์บก์Šํ™”์˜ ๋ชฉ์ ์€ ๋ณ€๊ฒฝํ•˜๊ธฐ ์‰ฌ์šด ๊ฐ์ฒด๋ฅผ ๋งŒ๋“œ๋Š” ๊ฒƒ์ด๋‹ค. ์บก์Šํ™”๋ฅผ ํ†ตํ•ด ๊ฐ์ฒด ๋‚ด๋ถ€๋กœ์˜ ์ ‘๊ทผ์„ ์ œํ•œํ•˜๋ฉด ๊ฐ์ฒด์™€ ๊ฐ์ฒด ์‚ฌ์ด์˜ ๊ฒฐํ•ฉ๋„๋ฅผ ๋‚ฎ์ถœ ์ˆ˜ ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ์„ค๊ณ„์— ์ข€ ๋” ์‰ฝ๊ฒŒ ๋ณ€๊ฒฝํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋œ๋‹ค.
  • ์ด์ œ Theater์˜ enter ๋ฉ”์„œ๋“œ๋Š” sellTo๋ฅผ ํ˜ธ์ถœํ•˜๋Š” ๊ฐ„๋‹จํ•œ ์ฝ”๋“œ๋กœ ๋ฐ”๋€๋‹ค.
public class Theater {
private TicketSeller ticketSeller;

public Theater(TicketSeller ticketSeller) {
this.ticketSeller = ticketSeller;
}

public void enter(Audience audience) {
ticketSeller.sellTo(audience);
}
}
  • ์ˆ˜์ •๋œ Theaterํด๋ž˜์Šค๋Š” ์–ด๋””์—์„œ๋„ ticketOffice์— ์ ‘๊ทผํ•  ์ˆ˜ ์—†๊ฒŒ ๋˜์—ˆ๋‹ค. TicketSeller ๋‚ด๋ถ€์— ์กด์žฌํ•œ๋‹ค๋Š” ์‚ฌ์‹ค๋„ ์•Œ์ง€ ๋ชปํ•œ๋‹ค. ๋‹จ์ง€ Theater๋Š” ticketSeller๊ฐ€ sellTo ๋ฉ”์‹œ์ง€๋ฅผ ์ดํ•ดํ•˜๊ณ  ์‘๋‹ตํ•  ์ˆ˜ ์žˆ๋‹ค๋Š” ์‚ฌ์‹ค๋งŒ ์•Œ๊ณ  ์žˆ์„ ๋ฟ์ด๋‹ค.
  • Theater๋Š” ์˜ค์ง TicketSeller์˜ ์ธํ„ฐํŽ˜์ด์Šค์—๋งŒ ์œ์กดํ•œ๋‹ค. TicketSeller๊ฐ€ ๋‚ด๋ถ€์— TicketOffice ์ธ์Šคํ„ด์Šค๋ฅผ ํฌํ•จํ•˜๊ณ  ์žˆ๋‹ค๋Š” ์‚ฌ์‹ค์€ ๊ตฌํ˜„์˜ ์˜์—ญ์— ์†ํ•œ๋‹ค. ์ธํ„ฐํŽ˜์ด์Šค๋งŒ์„ ๊ณต๊ฐœํ•˜๋Š” ๊ฒƒ์€ ๊ฐ์ฒด ์‚ฌ์ด์˜ ๊ฒฐํ•ฉ๋„๋ฅผ ๋‚ฎ์ถ”๊ณ  ๋ณ€๊ฒฝํ•˜๊ธฐ ์‰ฌ์šด ์ฝ”๋“œ๋ฅผ ์ž‘์„ฑํ•˜๊ธฐ ์œ„ํ•ด ๋”ฐ๋ผ์•ผ ํ•˜๋Š” ๊ฐ€์žฅ ๊ธฐ๋ณธ์ ์ธ ์„ค๊ณ„ ์›์น™์ด๋‹ค.
  • ์ด์ œ Audience์˜ ์บก์Šํ™”๋ฅผ ๊ฐœ์„ ํ•œ๋‹ค. TicketSeller๋Š” Audience์˜ getBag ๋ฉ”์„œ๋“œ๋ฅผ ํ˜ธ์ถœํ•ด์„œ Audience์˜ Bag ์ธ์Šคํ„ด์Šค์— ์ง์ ‘ ์ ‘๊ทผํ•œ๋‹ค. ์—ฌ์ „ํžˆ TicketSeller์— ์˜์กดํ•˜๊ณ  ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ์ž์œจ์ ์ธ ์กด์žฌ๊ฐ€ ์•„๋‹ˆ๋‹ค.
  • Audience์— buy ๋ฉ”์„œ๋“œ๋ฅผ ์ถ”๊ฐ€ํ•˜๊ณ  TicketSeller์˜ sellTo ๋ฉ”์„œ๋“œ์—์„œ getBag ๋ฉ”์„œ๋“œ์— ์ ‘๊ทผํ•˜๋Š” ๋ถ€๋ถ„์„ buy ๋ฉ”์„œ๋“œ๋กœ ์˜ฎ๊ธด๋‹ค.
public class Audience {
private Bag bag;

public Audience(Bag bag) {
this.bag = bag;
}

public Long buy(Ticket ticket) {
if (bag.hasInvitation()) {
bag.setTicket(ticket);
return 0L;
} else {
bag.setTicket(ticket);
bag.minusAmount(ticket.getFee());
return ticket.getFee();
}
}
}
  • ์™ธ๋ถ€์˜ ์ œ 3์ž๊ฐ€ ์ž์‹ ์˜ ๊ฐ€๋ฐฉ์„ ์—ด์–ด๋ณด๋„๋ก ํ—ˆ์šฉํ•˜์ง€ ์•Š๊ฒŒ ๋˜์—ˆ๋‹ค. Audience๊ฐ€ Bag์„ ์ง์ ‘ ์ฒ˜๋ฆฌํ•œ๋‹ค. ์™ธ๋ถ€์—์„œ Audience๊ฐ€ Bag์„ ์†Œ์œ ํ•˜๊ณ  ์žˆ๋‹ค๋Š” ์‚ฌ์‹ค์„ ์•Œ ํ•„์š”๊ฐ€ ์—†๋‹ค.
  • ์ด์ œ ๋‹ค์Œ๊ณผ ๊ฐ™์ด TicketSeller๊ฐ€ Audience์˜ ์ธํ„ฐํŽ˜์ด์Šค๋งŒ ์˜์กดํ•˜๋„๋ก ์ˆ˜์ •ํ•˜์ž.
public class TicketSeller {
private TicketOffice ticketOffice;

public TicketSeller(TicketOffice ticketOffice) {
this.ticketOffice = ticketOffice;
}

public void sellTo(Audience audience) {
ticketOffice.plusAmount(audience.buy(ticketOffice.getTicket()));
}
}
  • ์บก์Šํ™” ๊ฐœ์„  ํ›„ ํฌ๊ฒŒ ๋‹ฌ๋ผ์ง„ ์ ์€ Audience์™€ TicketSeller๊ฐ€ ๋‚ด๋ถ€ ๊ตฌํ˜„์„ ์™ธ๋ถ€์— ๋…ธ์ถœํ•˜์ง€ ์•Š๊ณ  ์ž์‹ ์˜ ๋ฌธ์ œ๋ฅผ ์Šค์Šค๋กœ ์ฑ…์ž„์ง€๊ณ  ํ•ด๊ฒฐํ•œ๋‹ค๋Š” ๊ฒƒ์ด๋‹ค. ์ฆ‰, ์ž์œจ์ ์ธ ์กด์žฌ๊ฐ€ ๋œ ๊ฒƒ์ด๋‹ค.

๐ŸŽˆ ์บก์Šํ™”์™€ ์‘์ง‘๋„โ€‹

  • ๋ฐ€์ ‘ํ•˜๊ฒŒ ์—ฐ๊ด€๋œ ์ž‘์—…๋งŒ์„ ์ˆ˜ํ–‰ํ•˜๊ณ  ์—ฐ๊ด€์„ฑ ์—†๋Š” ์ž‘์—…์€ ๋‹ค๋ฅธ ๊ฐ์ฒด์— ์œ„์ž„ํ•˜๋Š” ๊ฐ์ฒด๋ฅผ ๊ฐ€๋ฆฌ์ผœ ์‘์ง‘๋„(cohesion)๊ฐ€ ๋†’๋‹ค๊ณ  ๋งํ•œ๋‹ค. ์ž์‹ ์˜ ๋ฐ์ดํ„ฐ๋ฅผ ์Šค์Šค๋กœ ์ฒ˜๋ฆฌํ•˜๋Š” ์ž์œจ์ ์ธ ๊ฐ์ฒด๋ฅผ ๋งŒ๋“ค๋ฉด ๊ฒฐํ•ฉ๋„๋ฅผ ๋‚ฎ์ถœ ์ˆ˜ ์žˆ์„๋ฟ๋”๋Ÿฌ ์‘์ง‘๋„๋ฅผ ๋†’์ผ ์ˆ˜ ์žˆ๋‹ค.
  • ์‘์ง‘๋„๋ฅผ ๋†’์ด๊ธฐ ์œ„ํ•ด์„œ ๊ฐ์ฒด ์Šค์Šค๋กœ ์ž์‹ ์˜ ๋ฐ์ดํ„ฐ๋ฅผ ์ฑ…์ž„์ ธ์•ผ ํ•œ๋‹ค.
  • ์™ธ๋ถ€์˜ ๊ฐ„์„ญ์„ ์ตœ๋Œ€ํ•œ ๋ฐฐ์ œํ•˜๊ณ  ๋ฉ”์‹œ์ง€๋ฅผ ํ†ตํ•ด์„œ๋งŒ ํ˜‘๋ ฅํ•˜๋Š” ์ž์œจ์ ์ธ ๊ฐ์ฒด๋“ค์˜ ๊ณต๋™์ฒด๋ฅผ ๋งŒ๋“œ๋Š” ๊ฒƒ์ด ํ›Œ๋ฅญํ•œ ๊ฐ์ฒด์ง€ํ–ฅ์„ ์„ค๊ณ„๋ฅผ ์–ป์„ ์ˆ˜ ์žˆ๋Š” ์ง€๋ฆ„๊ธธ์ธ ๊ฒƒ์ด๋‹ค.

๐ŸŽˆ ์ ˆ์ฐจ์ง€ํ–ฅ๊ณผ ๊ฐ์ฒด์ง€ํ–ฅโ€‹

  • ์ˆ˜์ •ํ•˜๊ธฐ ์ „ ์ฝ”๋“œ์˜ ๋ชจ๋“  ์ฒ˜๋ฆฌ๋Š” Theater์˜ enter ๋ฉ”์„œ๋“œ ์•ˆ์— ์กด์žฌํ–ˆ์—ˆ๋‹ค. ์ด ๊ด€์ ์—์„œ enter ๋ฉ”์„œ๋“œ๋Š” ํ”„๋กœ์„ธ์Šค(Process)์ด๋ฉฐ Audience, TicketSeller, Bag, TicketOffice๋Š” ๋ฐ์ดํ„ฐ์ด๋‹ค. ์ด์ฒ˜๋Ÿผ ํ”„๋กœ์„ธ์Šค์™€ ๋ฐ์ดํ„ฐ๋ฅผ ๋ณ„๋„์˜ ๋ชจ๋“ˆ์— ์œ„์น˜์‹œํ‚ค๋Š” ๋ฐฉ์‹์„ ์ ˆ์ฐจ์  ํ”„๋กœ๊ทธ๋ž˜๋ฐ์ด๋ผ๊ณ  ๋ถ€๋ฅธ๋‹ค.
  • ์ ˆ์ฐจ์  ํ”„๋กœ๊ทธ๋ž˜๋ฐ์€ ์ˆ˜๋™์ ์ด๊ณ , ์†Œ๊ทน์ ์ธ ์กด์žฌ์ด๋‹ค. ๋˜ํ•œ, ์˜ˆ์ƒ์„ ๋„ˆ๋ฌด๋‚˜๋„ ์‰ฝ๊ฒŒ ๋ฒ—์–ด๋‚˜๊ธฐ ๋•Œ๋ฌธ์— ์›ํ™œํ•˜๊ฒŒ ์˜์‚ฌ์†Œํ†ตํ•˜์ง€ ๋ชปํ•œ๋‹ค. ๋” ํฐ ๋ฌธ์ œ๋Š” ๋ฐ์ดํ„ฐ์˜ ๋ณ€๊ฒฝ์œผ๋กœ ์ธํ•œ ์˜ํ–ฅ์„ ์ง€์—ญ์ ์œผ๋กœ ๊ณ ๋ฆฝ์‹œํ‚ค๊ธฐ ์–ด๋ ต๋‹ค๋Š” ๊ฒƒ์ด๋‹ค.
  • ๋ณ€๊ฒฝํ•˜๊ธฐ ์‰ฌ์šด ์„ค๊ณ„๋Š” ํ•œ ๋ฒˆ์— ํ•˜๋‚˜์˜ ํด๋ž˜์Šค๋งŒ ๋ณ€๊ฒฝํ•  ์ˆ˜ ์žˆ๋Š” ์„ค๊ณ„๋‹ค.
  • ์ˆ˜์ • ํ›„ ์ฝ”๋“œ์ฒ˜๋Ÿผ ๋ฐ์ดํ„ฐ์™€ ํ”„๋กœ์„ธ์Šค๊ฐ€ ๋™์ผํ•œ ๋ชจ๋“ˆ ๋‚ด๋ถ€์— ์œ„์น˜ํ•˜๋„๋ก ํ”„๋กœ๊ทธ๋ž˜๋ฐํ•˜๋Š” ๋ฐฉ์‹์„ ๊ฐ์ฒด์ง€ํ–ฅ ํ”„๋กœ๊ทธ๋ž˜๋ฐ์ด๋ผ๊ณ  ๋ถ€๋ฅธ๋‹ค.
  • ํ›Œ๋ฅญํ•œ ๊ฐ์ฒด์ง€ํ–ฅ ์„ค๊ณ„์˜ ํ•ต์‹ฌ์€ ์บก์Šํ™”๋ฅผ ์ด์šฉํ•ด ์˜์กด์„ฑ์„ ์ ์ ˆํžˆ ๊ด€๋ฆฌํ•จ์œผ๋กœ์จ ๊ฐ์ฒด ์‚ฌ์ด์˜ ๊ฒฐํ•ฉ๋„๋ฅผ ๋‚ฎ์ถ”๋Š” ๊ฒƒ์ด๋‹ค.

๐ŸŽˆ ์ฑ…์ž„์˜ ์ด๋™โ€‹

  • ๋‘ ๋ฐฉ์‹ ์‚ฌ์ด์— ๊ทผ๋ณธ์ ์ธ ์ฐจ์ด๋ฅผ ๋งŒ๋“œ๋Š” ๊ฒƒ์€ ์ฑ…์ž„์˜ ์ด๋™์ด๋‹ค.
  • ์ˆ˜์ •์ „ ์ฝ”๋“œ์ธ ์ ˆ์ฐจ์  ํ”„๋กœ๊ทธ๋ž˜๋ฐ ๋ฐฉ์‹์œผ๋กœ ์ž‘์„ฑ๋œ ์ฝ”๋“œ๋Š” ์ฃผ๋กœ Theater์— ์˜ํ•ด ์ œ์–ด๋œ๋‹ค. ์ด ๋ง์€ ์ฆ‰, ์ฑ…์ž„์ด Theater์— ์ง‘์ค‘๋ผ ์žˆ๋‹ค๋Š” ๊ฒƒ์ด๋‹ค.
  • ๊ทธ์— ๋ฐ˜ํ•ด ๊ฐ์ฒด์ง€ํ–ฅ ์„ค๊ณ„์—์„œ๋Š” ์ œ์–ด ํ๋ฆ„์ด ๊ฐ ๊ฐ์ฒด์— ์ ์ ˆํ•˜๊ฒŒ ๋ถ„์‚ฐ๋ผ ์žˆ๋‹ค. ํ•˜๋‚˜์˜ ๊ธฐ๋Šฅ์„์™„์„ฑํ•˜๋Š” ๋ฐ ํ•„์š”ํ•œ ์ฑ…์ž„์ด ์—ฌ๋Ÿฌ ๊ฐ์ฒด์— ๊ฑธ์ณ ๋ถ„์‚ฐ๋ผ ์žˆ๋‹ค. ๋‹ค์‹œ ๋งํ•ด Theater์— ๋ชฐ๋ ค ์žˆ๋˜ ์ฑ…์ž„์ด ๊ฐœ๋ณ„ ๊ฐ์ฒด๋กœ ์ด๋™ํ•œ ๊ฒƒ์ด๋‹ค. ์ด๊ฒƒ์ด ๋ฐ”๋กœ ์ฑ…์ž„์˜ ์ด๋™์ด ์˜๋ฏธํ•˜๋Š” ๊ฒƒ์ด๋‹ค. ๊ฐ ๊ฐ์ฒด๋Š” ์ž์‹ ์„ ์Šค์Šค๋กœ ์ฑ…์ž„์ง„๋‹ค.
  • ๊ฐ์ฒด์ง€ํ–ฅ ์„ค๊ณ„์˜ ํ•ต์‹ฌ์€ ์ ์ ˆํ•œ ๊ฐ์ฒด์— ๋Œ€ํ•œ ์ฑ…์ž„์„ ํ• ๋‹น ํ•˜๋Š” ๊ฒƒ์ด๋‹ค. ๋”ฐ๋ผ์„œ ๊ฐ์ฒด๊ฐ€ ์–ด๋–ค ๋ฐ์ดํ„ฐ๋ฅผ ๊ฐ€์ง€๋Š๋ƒ๋ณด๋‹ค๋Š” ๊ฐ์ฒด์— ์–ด๋–ค ์ฑ…์ž„์„ ํ• ๋‹นํ•  ๊ฒƒ์ด๋ƒ์— ์ดˆ์ ์„ ๋งž์ถฐ์•ผ ํ•œ๋‹ค.
  • ์„ค๊ณ„๋ฅผ ์–ด๋ ต๊ฒŒ ๋งŒ๋“œ๋Š” ๊ฒƒ์€ ์˜์กด์„ฑ์ด๋‹ค. ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•์€ ์˜์กด์„ฑ์„ ์ œ๊ฑฐํ•จ์œผ๋กœ์จ ๊ฐ์ฒด ์‚ฌ์ด์˜ ๊ฒฐํ•ฉ๋„๋ฅผ ๋‚ฎ์ถ”๋Š” ๊ฒƒ์ด๋‹ค. ์˜ˆ์ œ์—์„œ ๊ฒฐํ•ฉ๋„๋ฅผ ๋‚ฎ์ถ”๊ธฐ ์œ„ํ•ด ๋‚ด๋ถ€๋กœ ๊ฐ์ถฐ ์บก์Šํ™”ํ–ˆ๋‹ค.
  • ๊ฒฐ๊ณผ์ ์œผ๋กœ ๋ถˆํ•„์š”ํ•œ ์„ธ๋ถ€์‚ฌํ•ญ์„ ๊ฐ์ฒด ๋‚ด๋ถ€๋ฅผ ์บก์Šํ™”ํ•˜๋Š” ๊ฒƒ์€ ๊ฐ์ฒด์˜ ์ž์œจ์„ฑ์„ ๋†’์ด๊ณ  ์‘์ง‘๋„ ๋†’์€ ๊ฐ์ฒด๋“ค์˜ ๊ณต๋™์ฒด๋ฅผ ์ฐฝ์กฐํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•œ๋‹ค.

๐ŸŽˆ ๋” ๊ฐœ์„ ํ•  ์ˆ˜ ์žˆ๋‹คโ€‹

  • Audience ํด๋ž˜์Šค๋Š” ์ž์œจ์ ์ธ ์กด์žฌ์ด์ง€๋งŒ Bag์€ Audience์— ์˜ํ•ด ๋Œ๋ ค๋‹ค๋‹ˆ๋Š” ์ˆ˜๋™์ ์ธ ์กด์žฌ๋‹ค.
  • Bag์„ ์ž์œจ์ ์ธ ์กด์žฌ๋กœ ๋ฐ”๊ฟ”๋ณธ๋‹ค.
public class Bag {
private Long amount;
private Ticket ticket;
private Invitation invitation;

public Long hold(Ticket ticket) {
if (hasInvitation()) {
setTicket(ticket);
return 0L;
} else {
setTicket(ticket);
minusAmount(ticket.getFee());
return ticket.getFee();
}
}

private void setTicket(Ticket ticket) {
this.ticket = ticket;
}

private boolean hasInvitation() {
return invitation != null;
}

private void minusAmount(Long amount) {
this.amount -= amount;
}
}
  • public ๋ฉ”์„œ๋“œ์˜€๋˜ hasInvitation, minusAmount, setTicket ๋ฉ”์„œ๋“œ๋“ค์€ ๋” ์ด์ƒ ์™ธ๋ถ€์—์„œ ์‚ฌ์šฉ๋˜์ง€ ์•Š๊ณ  ๋‚ด๋ถ€์—์„œ๋งŒ ์‚ฌ์šฉ๋˜๊ธฐ ๋•Œ๋ฌธ์— ๊ฐ€์‹œ์„ฑ์„ private์œผ๋กœ ๋ณ€๊ฒฝํ–ˆ๋‹ค.
  • ์ด์ œ Audience๋ฅผ ์ธํ„ฐํŽ˜์ด์Šค์—๋งŒ ๊ตฌํ˜„ํ•˜๋„๋ก ์ˆ˜์ •ํ•œ๋‹ค.
public class Audience {
private Bag bag;

public Audience(Bag bag) {
this.bag = bag;
}

public Long buy(Ticket ticket) {
return bag.hold(ticket);
}
}
  • TicketSeller๋„ TicketOffice์˜ ์ž์œจ๊ถŒ์„ ์นจํ•ดํ•œ๋‹ค.
public class TicketOffice {
private Long amount;
private List<Ticket> tickets = new ArrayList<>();

public TicketOffice(Long amount, Ticket, ...tickets) {
this.amount = amount;
this.tickets.addAll(Arrays.asList(tickets));
}

public void sellTicketTo(Audience audience) {
plusAmount(audience.buy(getTicket())); // ์˜์กด์„ฑ์ด ์ƒ๊น€
}

private Ticket getTicket() {
return tickets.remove(0);
}

private void plusAmount(Long amount) {
this.amount += amount;
}
}
  • TicketSeller๊ฐ€ TicketOffice์˜ ๊ตฌํ˜„์ด ์•„๋‹Œ ์ธํ„ฐํŽ˜์ด์Šค์—๋งŒ ์˜์กดํ•˜๊ฒŒ ๋ผ์—ˆ๋‹ค.
public class TicketSeller {
private TicketOffice ticketOffice;

public TicketSeller(TicketOffice ticketOffice) {
this.ticketOffice = ticketOffice;
}

public void sellTo(Audience audience) {
ticketOffice.sellTicketTo(audience);
}
}
  • ๋ณ€๊ฒฝ ํ›„ ์‚ดํŽด๋ณด๋ฉด TicketOffice์— Audience์˜ ์˜์กด์„ฑ์ด ์ถ”๊ฐ€๋˜์—ˆ๋‹ค.
  • TicketOffice์˜ ์ž์œจ์„œ์€ ๋†’์˜€์ง€๋งŒ ์ „์ฒด ์„ค๊ณ„์˜ ๊ด€์ ์—์„œ๋Š” ๊ฒฐํ•ฉ๋„๊ฐ€ ์ƒ์Šนํ–ˆ๋‹ค. ์–ด๋–ป๊ฒŒ ํ•ด์•ผํ• ๊นŒ?
  • ํ† ๋ก  ๋์— ๊ฐœ๋ฐœํŒ€์€ TicketOffice์˜ ์ž์œจ์„ฑ๋ณด๋‹ค๋Š” Audience์— ๋Œ€ํ•œ ๊ฒฐํ•ฉ๋„๋ฅผ ๋‚ฎ์ถ”๋Š” ๊ฒƒ์ด ๋” ์ค‘์š”ํ•˜๋‹ค๋Š” ๊ฒฐ๋ก ์— ๋„๋‹ฌํ–ˆ๋‹ค.
  • ์—ฌ๊ธฐ์„œ ์•Œ๊ฒŒ๋œ ์‚ฌ์‹ค ๋‘๊ฐ€์ง€๋Š” ์–ด๋–ค ๊ธฐ๋Šฅ์„ ์„ค๊ณ„ํ•˜๋Š” ๋ฐฉ๋ฒ•์€ ํ•œ ๊ฐ€์ง€ ์ด์ƒ์ผ ์ˆ˜ ์žˆ๋‹ค. ๋‘˜์งธ, ์–ด๋–ค ๊ฒฝ์šฐ์—๋„ ๋ชจ๋“  ์‚ฌ๋žŒ๋“ค์„ ๋งŒ์กฑ์‹œํ‚ฌ ์ˆ˜ ์žˆ๋Š” ์„ค๊ณ„๋ฅผ ๋งŒ๋“ค ์ˆ˜๋Š” ์—†๋‹ค.

๐ŸŽˆ ๊ทธ๋ž˜, ๊ฑฐ์ง“๋ง์ด๋‹ค!โ€‹

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

๐Ÿ“š ๊ฐ์ฒด์ง€ํ–ฅ ์„ค๊ณ„โ€‹

๐ŸŽˆ ์„ค๊ณ„๊ฐ€ ์™œ ํ•„์š”ํ•œ๊ฐ€โ€‹

์„ค๊ณ„๋ž€ ์ฝ”๋“œ๋ฅผ ๋ฐฐ์น˜ํ•˜๋Š” ๊ฒƒ์ด๋‹ค.

  • ์˜ˆ์ œ์˜ ๋‘ ์ฝ”๋“œ์˜ ์ฝ”๋“œ๋ฅผ ๋ฐฐ์น˜ํ•˜๋Š” ๋ฐฉ๋ฒ•์€ ์™„์ „ํžˆ ๋‹ค๋ฅด๋‹ค.
  • ์ฒซ ๋ฒˆ์งธ ์ฝ”๋“œ์—์„œ๋Š” ๋ฐ์ดํ„ฐ์™€ ํ”„๋กœ์„ธ์Šค๋ฅผ ๋‚˜๋ˆ„์–ด ๋ณ„๋„์˜ ํด๋ž˜์Šค์— ๋ฐฐ์น˜ํ–ˆ์ง€๋งŒ ๋‘ ๋ฒˆ์งธ ์ฝ”๋“œ์—์„œ๋Š” ํ•„์š”ํ•œ ๋ฐ์ดํ„ฐ๋ฅผ ๋ณด์œ ํ•œ ํด๋ž˜์Šค ์•ˆ์— ํ”„๋กœ์„ธ์Šค๋ฅผ ํ•จ๊ป˜ ๋ฐฐ์น˜ํ–ˆ๋‹ค.
  • ์ข‹์€ ์„ค๊ณ„๋ž€ ์˜ค๋Š˜ ์™„์„ฑํ•ด์•ผ ํ•˜๋Š” ๊ธฐ๋Šฅ์„ ๊ตฌํ˜„ํ•˜๋Š” ์ฝ”๋“œ๋ฅผ ์งœ๋Š” ๋™์‹œ์— ๋‚ด์ผ ์‰ฝ๊ฒŒ ๋ณ€๊ฒฝํ•  ์ˆ˜ ์žˆ๋Š” ์ฝ”๋“œ๋ฅผ ์งœ์•ผ ํ•œ๋‹ค. ๋˜ํ•œ, ์˜ค๋Š˜ ์š”๊ตฌํ•˜๋Š” ๊ธฐ๋Šฅ์„ ์˜จ์ „ํžˆ ์ˆ˜ํ–‰ํ•˜๋ฉด์„œ ๋‚ด์ผ์˜ ๋ณ€๊ฒฝ์„ ๋งค๋„๋Ÿฝ๊ฒŒ ์ˆ˜์šฉํ•  ์ˆ˜ ์žˆ๋Š” ์„ค๊ณ„๋‹ค.

๐ŸŽˆ ๊ฐ์ฒด์ง€ํ–ฅ ์„ค๊ณ„โ€‹

  • ๋ณ€๊ฒฝ์— ์œ ์—ฐํ•˜๊ฒŒ ๋Œ€์‘ํ•  ์ˆ˜ ์žˆ๋Š” ์ฝ”๋“œ๋‹ค.
  • ๊ฐ์ฒด์ง€ํ–ฅ ํ”„๋กœ๊ทธ๋ž˜๋ฐ์€ ์˜์กด์„ฑ์„ ํšจ์œจ์ ์œผ๋กœ ํ†ต์ œํ•  ์ˆ˜ ์žˆ๋Š” ๋‹ค์–‘ํ•œ ๋ฐฉ๋ฒ•์„ ์ œ๊ณตํ•จ์œผ๋กœ์จ ์š”๊ตฌ์‚ฌํ•ญ ๋ณ€๊ฒฝ์— ์ข€ ๋” ์ˆ˜์›”ํ•˜๊ฒŒ ๋Œ€์‘ํ•  ์ˆ˜ ์žˆ๋Š” ๊ฐ€๋Šฅ์„ฑ์„ ๋ณด์—ฌ์ค€๋‹ค.
  • ๊ฐ์ฒด์ง€ํ–ฅ ์„ธ๊ณ„์—์„œ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์€ ๊ฐ์ฒด๋“ค๋กœ ๊ตฌ์„ฑ๋˜๋ฉฐ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์˜ ๊ธฐ๋Šฅ์€ ๊ฐ์ฒด๋“ค ๊ฐ„์˜ ์ƒํ˜ธ์ž‘์šฉ์šธ ํ†ตํ•ด ๊ตฌํ˜„๋œ๋‹ค. ๊ทธ๋ฆฌ๊ณ  ๊ฐ์ฒด๋“ค ์‚ฌ์ด์˜ ์ƒํ˜ธ์ž‘์šฉ์€ ๊ฐ์ฒด ์‚ฌ์ด์— ์ฃผ๊ณ  ๋ฐ›๋Š” ๋ฉ”์‹œ์ง€๋กœ ํ‘œํ˜„๋œ๋‹ค.
  • ํ›Œ๋ฅญํ•œ ๊ฐ์ฒด์ง€ํ–ฅ ์„ค๊ณ„๋ž€ ํ˜‘๋ ฅํ•˜๋Š” ๊ฐ์ฒด ์‚ฌ์ด์˜ ์˜์กด์„ฑ์„ ์ ์ ˆํ•˜๊ฒŒ ๊ด€๋ฆฌํ•˜๋Š” ์„ค๊ณ„๋‹ค.
  • ๋ฐ์ดํ„ฐ์™€ ํ”„๋กœ์„ธ์Šค๋ฅผ ํ•˜๋‚˜์˜ ๋ฉ์–ด๋ฆฌ๋กœ ๋ชจ์œผ๋Š” ๊ฒƒ์€ ํ›Œ๋ฅญํ•œ ๊ฐ์ฒด์ง€ํ–ฅ ์„ค๊ณ„๋กœ ๊ฐ€๋Š” ์ฒซ๊ฑธ์Œ์ด๋‹ค.
  • ์ง„์ •ํ•œ ๊ฐ์ฒด์ง€ํ–ฅ ์„ค๊ณ„๋กœ ๋‚˜์•„๊ฐ€๋Š” ๊ธธ์€ ํ˜‘๋ ฅํ•˜๋Š” ๊ฐ์ฒด๋“ค ์‚ฌ์ด์˜ ์˜์กด์„ฑ์„ ์ ์ ˆํ•˜๊ฒŒ ์กฐ์ ˆํ•จ์œผ๋กœ์จ ๋ณ€๊ฒฝ์— ์šฉ์ดํ•œ ์„ค๊ณ„๋ฅผ ๋งŒ๋“œ๋Š” ๊ฒƒ์ด๋‹ค.