4주차: 7장 캡슐화 #9
Replies: 8 comments 10 replies
-
7.6Q. 클래스 인라인은 반댓말은 무엇이고. 왜 하는 걸까요? |
Beta Was this translation helpful? Give feedback.
-
7.5Q. 메서드와 데이터가 많은 클래스를 왜 분리하는 게 좋을까요? 어떤 기준에서 분리할 수 있을까요? |
Beta Was this translation helpful? Give feedback.
-
7.7Q1. Hide Delegate 패턴을 사용하면 클래스 간 결합도를 줄일 수 있는데, 이 패턴을 사용해야 하는 상황과 그렇지 않은 상황의 기준은 무엇인가요? |
Beta Was this translation helpful? Give feedback.
-
7.1 레코드 캡슐화하기 Q. 중첩된 레코드를 캡슐화하는 방법을 설명해 주세요. 쓰기와 읽기의 방법을 각각 설명해 주세요. |
Beta Was this translation helpful? Give feedback.
-
4번 질문7.2Q1. 컬렉션을 캡슐화한 클래스에서 컬렉션을 반환할 때 적절한 getter 함수를 정의해보세요. Class TimeList {
constructor(times){
this._timeList = times;
}
get timeList(){
//do something...
}
} Q2. 왜 위와 같이 해야 할까요? |
Beta Was this translation helpful? Give feedback.
-
7.3Q. 기본형이 늘어난다면 어떠한 단점이 노출될까요? Q.기본형을 객체로 바꾼다면 무슨 장점이 있나요? |
Beta Was this translation helpful? Give feedback.
-
7.4Q1. 함수안에서 어떤 코드의 결과값을 뒤에서 다치 참조할 목적으로 임시 변수를 쓰기도 하는데요. 임시 변수를 사용하면 좋은 점이 무엇이 있나요? |
Beta Was this translation helpful? Give feedback.
-
8번 질문 (7.8-7.9)Q1. 아래 코드에서 중개자를 제거하도록 리팩터링한 코드를 작성해보세요. class Department {
manager;
constructor() {
this.manager = "관리자입니다";
}
get manager() {
return this.manager;
}
}
class Person {
department;
constructor() {
this.department = new Department();
}
get manager() {
return this.department.manager;
}
}
const person = new Person();
const manager = person.manager;
console.log(manager); Q2. 알고리즘을 교체하기 전 선행되어야 하는 작업은 무엇일까요? |
Beta Was this translation helpful? Give feedback.
-
참고자료
Beta Was this translation helpful? Give feedback.
All reactions