본문 바로가기

Design Pattern3

[Design Pattern] Coordinator Pattern 기존에 화면전환 로직을 분리하기 위해서 Coordinator Pattern을 사용한 적이 있는데, 자세히 알아보지 않고 사용해본 것 같아서 정리해보려한다. Coordinator? Coordinator Pattern을 만든 khanlou의 글에 따르면.. What is a coordinator? So what is a coordinator? A coordinator is an object that bosses one or more view controllers around. Taking all of the driving logic out of your view controllers, and moving that stuff one layer up is gonna make your life a lot more.. 2022. 7. 29.
[Design Pattern] Singleton Pattern Design Pattern은 역사적으로 프로그래밍을 할 때 자주 발생하는 문제점들을 해결하기 위해 생겨난 구조, 패턴이다. 우린 이 공통된 오답노트같은 패턴들을 사용하고, 참조하며 개발을 한다. 공통화 덕에 생긴 이점은 동일한 문제에 대해서는 특정 표준 설계법을 사용하여 다른 개발자와 의사소통을 원활하게 하고, 코드가 방대해질 경우 흐름을 파악하는데도 큰 도움이 된다. 오늘 알아볼 패턴은 Singleton Pattern 이다. 위키백과는 Singleton을 다음과 같이 정의했다. In software engineering, the singleton pattern is a software design pattern that restricts the instantiation of a class to one .. 2022. 3. 31.
[Design Pattern] Mediator Pattern Mediator Pattern 객체간의 종속성을 줄일 수 있는 패턴으로, 여러 Colleague들 사이를 Mediate하는 역할을 하는 인터페이스가 존재한다. 클래스간의 종속을 줄이기위해 클래스 사이에 Mediator가 존재하고, 여러 클래스들은 서로 직접 참조, 통신하는 것이 아닌 Mediator를 통해서 메세지를 주고 받는다. Use When? 객체들간의 상호작용 관계가 복잡할 때 다이어그램을 통해 알아보자 Mediator Pattern을 통해 객체간 종속성을 줄이기 전의 다이어그램이다. 서로 강하게 참조를 하고있으며, M:N 관계로 상호간 매우 얽혀있는 모습을 볼 수 있다. 이때 클래스 간의 복잡한 관계들을 캡슐화하여 하나의 클래스에서 관리하도록 한다. M:N의 관계를 Mediator Pattern.. 2022. 3. 20.