본문 바로가기
공부/Object-Oriented Design Pattern

퍼사드 패턴 vs 빌더 패턴 차이점

by 혼밥맨 2021. 6. 1.
반응형

퍼사드 패턴 vs 빌더 패턴 차이점

 

1)

A facade pattern is just a way of simplifying calls in an object model so you don't have to write a large amount of code each time you want to perform a set of actions. For example you might write a facade to simplify something which has to call several objects and methods in order to perform a task.

A builder pattern is just a sort of facade used to simplify the construction logic of a class or set of classes. Its purpose is quite often to provide a clear set of methods that make it clear how you are constructing the target object(s) and to give the construction a fluent feel.

 

 

1)

Facade Pattern는 객체 모델에서 호출을 단순화하는 방법일 뿐이므로 일련의 작업을 수행할 때마다 많은 양의 코드를 작성할 필요가 없습니다. 예를 들어 작업을 수행하기 위해 여러 개체와 메서드를 호출해야 하는 작업을 단순화하기 위해 Facade를 작성할 수 있습니다.

Builder Pattern는 클래스 또는 클래스 집합의 구성 로직을 단순화하는 데 사용되는 a set of classes입니다. 이 방법의 목적은 대상 개체를 구성하는 방법을 명확히 하고 구성을 유창한 느낌으로 만드는 방법을 제공하는 경우가 많습니다.

 

 

2)

Facade Pattern는 하위 시스템의 인터페이스 집합에 통합 인터페이스를 제공합니다. Facade하위 시스템을 더 쉽게 사용할 수 있도록 하는 상위 수준의 인터페이스를 정의합니다.

그리고 Builder Pattern는 복잡한 객체의 구조를 그것의 표현으로부터 분리하여 동일한 구성 과정이 다른 표현을 만들 수 있도록 해야 한다.

 

So it's quite obvious from descriptions that Facade pattern does not provide a way of constructing new objects. Facade is a simplified high-level interface that you can use to access a set of sub-interfaces. 

 

Builder describes a way of creating objects. For example the only purpose of StringBuilder class is to provide an effective way of creating new strings (yes, it is based on Builder pattern).

 

따라서 Facade Pattern은 새로운 객체를 구성하는 방법을 제공하지 않는다는 것은 매우 명백합니다. Facade Pattern는 하위 인터페이스 집합에 액세스하는 데 사용할 수 있는 단순화된 고급 인터페이스입니다.

 

Builder Pattern는 오브젝트를 새롭게 생성하는 방법을 설명합니다. 예를 들어 StringBuilder 클래스의 유일한 목적은 새 문자열을 만드는 효과적인 방법을 제공하는 것입니다(StringBuilder도 Builder Pattern을 기반으로 함).

반응형

댓글