있으며 베이스 객체가 변경될 걱정 없이 사용할 수 있습니다. 더 넓은 의미에서 봤을 때 수많
은 서브클래스에 의존할 필요도 없습니다.
그러나 데코레이터 패턴을 구현할 때 주의해야 할 점이 있습니다. 네임 스페이스에 작고 비
슷한 객체를 추가하기 때문에, 잘 관리하지 않는다면 애플리케이션의 구조를 무척 복잡하게
만들 수도 있습니다. 또한 이 패턴에 익숙하지 않은 다른 개발자가 패턴의 사용 목적을 파악
하기 어렵게 되어 관리가 힘들어집니다.
후자는 충분한 문서화나 패턴에 대한 이해도를 높임으로써 해결할 수 있습니다. 애플리케이
션의 어디서부터 어디까지 데코레이터를 사용하는지 잘 관리하면 전자와 후자 모두 문제없
을 것입니다.
7.16
플라이웨이트 패턴
플라이웨이트
Flyweight
패턴은 반복되고 느리고 비효율적으로 데이터를 공유하는 코드를 최적
화하는 전통적인 구조적 해결 방법입니다. 연관된 객체끼리 데이터를 공유하게 하면서 애플
리케이션의 메모리를 최소화하는 목적을 가지고 있습니다. [그림
7
-
8
]에서 애플리케이션 구
성과 상태 등을 볼 수 있습니다.
그림
7-8
플라이웨이트 패턴
플라이웨이트 풀
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.
O’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
I wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
I’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
I'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.