> For the complete documentation index, see [llms.txt](https://hochan049.gitbook.io/cs-interview/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hochan049.gitbook.io/cs-interview/design-pattern/undefined.md).

# 질문 목록

#### 1. OOP(Object Oriented Programming)를 왜 사용하나?

추상화시켜서 전체 프로그램의 복잡도를 낮추기 위해 사용한다. 조금 더 코드의 이해도와 가독성을 높일 수 있다.

#### 2. Functional Programming이란?

* 변경 가능한 상태를 불변상태(Immutab)로 만들어 SideEffect를 없애자.
* 모든 것은 객체이다.
* 코드를 간결하게 하고 가독성을 높여 구현할 로직에 집중 시키자.
* 동시성 작업을 보다 쉽게 안전하 구현하자.

{% embed url="<https://medium.com/@lazysoul/%ED%95%A8%EC%88%98%ED%98%95-%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%98%EB%B0%8D%EC%9D%B4%EB%9E%80-d881230f2a5e>" %}

#### 3. boxing, unboxing 무엇인지, 자동으로 언제 일어나는지?

Boxing은 원시 데이터 타입을 Boxing하여, 참조형으로 만들어 주는 것이며 Unboxing은 반대로 참조형 변수를 원시 데이터 타입으로 만들어주는 것을 의미한다.

다음 2 line에 boxing이 일어난다.

```
let string1 = 'Hello World';
let string2 = new String('Hello World');

console.log(typeof string1);    //result: string
console.log(typeof string2);    //result: object
```

primitive value에서 메소드를 사용할때도 boxing이 일어난다.

```
console.log("testing".toUpperCase());
```

#### 4. "Iterator", "Observer", "Factory", "Singleton"...

{% embed url="<https://refactoring.guru/design-patterns>" %}

**Creational patterns**

* Factory Method
* Abstract Factory
* Builder
* Prototype
* Singleton
