diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..a54061f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+/Jun/.metadata/
diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..c3f502a
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,8 @@
+# 디폴트 무시된 파일
+/shelf/
+/workspace.xml
+# 에디터 기반 HTTP 클라이언트 요청
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/.idea/Object.iml b/.idea/Object.iml
new file mode 100644
index 0000000..d6ebd48
--- /dev/null
+++ b/.idea/Object.iml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..a9922ff
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
new file mode 100644
index 0000000..712ab9d
--- /dev/null
+++ b/.idea/jarRepositories.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/jpa-buddy.xml b/.idea/jpa-buddy.xml
new file mode 100644
index 0000000..966d5f5
--- /dev/null
+++ b/.idea/jpa-buddy.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..d7e214c
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..9183343
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml
new file mode 100644
index 0000000..2b63946
--- /dev/null
+++ b/.idea/uiDesigner.xml
@@ -0,0 +1,124 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Jun/chapter01/.classpath b/Jun/chapter01/.classpath
new file mode 100644
index 0000000..1af5298
--- /dev/null
+++ b/Jun/chapter01/.classpath
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Jun/chapter01/.project b/Jun/chapter01/.project
new file mode 100644
index 0000000..98814a4
--- /dev/null
+++ b/Jun/chapter01/.project
@@ -0,0 +1,23 @@
+
+
+ chapter01
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.m2e.core.maven2Builder
+
+
+
+
+
+ org.eclipse.m2e.core.maven2Nature
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/Jun/chapter01/.settings/org.eclipse.jdt.apt.core.prefs b/Jun/chapter01/.settings/org.eclipse.jdt.apt.core.prefs
new file mode 100644
index 0000000..d4313d4
--- /dev/null
+++ b/Jun/chapter01/.settings/org.eclipse.jdt.apt.core.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.apt.aptEnabled=false
diff --git a/Jun/chapter01/.settings/org.eclipse.jdt.core.prefs b/Jun/chapter01/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..b2ef4d6
--- /dev/null
+++ b/Jun/chapter01/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,16 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=17
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
+org.eclipse.jdt.core.compiler.processAnnotations=disabled
+org.eclipse.jdt.core.compiler.release=enabled
+org.eclipse.jdt.core.compiler.source=17
diff --git a/Jun/chapter01/.settings/org.eclipse.m2e.core.prefs b/Jun/chapter01/.settings/org.eclipse.m2e.core.prefs
new file mode 100644
index 0000000..f897a7f
--- /dev/null
+++ b/Jun/chapter01/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
diff --git a/Jun/chapter01/bin/module-info.class b/Jun/chapter01/bin/module-info.class
new file mode 100644
index 0000000..bfbf208
Binary files /dev/null and b/Jun/chapter01/bin/module-info.class differ
diff --git a/Jun/chapter01/chapter01.iml b/Jun/chapter01/chapter01.iml
new file mode 100644
index 0000000..bb76b6e
--- /dev/null
+++ b/Jun/chapter01/chapter01.iml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Jun/chapter01/pom.xml b/Jun/chapter01/pom.xml
new file mode 100644
index 0000000..0449f42
--- /dev/null
+++ b/Jun/chapter01/pom.xml
@@ -0,0 +1,18 @@
+
+ 4.0.0
+ chapter01
+ chapter01
+ 0.0.1-SNAPSHOT
+
+ src
+
+
+ maven-compiler-plugin
+ 3.8.1
+
+ 17
+
+
+
+
+
\ No newline at end of file
diff --git a/Jun/chapter01/src/theater/step01/Audience.java b/Jun/chapter01/src/theater/step01/Audience.java
new file mode 100644
index 0000000..fc1f0f6
--- /dev/null
+++ b/Jun/chapter01/src/theater/step01/Audience.java
@@ -0,0 +1,18 @@
+package theater.step01;
+
+/**
+ * Audience : 관람객
+ * 관람객은 소지품을 보관하기 위해 가방을 소지할 수 있다.
+ */
+public class Audience {
+
+ private Bag bag;
+
+ public Audience(Bag bag) {
+ this.bag = bag;
+ }
+
+ public Bag getBag() {
+ return bag;
+ }
+}
diff --git a/Jun/chapter01/src/theater/step01/Bag.java b/Jun/chapter01/src/theater/step01/Bag.java
new file mode 100644
index 0000000..50ed4d9
--- /dev/null
+++ b/Jun/chapter01/src/theater/step01/Bag.java
@@ -0,0 +1,45 @@
+package theater.step01;
+
+/**
+ * 관람객이 가지고 올 수 있는 소지품은 3가지 뿐이다.
+ * 1. 초대장
+ * 2. 현금
+ * 3. 티켓
+ */
+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;
+ }
+
+
+ public Bag(long amount){
+ this.amount = amount;
+ }
+
+ public Bag(Invitation invitation, long amount){
+ this.invitation = invitation;
+ this.amount = amount;
+ }
+
+}
diff --git a/Jun/chapter01/src/theater/step01/Invitation.java b/Jun/chapter01/src/theater/step01/Invitation.java
new file mode 100644
index 0000000..b335f2e
--- /dev/null
+++ b/Jun/chapter01/src/theater/step01/Invitation.java
@@ -0,0 +1,12 @@
+package theater.step01;
+
+import java.time.LocalDateTime;
+
+/**
+ * 이벤트 당첨자에게 발송되는 초대장을 구현하는 것으로 시작
+ */
+public class Invitation {
+
+ // 공연을 관람할 수 있는 초대일자
+ private LocalDateTime when;
+}
diff --git a/Jun/chapter01/src/theater/step01/Theater.java b/Jun/chapter01/src/theater/step01/Theater.java
new file mode 100644
index 0000000..17107a3
--- /dev/null
+++ b/Jun/chapter01/src/theater/step01/Theater.java
@@ -0,0 +1,26 @@
+package theater.step01;
+
+/**
+ * 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().plusAmonut(ticket.getFee());
+ audience.getBag().setTicket(ticket);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Jun/chapter01/src/theater/step01/Ticket.java b/Jun/chapter01/src/theater/step01/Ticket.java
new file mode 100644
index 0000000..a1a7353
--- /dev/null
+++ b/Jun/chapter01/src/theater/step01/Ticket.java
@@ -0,0 +1,14 @@
+package theater.step01;
+
+/**
+ * 공연을 관람하길 원하는 모든 사람들은 티켓을 소지하고 있어야만 한다.
+ */
+public class Ticket {
+
+ private Long fee;
+
+ public Long getFee(){
+ return fee;
+ }
+
+}
diff --git a/Jun/chapter01/src/theater/step01/TicketOffice.java b/Jun/chapter01/src/theater/step01/TicketOffice.java
new file mode 100644
index 0000000..5380a77
--- /dev/null
+++ b/Jun/chapter01/src/theater/step01/TicketOffice.java
@@ -0,0 +1,33 @@
+package theater.step01;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * TicketOffice : 매표소
+ * 매표소에서는 초대장을 티켓으로 교환하거나 구매해야 한다.
+ * 매표소에서는 판매할 티켓과 티켓의 판매 금액이 보관돼 있어야 한다.
+ */
+public class TicketOffice {
+
+ private List tickets = new ArrayList<>();
+ private Long amount;
+
+ public TicketOffice(Long amount, Ticket ... tickets) {
+ this.tickets.addAll(Arrays.asList(tickets));
+ this.amount = amount;
+ }
+
+ public Ticket getTicket(){
+ return tickets.remove(0);
+ }
+
+ public void minusAmonut(Long amount){
+ this.amount -= amount;
+ }
+
+ public void plusAmonut(Long amonut){
+ this.amount += amount;
+ }
+}
diff --git a/Jun/chapter01/src/theater/step01/TicketSeller.java b/Jun/chapter01/src/theater/step01/TicketSeller.java
new file mode 100644
index 0000000..90066d6
--- /dev/null
+++ b/Jun/chapter01/src/theater/step01/TicketSeller.java
@@ -0,0 +1,19 @@
+package theater.step01;
+
+/**
+ * TicketSeller : 판매원
+ * 판매원은 매표소에서 초대장을 티켓으로 교환해 주거나 티켓을 판매하는 역할을 수행한다.
+ * 판매원은 구현한 TicketSeller 클래스는 자신이 일하는 매표소를 알고 있어야 한다.
+ * */
+public class TicketSeller {
+
+ private TicketOffice ticketOffice;
+
+ public TicketSeller(TicketOffice ticketOffice) {
+ this.ticketOffice = ticketOffice;
+ }
+
+ public TicketOffice getTicketOffice() {
+ return ticketOffice;
+ }
+}
diff --git a/Jun/chapter01/src/theater/step01/review/reasonOfBadCode b/Jun/chapter01/src/theater/step01/review/reasonOfBadCode
new file mode 100644
index 0000000..4082102
--- /dev/null
+++ b/Jun/chapter01/src/theater/step01/review/reasonOfBadCode
@@ -0,0 +1,24 @@
+소프트웨어 모듈이 가져야하는 세 가지 기능
+1. 제대로 동작해야 한다. (== 정상적으로 동작해야 한다)
+2. 변경하기 쉬워야 한다 (== 유지보수하기 쉬워야 한다)
+3. 코드를 읽는 사람과 의사소통이 가능해야한다.(== 가독성이 좋아야한다)
+
+1. 예상을 빗나가는 코드
+Theater(소극장) 클래스를 보면, 관람객과 판매원이 소극장의 통제를 받는 소극적인 존재다.
+
+현재 소극장의 코드에서는
+- 소극장이 관람객의 가방을 열어보고 티켓이 있는지 확인한다.
+- 소극장이 관람객의 가방을 열어보고 돈의 양을 조절하고 있다.
+- 소극장이 판매원이 일하는 매표소의 티켓과 현금에 접근하고 있다.
+
+=> 이 코드의 문제점
+1. 이 코드는 "예상을 빗나가는 코드"이기 떄문에 "의사소통"이 원활하지 못하다.
+소극장의 역할은 관람객을 맞이하는 것인데, 이상한 책임을 지고있다.
+우리가 생각하는 상식과 너무나도 다르기에 코드를 읽는 사람과 제대로된 의사소통을 하지 못하게 되는 것.
+
+2. 세부적인 내용들을 다 알고 있어야 한다.
+각 클래스가 어떤 필드를 가지고 있는지 다 알고있어야만 의사소통을 할 수 있다. => 의사소통하기 어렵게 만든다.
+
+3. 변경에 취약하다.
+Audience와 TicketSeller 클래스를 변경할 경우, Theater도 변경해야한다.
+
diff --git a/Jun/chapter01/src/theater/step02/Audience.java b/Jun/chapter01/src/theater/step02/Audience.java
new file mode 100644
index 0000000..980d92f
--- /dev/null
+++ b/Jun/chapter01/src/theater/step02/Audience.java
@@ -0,0 +1,25 @@
+package theater.step02;
+
+/**
+ * Audience : 관람객
+ * 관람객은 소지품을 보관하기 위해 가방을 소지할 수 있다.
+ */
+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();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Jun/chapter01/src/theater/step02/Bag.java b/Jun/chapter01/src/theater/step02/Bag.java
new file mode 100644
index 0000000..9ea6268
--- /dev/null
+++ b/Jun/chapter01/src/theater/step02/Bag.java
@@ -0,0 +1,48 @@
+package theater.step02;
+
+import theater.step02.Invitation;
+import theater.step02.Ticket;
+
+/**
+ * 관람객이 가지고 올 수 있는 소지품은 3가지 뿐이다.
+ * 1. 초대장
+ * 2. 현금
+ * 3. 티켓
+ */
+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;
+ }
+
+
+ public Bag(long amount){
+ this.amount = amount;
+ }
+
+ public Bag(Invitation invitation, long amount){
+ this.invitation = invitation;
+ this.amount = amount;
+ }
+
+}
diff --git a/Jun/chapter01/src/theater/step02/Invitation.java b/Jun/chapter01/src/theater/step02/Invitation.java
new file mode 100644
index 0000000..a0e6365
--- /dev/null
+++ b/Jun/chapter01/src/theater/step02/Invitation.java
@@ -0,0 +1,12 @@
+package theater.step02;
+
+import java.time.LocalDateTime;
+
+/**
+ * 이벤트 당첨자에게 발송되는 초대장을 구현하는 것으로 시작
+ */
+public class Invitation {
+
+ // 공연을 관람할 수 있는 초대일자
+ private LocalDateTime when;
+}
diff --git a/Jun/chapter01/src/theater/step02/Theater.java b/Jun/chapter01/src/theater/step02/Theater.java
new file mode 100644
index 0000000..784475a
--- /dev/null
+++ b/Jun/chapter01/src/theater/step02/Theater.java
@@ -0,0 +1,22 @@
+package theater.step02;
+
+import theater.step02.Audience;
+import theater.step02.Ticket;
+import theater.step02.TicketSeller;
+
+/**
+ * Theater : 소극장
+ * 관람객을 맞이할 수 있어야 한다.
+ */
+public class Theater {
+
+ private TicketSeller ticketSeller;
+
+ public Theater(TicketSeller ticketSeller) {
+ this.ticketSeller = ticketSeller;
+ }
+
+ public void enter(Audience audience){
+ ticketSeller.sellTo(audience);
+ }
+}
\ No newline at end of file
diff --git a/Jun/chapter01/src/theater/step02/Ticket.java b/Jun/chapter01/src/theater/step02/Ticket.java
new file mode 100644
index 0000000..858060a
--- /dev/null
+++ b/Jun/chapter01/src/theater/step02/Ticket.java
@@ -0,0 +1,14 @@
+package theater.step02;
+
+/**
+ * 공연을 관람하길 원하는 모든 사람들은 티켓을 소지하고 있어야만 한다.
+ */
+public class Ticket {
+
+ private Long fee;
+
+ public Long getFee(){
+ return fee;
+ }
+
+}
diff --git a/Jun/chapter01/src/theater/step02/TicketOffice.java b/Jun/chapter01/src/theater/step02/TicketOffice.java
new file mode 100644
index 0000000..c5d01a3
--- /dev/null
+++ b/Jun/chapter01/src/theater/step02/TicketOffice.java
@@ -0,0 +1,35 @@
+package theater.step02;
+
+import theater.step02.Ticket;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * TicketOffice : 매표소
+ * 매표소에서는 초대장을 티켓으로 교환하거나 구매해야 한다.
+ * 매표소에서는 판매할 티켓과 티켓의 판매 금액이 보관돼 있어야 한다.
+ */
+public class TicketOffice {
+
+ private List tickets = new ArrayList<>();
+ private Long amount;
+
+ public TicketOffice(Long amount, Ticket... tickets) {
+ this.tickets.addAll(Arrays.asList(tickets));
+ this.amount = amount;
+ }
+
+ public Ticket getTicket(){
+ return tickets.remove(0);
+ }
+
+ public void minusAmonut(Long amount){
+ this.amount -= amount;
+ }
+
+ public void plusAmonut(Long amonut){
+ this.amount += amount;
+ }
+}
diff --git a/Jun/chapter01/src/theater/step02/TicketSeller.java b/Jun/chapter01/src/theater/step02/TicketSeller.java
new file mode 100644
index 0000000..8482a58
--- /dev/null
+++ b/Jun/chapter01/src/theater/step02/TicketSeller.java
@@ -0,0 +1,26 @@
+package theater.step02;
+
+import theater.step02.Audience;
+import theater.step02.TicketOffice;
+
+/**
+ * TicketSeller : 판매원
+ * 판매원은 매표소에서 초대장을 티켓으로 교환해 주거나 티켓을 판매하는 역할을 수행한다.
+ * 판매원은 구현한 TicketSeller 클래스는 자신이 일하는 매표소를 알고 있어야 한다.
+ * */
+public class TicketSeller {
+
+ private TicketOffice ticketOffice;
+
+ public TicketSeller(TicketOffice ticketOffice) {
+ this.ticketOffice = ticketOffice;
+ }
+
+ public TicketOffice getTicketOffice() {
+ return ticketOffice;
+ }
+
+ public void sellTo(Audience audience) {
+ ticketOffice.plusAmonut(audience.buy(ticketOffice.getTicket()));
+ }
+}
diff --git a/Jun/chapter01/src/theater/step02/review/changeList b/Jun/chapter01/src/theater/step02/review/changeList
new file mode 100644
index 0000000..7815aa9
--- /dev/null
+++ b/Jun/chapter01/src/theater/step02/review/changeList
@@ -0,0 +1,30 @@
+** step01 -> step02의 변경사항
+1. Theater 클래스의 enter 메서드를 변경함.
+ 결합도를 낮추고, 자율성을 높이기 위해서 Theater은 TicketSeller에게 "관람객에게 티켓을 판매해"라는 메시지를 송신한다.
+ TicketSeller는 "관람객에게 티켓을 판매해"라는 메시지를 수신하고, sellTo 메서드를 통해서 응답한다.
+ 이 과정을 통해서 TicketSeller의 내부 구현을 "캡슐화"가 가능해지며 자율성을 확보할 수 있었다.
+
+2. Theater로부터 TicketSeller는 자율성을 확보했지만, audience는 TicketSeller에 의해서 수동적인 존재로 변경되었다.
+ 이 부분도 분리해주기 위해 ticketSeller는 "티켓을 구매해"라는 메시지를 송신한다.
+ Audienece는 "티켓을 구매해"라는 메시지를 수신하고, buy(Ticket ticket) 메서드를 통해서 응답한다.
+ 이 과정을 통해서 TicketSeller는 Audience가 구매하는 과정에 대해서는 알 수 없게 되며, Audience는 자율성을 확보할 수 있어진다.
+ Audience는 가방을 통해서 구입을 하던, 신용카드로 구매하던 상관이 없어진다.
+
+
+=> 이런 결과를 통해서 얻은 것은 무엇인가?
+TicketSeller가 티켓을 판매하는 방법이 어떻던 관계없이 Theater 클래스를 변경할 필요가 없어졌다.
+Audience가 입장권을 구매하는 방법이 티켓이건, 현금이건, 신용카드건, 추가적으로 변경이 일어나더라도 TicketSeller,Theater가 변경될 필요가 없어졌다.
+
+내부의 구현를 감추게되면서 결합도가 낮아졌고, 코드를 변경하는데 연계적으로 수정되는 코드들을 줄일 수 있었다.
+
+
+=====================================================================================
+핵심은 객체 내부의 상태를 캡슐화하고 객체 간에 오직 메시지를 통해서만 상호작용하도록 만드는 것이다.
+밀접하게 연관된 작업만을 수행하고 연관성 없는 작업은 다른 객체에게 위임하는 객체를 가리켜 "응집도"가 높다고 말한다.
+객체의 "응집도"를 높이기 위해서는 객체 스스로 자신의 데이터를 책임져야 한다.
+
+데이터와 데이터를 사용하는 프로세스가 동일한 객체 안에 위치한다면 객체지향 프로그래밍 밧기을 따르고 있을 확률이 높다.
+객체지향은 단순히 데이터와 프로세스를 하나의 객체안을 모으는 것 이상의 무언가가 존재한다.
+핵심은 적절한 객체에 적절한 책임을 할당하는 것이다.
+객체는 다른 객체와의 협력이라는 문맥 안에서 특정한 역할을 수행하는 데 필요한 적절한 책임을 수행해야 한다.
+
diff --git a/Jun/chapter01/src/theater/step03/Audience.java b/Jun/chapter01/src/theater/step03/Audience.java
new file mode 100644
index 0000000..9e7cf57
--- /dev/null
+++ b/Jun/chapter01/src/theater/step03/Audience.java
@@ -0,0 +1,21 @@
+package theater.step03;
+
+import theater.step03.Bag;
+import theater.step03.Ticket;
+
+/**
+ * Audience : 관람객
+ * 관람객은 소지품을 보관하기 위해 가방을 소지할 수 있다.
+ */
+public class Audience {
+
+ private Bag bag;
+
+ public Audience(Bag bag) {
+ this.bag = bag;
+ }
+
+ public Long buy(Ticket ticket){
+ return bag.hold(ticket);
+ }
+}
\ No newline at end of file
diff --git a/Jun/chapter01/src/theater/step03/Bag.java b/Jun/chapter01/src/theater/step03/Bag.java
new file mode 100644
index 0000000..6a3f38a
--- /dev/null
+++ b/Jun/chapter01/src/theater/step03/Bag.java
@@ -0,0 +1,51 @@
+package theater.step03;
+
+import theater.step03.Invitation;
+import theater.step03.Ticket;
+
+/**
+ * 관람객이 가지고 올 수 있는 소지품은 3가지 뿐이다.
+ * 1. 초대장
+ * 2. 현금
+ * 3. 티켓
+ */
+public class Bag {
+
+ private Long amount;
+ private Invitation invitation;
+ private Ticket ticket;
+
+ private boolean hasInvitation(){
+ return invitation != null;
+ }
+
+ private void setTicket(Ticket ticket){
+ this.ticket = ticket;
+ }
+
+ private void minusAmount(Long amount){
+ this.amount -= amount;
+ }
+
+
+ public Bag(long amount){
+ this.amount = amount;
+ }
+
+ public Bag(Invitation invitation, long amount){
+ this.invitation = invitation;
+ this.amount = amount;
+ }
+
+ public Long hold(Ticket ticket){
+ if(hasInvitation()){
+ setTicket(ticket);
+ return 0L;
+ }else{
+ setTicket(ticket);
+ minusAmount(ticket.getFee());
+ return ticket.getFee();
+ }
+ }
+
+}
diff --git a/Jun/chapter01/src/theater/step03/Invitation.java b/Jun/chapter01/src/theater/step03/Invitation.java
new file mode 100644
index 0000000..97dcc0a
--- /dev/null
+++ b/Jun/chapter01/src/theater/step03/Invitation.java
@@ -0,0 +1,12 @@
+package theater.step03;
+
+import java.time.LocalDateTime;
+
+/**
+ * 이벤트 당첨자에게 발송되는 초대장을 구현하는 것으로 시작
+ */
+public class Invitation {
+
+ // 공연을 관람할 수 있는 초대일자
+ private LocalDateTime when;
+}
diff --git a/Jun/chapter01/src/theater/step03/Theater.java b/Jun/chapter01/src/theater/step03/Theater.java
new file mode 100644
index 0000000..7859315
--- /dev/null
+++ b/Jun/chapter01/src/theater/step03/Theater.java
@@ -0,0 +1,22 @@
+package theater.step03;
+
+import theater.step03.Audience;
+import theater.step03.Ticket;
+import theater.step03.TicketSeller;
+
+/**
+ * Theater : 소극장
+ * 관람객을 맞이할 수 있어야 한다.
+ */
+public class Theater {
+
+ private TicketSeller ticketSeller;
+
+ public Theater(TicketSeller ticketSeller) {
+ this.ticketSeller = ticketSeller;
+ }
+
+ public void enter(Audience audience){
+ ticketSeller.sellTo(audience);
+ }
+}
\ No newline at end of file
diff --git a/Jun/chapter01/src/theater/step03/Ticket.java b/Jun/chapter01/src/theater/step03/Ticket.java
new file mode 100644
index 0000000..330dbee
--- /dev/null
+++ b/Jun/chapter01/src/theater/step03/Ticket.java
@@ -0,0 +1,14 @@
+package theater.step03;
+
+/**
+ * 공연을 관람하길 원하는 모든 사람들은 티켓을 소지하고 있어야만 한다.
+ */
+public class Ticket {
+
+ private Long fee;
+
+ public Long getFee(){
+ return fee;
+ }
+
+}
diff --git a/Jun/chapter01/src/theater/step03/TicketOffice.java b/Jun/chapter01/src/theater/step03/TicketOffice.java
new file mode 100644
index 0000000..c10a186
--- /dev/null
+++ b/Jun/chapter01/src/theater/step03/TicketOffice.java
@@ -0,0 +1,39 @@
+package theater.step03;
+
+import theater.step03.Ticket;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * TicketOffice : 매표소
+ * 매표소에서는 초대장을 티켓으로 교환하거나 구매해야 한다.
+ * 매표소에서는 판매할 티켓과 티켓의 판매 금액이 보관돼 있어야 한다.
+ */
+public class TicketOffice {
+
+ private List tickets = new ArrayList<>();
+ private Long amount;
+
+ public TicketOffice(Long amount, Ticket... tickets) {
+ this.tickets.addAll(Arrays.asList(tickets));
+ this.amount = amount;
+ }
+
+ public Ticket getTicket(){
+ return tickets.remove(0);
+ }
+
+ public void minusAmount(Long amount){
+ this.amount -= amount;
+ }
+
+ public void plusAmount(Long amount){
+ this.amount += amount;
+ }
+
+ public void sellTicketTo(Audience audience){
+ plusAmount(audience.buy(getTicket()));
+ }
+}
diff --git a/Jun/chapter01/src/theater/step03/TicketSeller.java b/Jun/chapter01/src/theater/step03/TicketSeller.java
new file mode 100644
index 0000000..d904fca
--- /dev/null
+++ b/Jun/chapter01/src/theater/step03/TicketSeller.java
@@ -0,0 +1,26 @@
+package theater.step03;
+
+import theater.step03.Audience;
+import theater.step03.TicketOffice;
+
+/**
+ * TicketSeller : 판매원
+ * 판매원은 매표소에서 초대장을 티켓으로 교환해 주거나 티켓을 판매하는 역할을 수행한다.
+ * 판매원은 구현한 TicketSeller 클래스는 자신이 일하는 매표소를 알고 있어야 한다.
+ * */
+public class TicketSeller {
+
+ private TicketOffice ticketOffice;
+
+ public TicketSeller(TicketOffice ticketOffice) {
+ this.ticketOffice = ticketOffice;
+ }
+
+ public TicketOffice getTicketOffice() {
+ return ticketOffice;
+ }
+
+ public void sellTo(Audience audience) {
+ ticketOffice.sellTicketTo(audience);
+ }
+}
diff --git a/Jun/chapter01/src/theater/step03/review/changeList b/Jun/chapter01/src/theater/step03/review/changeList
new file mode 100644
index 0000000..6962b19
--- /dev/null
+++ b/Jun/chapter01/src/theater/step03/review/changeList
@@ -0,0 +1,27 @@
+** step02 -> step03의 변경사항
+1. Audience가 의존하는 Bag도 자율적인 존재로 변경한다.
+ Audience가 가방을 뒤져서 초대장이 있는지 확인하는게 아니라, "초대장을 확인해" 라는 메시지를 보낸다.
+ "초대장을 확인해" 라는 메시지를 수신할 객체는 Bag라는 객체가 되고, hold 라는 메서드로 응답한다.
+
+ Bag 클래스의 hasInvitation, minusAmount, setTicket 메서드들의 가시성을 "private"으로 변경했다.
+
+2. TicketOffice도 자율적인 존재로 변경했다.
+ TicketOffice도 현재 TickSeller에 자율권을 침해당하고있었다.
+ TicketSeller가 TickeOffice에 Ticket을 마음대로 꺼내서 자기 멋대로 Audience에게 팔고, 돈을 TicketOffice에 넣고 있었다.
+ TickeSeller는 "티켓을 판매해" 라는 메시지를 송신하는 것으로 변경한다.
+ "티켓을 판매해" 라는 메시지를 송신할 객체를 찾아보면 TicketOffice가 되고,
+ TicketOffice는 sellTicketTo라는 메서드를 통해서 "티켓을 판매해" 라는 메시지에 응답하게 된다.
+
+
+=>
+TicketSeller가 TicketOffice의 구현이 아닌 인터페이스에 의존하게 되었다는 점이 있지만, ticketOffice가 Audience와의 의존관계가 추가되었다.
+TicketOffice의 자율성은 높였지만, 전체 설계에서 관점에서의 결합도는 상승했다.
+자율성을 높일 것인가 결합도를 낮출 것인가.. => 트레이드 오프 시점이고, 설계는 트레이드 오프가 반복된 결과이다.
+이 책에서는 전체적인 결합도와 객체의 자율성 중 결합도를 선택했다고 한다.
+
+이 예제를 통해서 여러분은 두가지 사실을 알게 됐다.
+ 1. 어떤 기능을 설계하는 방법은 한 가지 이상일 수 있다.
+ 2. 동일한 기능을 한 가지 이상의 방법으로 설계할 수 있기 때문에 결국 설계는 트레이드 오프의 산물이다.
+
+
+좋은 설계란 오늘 요구하는 기능을 온전히 수행하면서 내일의 변경을 매끄럽게 수용할 수 있는 설계다.
\ No newline at end of file
diff --git a/Jun/chapter01/target/classes/META-INF/MANIFEST.MF b/Jun/chapter01/target/classes/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..b55046a
--- /dev/null
+++ b/Jun/chapter01/target/classes/META-INF/MANIFEST.MF
@@ -0,0 +1,4 @@
+Manifest-Version: 1.0
+Build-Jdk-Spec: 17
+Created-By: Maven Integration for Eclipse
+
diff --git a/Jun/chapter01/target/classes/META-INF/maven/chapter01/chapter01/pom.properties b/Jun/chapter01/target/classes/META-INF/maven/chapter01/chapter01/pom.properties
new file mode 100644
index 0000000..621ea28
--- /dev/null
+++ b/Jun/chapter01/target/classes/META-INF/maven/chapter01/chapter01/pom.properties
@@ -0,0 +1,7 @@
+#Generated by Maven Integration for Eclipse
+#Wed May 01 13:56:35 KST 2024
+m2e.projectLocation=/Users/yangjun-yeong/Desktop/School/2024/BookStudy/Object/chapter01
+m2e.projectName=chapter01
+groupId=chapter01
+artifactId=chapter01
+version=0.0.1-SNAPSHOT
diff --git a/Jun/chapter01/target/classes/META-INF/maven/chapter01/chapter01/pom.xml b/Jun/chapter01/target/classes/META-INF/maven/chapter01/chapter01/pom.xml
new file mode 100644
index 0000000..0449f42
--- /dev/null
+++ b/Jun/chapter01/target/classes/META-INF/maven/chapter01/chapter01/pom.xml
@@ -0,0 +1,18 @@
+
+ 4.0.0
+ chapter01
+ chapter01
+ 0.0.1-SNAPSHOT
+
+ src
+
+
+ maven-compiler-plugin
+ 3.8.1
+
+ 17
+
+
+
+
+
\ No newline at end of file
diff --git a/Jun/chapter01/target/classes/module-info.class b/Jun/chapter01/target/classes/module-info.class
new file mode 100644
index 0000000..bfbf208
Binary files /dev/null and b/Jun/chapter01/target/classes/module-info.class differ
diff --git a/Jun/myTheater/.classpath b/Jun/myTheater/.classpath
new file mode 100644
index 0000000..e69de29
diff --git a/Jun/myTheater/.project b/Jun/myTheater/.project
new file mode 100644
index 0000000..e69de29
diff --git a/Jun/myTheater/.settings/org.eclipse.jdt.apt.core.prefs b/Jun/myTheater/.settings/org.eclipse.jdt.apt.core.prefs
new file mode 100644
index 0000000..e69de29
diff --git a/Jun/myTheater/.settings/org.eclipse.jdt.core.prefs b/Jun/myTheater/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..e69de29
diff --git a/Jun/myTheater/.settings/org.eclipse.m2e.core.prefs b/Jun/myTheater/.settings/org.eclipse.m2e.core.prefs
new file mode 100644
index 0000000..e69de29
diff --git a/Jun/myTheater/chapter01.iml b/Jun/myTheater/chapter01.iml
new file mode 100644
index 0000000..e69de29
diff --git a/Jun/myTheater/myTheater.iml b/Jun/myTheater/myTheater.iml
new file mode 100644
index 0000000..9fa6534
--- /dev/null
+++ b/Jun/myTheater/myTheater.iml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Jun/myTheater/pom.xml b/Jun/myTheater/pom.xml
new file mode 100644
index 0000000..b75c501
--- /dev/null
+++ b/Jun/myTheater/pom.xml
@@ -0,0 +1,18 @@
+
+ 4.0.0
+ myTheater
+ myTheater
+ 0.0.1-SNAPSHOT
+
+ src
+
+
+ maven-compiler-plugin
+ 3.8.1
+
+ 17
+
+
+
+
+
\ No newline at end of file
diff --git a/Jun/myTheater/src/theater/Application.java b/Jun/myTheater/src/theater/Application.java
new file mode 100644
index 0000000..7175e88
--- /dev/null
+++ b/Jun/myTheater/src/theater/Application.java
@@ -0,0 +1,14 @@
+package theater;
+
+import theater.controller.TheaterController;
+import theater.view.InputView;
+import theater.view.OutputView;
+
+public class Application {
+ public static void main(String[] args){
+ InputView inputView = new InputView();
+ OutputView outputView = new OutputView();
+ TheaterController theaterController = new TheaterController(inputView, outputView);
+
+ }
+}
diff --git a/Jun/myTheater/src/theater/controller/TheaterController.java b/Jun/myTheater/src/theater/controller/TheaterController.java
new file mode 100644
index 0000000..29afa4f
--- /dev/null
+++ b/Jun/myTheater/src/theater/controller/TheaterController.java
@@ -0,0 +1,16 @@
+package theater.controller;
+
+import theater.view.InputView;
+import theater.view.OutputView;
+
+public class TheaterController {
+
+ private InputView inputView;
+ private OutputView outputView;
+ public TheaterController(InputView inputView, OutputView outputView) {
+ this.inputView = inputView;
+ this.outputView = outputView;
+ }
+
+
+}
diff --git a/Jun/myTheater/src/theater/domain/Amount.java b/Jun/myTheater/src/theater/domain/Amount.java
new file mode 100644
index 0000000..c4a2e47
--- /dev/null
+++ b/Jun/myTheater/src/theater/domain/Amount.java
@@ -0,0 +1,22 @@
+package theater.domain;
+
+public class Amount {
+
+ private int amount;
+
+ public Amount(int amount) {
+ this.amount = amount;
+ }
+
+ public void addAmount(Amount amount){
+ this.amount += AmountToInteger(amount);
+ }
+
+
+ private int AmountToInteger(Amount amount){
+ return Integer.parseInt(String.valueOf(amount));
+ }
+
+
+
+}
diff --git a/Jun/myTheater/src/theater/domain/Audience.java b/Jun/myTheater/src/theater/domain/Audience.java
new file mode 100644
index 0000000..7fac469
--- /dev/null
+++ b/Jun/myTheater/src/theater/domain/Audience.java
@@ -0,0 +1,9 @@
+package theater.domain;
+
+public class Audience {
+
+ private Bag bag;
+ public Screening pay(Screening screening) {
+ return bag.check(screening);
+ }
+}
diff --git a/Jun/myTheater/src/theater/domain/Bag.java b/Jun/myTheater/src/theater/domain/Bag.java
new file mode 100644
index 0000000..e07af95
--- /dev/null
+++ b/Jun/myTheater/src/theater/domain/Bag.java
@@ -0,0 +1,25 @@
+package theater.domain;
+
+public class Bag {
+
+ private Amount amount;
+ private Ticket ticket;
+
+ public Bag(Amount amount, Ticket ticket) {
+ this.amount = amount;
+ this.ticket = ticket;
+ }
+
+ public Bag(Amount amount) {
+ this.amount = amount;
+ this.ticket = null;
+ }
+
+ public void check(screening screening) {
+ if(ticket.check(screening)){
+ return ticketSeller.changeTicket(screening);
+ }
+ return ticketSeller.sell(screening);
+
+ }
+}
diff --git a/Jun/myTheater/src/theater/domain/Screening.java b/Jun/myTheater/src/theater/domain/Screening.java
new file mode 100644
index 0000000..f1543ac
--- /dev/null
+++ b/Jun/myTheater/src/theater/domain/Screening.java
@@ -0,0 +1,26 @@
+package theater.domain;
+
+import java.time.LocalDateTime;
+
+public class Screening {
+
+ private Title title;
+ private int runningTime;
+
+ private int price;
+
+ private TicketSeller ticketSeller;
+
+ public Screening(String name, int runningTime) {
+ this.name = name;
+ this.runningTime = runningTime;
+ }
+
+ public Screening buy(String name){
+ ticketSeller.sell(name);
+ }
+
+ public String playTitle(){
+ return name;
+ }
+}
diff --git a/Jun/myTheater/src/theater/domain/Ticket.java b/Jun/myTheater/src/theater/domain/Ticket.java
new file mode 100644
index 0000000..b294419
--- /dev/null
+++ b/Jun/myTheater/src/theater/domain/Ticket.java
@@ -0,0 +1,17 @@
+package theater.domain;
+
+public class Ticket {
+
+ private Title title;
+
+ public Ticket(Title title) {
+ this.title = title;
+ }
+
+ public boolean check(Screening screening) {
+ if(title.isSame(screening)){
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/Jun/myTheater/src/theater/domain/TicketSeller.java b/Jun/myTheater/src/theater/domain/TicketSeller.java
new file mode 100644
index 0000000..7532b64
--- /dev/null
+++ b/Jun/myTheater/src/theater/domain/TicketSeller.java
@@ -0,0 +1,20 @@
+package theater.domain;
+
+public class TicketSeller{
+ private Audience audience;
+ private Amount amount;
+
+ public TicketSeller(Audience audience, Amount amount) {
+ this.audience = audience;
+ this.amount = amount;
+ }
+
+ public Screening sell(String name){
+ Amount payAmount = audience.pay(ticket);
+ amount.addAmount(payAmount);
+ }
+
+ public Screening changeTicket(Title title) {
+
+ }
+}
diff --git a/Jun/myTheater/src/theater/domain/Title.java b/Jun/myTheater/src/theater/domain/Title.java
new file mode 100644
index 0000000..8e5d9da
--- /dev/null
+++ b/Jun/myTheater/src/theater/domain/Title.java
@@ -0,0 +1,12 @@
+package theater.domain;
+
+public class Title {
+ private String title;
+
+ public boolean isSame(Title screeningTitle){
+ if(title.equals(screeningTitle.ge)){
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/Jun/myTheater/src/theater/view/InputView.java b/Jun/myTheater/src/theater/view/InputView.java
new file mode 100644
index 0000000..8a203e0
--- /dev/null
+++ b/Jun/myTheater/src/theater/view/InputView.java
@@ -0,0 +1,4 @@
+package theater.view;
+
+public class InputView {
+}
diff --git a/Jun/myTheater/src/theater/view/OutputView.java b/Jun/myTheater/src/theater/view/OutputView.java
new file mode 100644
index 0000000..e62c832
--- /dev/null
+++ b/Jun/myTheater/src/theater/view/OutputView.java
@@ -0,0 +1,4 @@
+package theater.view;
+
+public class OutputView {
+}
diff --git a/Jun/myTheater/target/classes/META-INF/MANIFEST.MF b/Jun/myTheater/target/classes/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..e69de29
diff --git a/Jun/myTheater/target/classes/META-INF/maven/chapter01/chapter01/pom.properties b/Jun/myTheater/target/classes/META-INF/maven/chapter01/chapter01/pom.properties
new file mode 100644
index 0000000..e69de29
diff --git a/Jun/myTheater/target/classes/META-INF/maven/chapter01/chapter01/pom.xml b/Jun/myTheater/target/classes/META-INF/maven/chapter01/chapter01/pom.xml
new file mode 100644
index 0000000..0449f42
--- /dev/null
+++ b/Jun/myTheater/target/classes/META-INF/maven/chapter01/chapter01/pom.xml
@@ -0,0 +1,18 @@
+
+ 4.0.0
+ chapter01
+ chapter01
+ 0.0.1-SNAPSHOT
+
+ src
+
+
+ maven-compiler-plugin
+ 3.8.1
+
+ 17
+
+
+
+
+
\ No newline at end of file