1.1. Introduction ¶
p1
Welcome to The Design Patterns Smalltalk Companion , a companion volume to Design Patterns Elements of Reusable Object-Oriented Software by Erich Gamma, Richard Helm, Ralph Johnson, and Jogn Vlissides(Gamma, 1995). While the earlier book was not the first publication on design patterns, it has fostered a minor revolution in the software engineering world.Designers are now speaking in the language of design patterns, and we have seen a proliferation of workshops, publications, and World Wide Web sites concerning design patterns. Design patterns are now a dominant theme in object-oriented programming research and development, and a new design patterns community has emerged.
The Design Patterns Smalltalk Companion ์ ์ธ๊ณ์ ์ค์ ๊ฑธ ํ์ํฉ๋๋ค. ์ด ์ฑ
์ Design Patterns Elements of Reusable Object-Oriented Software(์ดํ DP) Erich Gamma, Richard Helm, Ralph Johnson, and Jogn Vlissides(Gamma, 1995). ์ ํธ๋(companion, ๋ณด๊ธฐ์ ํธ๋ฆฌํ๋๋ก ๊ฐ๋ช
ํ๊ฒ ๋ง๋ ์ฑ
) ์
๋๋ค. ์์ ์ถ๊ฐ๋ ์ฑ
(DP)์ด ๋์์ธ ํจํด์ ๊ด๋ จํ ์ฑ
์ ์ต์ด์ ์ฑ
์ ์๋์ง๋ง, DP๋ ์ํํธ์จ์ด ์์ง๋์ด๋ง์ ์ธ๊ณ์ ์์ ํ๋ช
์ ์ผ์ผ์ผฐ์ต๋๋ค. ์ด์ ๋์์ด๋๋ค์ ๋์์ธ ํจํด์ ์ธ์ด๋ก ์ด์ผ๊ธฐ ํ๋ฉฐ, ์ฐ๋ฆฌ๋ ๋์์ธ ํจํด๊ณผ ๊ด๋ จํ ์๋ง์ workshop, ์ถํ๋ฌผ, ๊ทธ๋ฆฌ๊ณ ์น์ฌ์ดํธ๋ค์ด ํญํ์ ์ผ๋ก ๋์ด๋๋๊ฑธ ๋ณด์์์ต๋๋ค. ๋์์ธ ํจํด์ ๊ฐ์ฒด์งํฅ ํ๋ก๊ทธ๋๋ฐ์ ์ฐ๊ตฌ์ ๊ฐ๋ฐ์ ์์ด์ ์ค์ํ ์์น๋ฅผ ๊ฐ์ง๋ฉฐ, ๊ทธ์ ๋ฐ๋ผ ์๋ก์ด ๋์์ธ ํจํด ์ปค๋ฎค๋ํฐ๋ค์ด ๋ฑ์ฅํ๊ณ ์์ต๋๋ค.(emerge ๋ฅผ come up or out into view ๋๋ come to light ์ ๋๋ก ํด์ํ๋๊ฒ ๋ง์ง ์์๊น. ์ด์ ๋์์ธ ํจํด์ ๊ฐ์ฒด์งํฅ ํ๋ก๊ทธ๋๋ฐ์ ์ฐ๊ตฌ์ ๊ฐ๋ฐ์ ์์ด์ ์ค์ํ ์์น๋ฅผ ๊ฐ์ง๊ณ ์์ผ๋ฉฐ, ๋์์ธ ํจํด ์ปค๋ฎค๋ํฐ๋ค์ด ์๋ก์ด ๋ฑ์ฅํ๊ณ ์๋ ์ถ์ธ์
๋๋ค. ๊ทธ๋๋ ์ข ์ด์ํ๊ตฐ. -_-; -- ์์ฒ ๋ฐ๊ฟ๋ดค๋๋ฐ ์ด๋? -์๋ฏผ -- DeleteMe)gogo..~ ๋์ค์ ์ ๋ฆฌ์ ํ์ฌ ๋ถ์ฐ ๋ถ์ ๊ธ ์ญ์ ํ๋์ง, ๋ฐ๋ก ๋ฐ์ ๋นผ๋๋๋ก ํฉ์๋ค.
Design Patterns describes 23 design patterns for applications implemented in an object-oriented programming language. Of course, these 23 patterns do not capture all the design knowledge an object-oriented designer will ever need. Nonetheless, the patterns from the "Gang of Four"(Gamma et al.) are a well-founded starting point. They are a design-level analog to the base class libraries found in Smalltalk development environments. They do not solve all problems but provide a foundation for learning environments. They do not solve all problems but provide a foundation for learning about design patterns in general and finding specific useful architectures that can be incorporated into the solutions for a wide variety of real-world design problems. They capture an expert level of design knowledge and provide the foundation required for building elegant, maintainable, extensible object-oriented programs.
๋์์ธ ํจํด์ ๊ฐ์ฒด์งํฅ ์ธ์ด๋ก ์ ์๋ ํ๋ก๊ทธ๋จ์ 23๊ฐ์ ํจํด์ ์ ์ํฉ๋๋ค. ๋ฌผ๋ก , 23๊ฐ์ ํจํด์ด ๊ฐ์ฒด์งํฅ ๋์์ด๋๋ค์ด ํ์๋ก ํ ๋ชจ๋ ๋์์ธ์ ๋์ ๋ค์ ์ ๋ถ ์ก์๋ด์ง๋ ๋ชปํฉ๋๋ค. ๊ทธ๋ผ์๋ ๋ถ๊ตฌํ๊ณ "Gang of Four"(Gamma et al.)์์ ์ ์ํ 23๊ฐ์ ํจํด์ ์ข์ ๋์์ธ์ ๋ ๋ ํ ์ถ๋ฐ์ ๋ณด์ฅํฉ๋๋ค. ์ด 23๊ฐ์ ํจํด์ Smalltalk class libraries์ ๊ธฐ๋ฐ์ํ ๋์์ธ ์์ค(design-level) ๋ถ์(analog)์
๋๋ค. ์ด ํจํด์ ์ด์ฉํด์ ๋ชจ๋ ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ ์๋ ์์ง๋ง, ์ ๋ฐ์ ์ด๊ณ , ์ค์ ๋์์ธ์ ๋ค์ํ ๋ฌธ์ ๋ค์ ์ํ ํด๊ฒฐ์ฑ
์ ์ํ ์ ์ฉํ ์ง์๋ค์ ๊ธฐ๋ฐ์ ์ ๊ณตํ ๊ฒ์
๋๋ค. ๋, ์ด ํจํด์ ํตํด์ ์ ๋ฌธ๊ฐ ์์ค์ ๋์์ธ ์ง์์ ์ทจ๋ํ๊ณ , ์ฐ์ํ๊ณ , ์ฌํ ๊ด๋ฆฌ๊ฐ ํธํ๊ณ , ํ์ฅํ๊ธฐ ์ฌ์ด ๊ฐ์ฒด์งํฅ ํ๋ก๊ทธ๋จ ๊ฐ๋ฐ์ ๊ธฐ์ด ์ง์์ ์ ๊ณตํ๋๋ฐ ํกํกํ ์ญํ ์ ํ ๊ฒ์
๋๋ค.
In the Smalltalk Companion, we do not add to this "base library" of patterns;rather, we present them for the Smalltalk designer and programmer, at times interpreting and expanding on the patterns where this special perspective demands it. Our goal is not to replace Design Patterns; you should read the Smalltalk Companion with Design Patterns, not instead of it. We have tried not to repeat information that is already well documented by the Gang of Four book. Instead, we refer to it requently;you should too.
Smalltalk Companion์์, ์ฐ๋ฆฌ๋ ํจํด์ "base library"๋ฅผ ์ถ๊ฐํ๋ ๊ฒ๋ณด๋ค ์์ผ๋ก ์๊ตฌ๋ ์ ์๋ ํจํด์ผ๋ก ๋๋๋ก ํ์ฅํ๊ณ ํด์ํด์, ์ค๊ณ์๋ ํ๋ก๊ทธ๋๋จธ๋ฅผ ์ํด ์ ๊ณตํ๋ค.
์ฐ๋ฆฌ์ ๋ชฉ์ ์ Design Pattern์ ๊ต์ฒดํ๋ ค๋ ๊ฒ์ด ์๋๋ค. ๋น์ ์ Design Pattern์ ๋์ ํ๋ ๊ฒ์ด ์๋๋ผ Design Pattern๊ณผ ํจ๊ป Smalltalk Companion์ ์ฝ์ด์ผ ํ๋ค.
์ฐ๋ฆฌ๋ Gang of Four ์ฑ ์์ ์ด๋ฏธ ์ ๋ฌธ์ํ๋ ์ ๋ณด๋ ๋ฐ๋ณตํด์ ๊ณต๋ถํ์ง ์๋๋ค. ๋์ , ์ฐ๋ฆฌ๋ ์์ฃผ ๊ทธ๊ฒ์ ์ฐธ์กฐํด์ผํ๋ค. ์ฌ๋ฌ๋ถ ๋ํ ๊ทธ๋ ๊ฒ ํด์ผํ๋ค.
์ฐ๋ฆฌ์ ๋ชฉ์ ์ Design Pattern์ ๊ต์ฒดํ๋ ค๋ ๊ฒ์ด ์๋๋ค. ๋น์ ์ Design Pattern์ ๋์ ํ๋ ๊ฒ์ด ์๋๋ผ Design Pattern๊ณผ ํจ๊ป Smalltalk Companion์ ์ฝ์ด์ผ ํ๋ค.
์ฐ๋ฆฌ๋ Gang of Four ์ฑ ์์ ์ด๋ฏธ ์ ๋ฌธ์ํ๋ ์ ๋ณด๋ ๋ฐ๋ณตํด์ ๊ณต๋ถํ์ง ์๋๋ค. ๋์ , ์ฐ๋ฆฌ๋ ์์ฃผ ๊ทธ๊ฒ์ ์ฐธ์กฐํด์ผํ๋ค. ์ฌ๋ฌ๋ถ ๋ํ ๊ทธ๋ ๊ฒ ํด์ผํ๋ค.
Another)
Smalltalk Companion์์, ์ฐ๋ฆฌ๋ ํจํด์ 'base library'๋ฅผ ์ถ๊ฐํ์ง ์์ต๋๋ค. ๊ทธ๊ฒ๋ณด๋ค, ์ฐ๋ฆฌ๋ base library๋ค์ Smalltalk ์ ๊ด์ ์์ ํด์ํ๊ณ ๋?็? ํ์ฅํ์ฌ Smalltalk ๋์์ด๋์ ํ๋ก๊ทธ๋๋จธ๋ฅผ ์ํด ์ ๊ณตํ ๊ฒ์ ๋๋ค. ์ฐ๋ฆฌ์ ๋ชฉํ๋ Design Patterns์ ๋์ฒดํ๋ ค๋ ๊ฒ์ด ์๋๋๋ค. Design Patterns ๋์ Smalltalk Companion์ ์ฝ์ผ๋ ค ํ์ง ๋ง์๊ณ , ๋ ์ฑ ์ ๊ฐ์ด ์ฝ์ผ์ญ์์ค. ์ฐ๋ฆฌ๋ ์ด๋ฏธ Gang of Four์์ ์ ๋ฌธ์ํ๋ ์ ๋ณด๋ฅผ ๋ฐ๋ณตํ์ง ์์๊ฒ๋๋ค. ๋์ , ์ฐ๋ฆฌ๋ GoF๋ฅผ ์์ฃผ ์ฐธ์กฐํ ๊ฒ์ด๊ณ , ๋ ์๋ค ์ญ์ ๊ทธ๋์ผ ํ ๊ฒ์ ๋๋ค. -- ๋ฌธ์ฒด๋ฅผ ์์๊ฑฐ๋ ๋ง์ถฐ๋ดค์.. ์์ฒ
Smalltalk Companion์์, ์ฐ๋ฆฌ๋ ํจํด์ 'base library'๋ฅผ ์ถ๊ฐํ์ง ์์ต๋๋ค. ๊ทธ๊ฒ๋ณด๋ค, ์ฐ๋ฆฌ๋ base library๋ค์ Smalltalk ์ ๊ด์ ์์ ํด์ํ๊ณ ๋?็? ํ์ฅํ์ฌ Smalltalk ๋์์ด๋์ ํ๋ก๊ทธ๋๋จธ๋ฅผ ์ํด ์ ๊ณตํ ๊ฒ์ ๋๋ค. ์ฐ๋ฆฌ์ ๋ชฉํ๋ Design Patterns์ ๋์ฒดํ๋ ค๋ ๊ฒ์ด ์๋๋๋ค. Design Patterns ๋์ Smalltalk Companion์ ์ฝ์ผ๋ ค ํ์ง ๋ง์๊ณ , ๋ ์ฑ ์ ๊ฐ์ด ์ฝ์ผ์ญ์์ค. ์ฐ๋ฆฌ๋ ์ด๋ฏธ Gang of Four์์ ์ ๋ฌธ์ํ๋ ์ ๋ณด๋ฅผ ๋ฐ๋ณตํ์ง ์์๊ฒ๋๋ค. ๋์ , ์ฐ๋ฆฌ๋ GoF๋ฅผ ์์ฃผ ์ฐธ์กฐํ ๊ฒ์ด๊ณ , ๋ ์๋ค ์ญ์ ๊ทธ๋์ผ ํ ๊ฒ์ ๋๋ค. -- ๋ฌธ์ฒด๋ฅผ ์์๊ฑฐ๋ ๋ง์ถฐ๋ดค์.. ์์ฒ
1.2. 1.1 Why Design Patterns? ¶
Learning an object-oriented language after programming in another paradigm, such as the traditional procedural style, is difficult. Learning to program and compose application in Smalltalk requires a complex set of new skills and new ways of thinking about problems(e.g Rosson & Carroll, 1990; Singley, & Alpert, 1991). Climbing the "Smalltalk Mountain" learning curve is cetainly nontrivial. Once you have reached that plateau where you feel comfortable building simple Smalltalk applications, there is still a significant distance to the expert peak.
๋ค๋ฅธ ์ด๋ก ์ ์ธ ํ
๋๋ฆฌ์์์ ํ๋ก๊ทธ๋จ(์ ํต์ ์ธ ์ ์ฐจ์ ์คํ์ผ)์ ํ ํ ๊ฐ์ฒด ์งํฅ ์ธ์ด๋ฅผ ๋ฐฐ์ฐ๋ ๊ฒ์ ์ด๋ ต๋ค. Smalltalk ์์์ ๋ณตํฉ๋ ์์ฉ ํ๋ก๊ทธ๋จ ํ๋ ๊ฒ์ ๋ฐฐ์ฐ๋ ๊ฒ์ ๋ณต์กํ ์๋ก์ด ๊ธฐ์ ๊ณผ ๋ฌธ์ ์ ๋ํ ์๋ก์ด ์ฌ๊ณ ๋ฐฉ์์ ์๊ตฌํ๋ค.(" e.g Rosson & Carroll, 1990; Singley, & Alpert, 1991") "Smalltalk" ๋ผ๋ ์ฐ์ ์ค๋ฅด๋ ๊ฒ์ ํ์คํ ์ฌ์ํ ๊ฒ์ด ์๋๋ค. ์ผ๋จ ๋น์ ์ด ๊ฐ๋จํ Smalltalk ์์ฉ ํ๋ก๊ทธ๋จ์ ๋ง๋๋ ๋ฐ ์์ ์ด ์๋ ๊ฒฝ์ง์ ๋ฟ์๋ค๊ณ ํด๋, ์์ง ์ ๋ฌธ๊ฐ์ ๊ฒฝ์ง์๋ ๋ถ๋ช
ํ ์ฐจ์ด๊ฐ ์๋ค.
Smalltalk experts know many things that novices do not, at various abstraction levels and across a wide spectrum of programming and design knowledge and skills:
- The low-level details of the syntax and semantics of the Smalltalk language
- What is available in the form of classes, methods, and functionality in the existing base class libraries
- How to use the specific tools of the Smalltalk interactive development environment to find and reuse existing functionality for new problems, as well as understanding programs from both static and runtime perspective
- How to define and implement behavior in new classes and where these classes ought to reside in the existing class hierarchy
- Which classes work well together as frameworks
- Recurring patterns of object configurations and interactions and the sorts of problems for which these cooperating objects provide (at least partial) solutions
- Smalltalk์ ๋ฌธ๋ฒ๊ณผ ์ธ์ด๊ธฐํธ์ ์ธ ์ ๊ธ๋จ๊ณ (์ปดํจํฐ์์์ low-level ๋จ๊ณ)์ ์ธ ํญ๋ชฉ์ ๋ํด
- ํ์กดํ๋ ๊ธฐ๋ฐ class ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ก๋ถํฐ ์ด์ฉ๊ฐ๋ฅํ class, methods. ๊ทธ๋ฆฌ๊ณ ๊ทธ ๋ชจ๋๋ค(ํ์ฌ๋ functionality๋ฅผ function ๊ตฐ๋ค ๋๋ ๋ชจ๋ ์ ๋๋ก ํด์์ค. ํํด ๋ฐ๋. --;)์ ๋ํด
- ์๋ก์ด ๋ฌธ์ ๋ฅผ ์ฐพ๊ณ ๋ฌธ์ ํด๊ฒฐ์ ์ํ ๊ธฐ์กด์ ๋ชจ๋์ ์ฌ์ฌ์ฉํ๊ธฐ ์ํด, ๋๋ ์ ์ ์ด๊ฑฐ๋ ๋์ ์ธ ๊ด์ ์์ชฝ ์ธก๋ฉด์์ ํ๋ก๊ทธ๋จ์ ์ดํดํ๊ธฐ ์ํด ์ด๋ป๊ฒ Smalltalk IDE ํด์ ์ฌ์ฉํด์ผ ํ๋๊ฐ์ ๋ํด
- ์ด๋ค ํด๋์ค๋ค์ด frameworks๋ก์ ์๋ก ์ ์๋ํ๋์ง์ ๋ํด
- ๊ฐ์ฒด์ ํ๊ฒฝ์ค์ ๊ณผ ์ํธ์์ฉ, ์ด๋ฌํ ์๋ก ํ๋ ฅํ๋ ๊ฐ์ฒด๋ค์ด ํด๊ฒฐํด์ผํ ๋ฌธ์ ๋ค์ ์ ๋ ฌ ๋ฑ์์ ๋ฐ๋ณต๋๋ ํจํด์ ๋ํด
A design pattern is a reusable implementation model or architecture that can be applied to solve a particular recurring class of problem. The pattern sometimes describes how methods in a single class or subhierarchy of classes work together; more often, it shows how multiple classes and their instances collaborate. It turns out that particular architectures reappear in different applications and systems to the extent that a generic pattern template emerges, one that experts reapply and customize to new application - and domain-specific problems. Hence, experts know how to apply design patterns to new problems to implement elegant and extensible solutions.
๋์์ธ ํจํด์ ๋์ด์์ด ๋ฐ์ํ๋ ํด๋์ค ๊ตฌ์ฑ์์ ๋ฌธ์ ์ ํด๊ฒฐ์ฑ
์ ์ ์ํ๋ ์ฌ์ฌ์ฉํ ์ ์๋ ์คํ ๋ชจ๋ธ์ด๋ ์ํคํ
์ฒ์ด๋ค. ๋๋ก ํจํด์ ๋จ๋
์ ์ด๊ฑฐ๋ ํ์ ํด๋์ค ๊ตฌ์กฐ์์ ์ด๋ป๊ฒ ๋งค์๋ ๋ค์ด ํจ๊ป ์์ฉํ๋์ง๋ฅผ ๋ฌ์ฌํ๋ค.; ์๋ง๋, ํจํด์์์๋ ์ข๋ ๋น๋ฒํ ๋ค์ค ํด๋์ค๋ ๊ทธ๋ค์ ์ธ์คํด์ค์ ํ๋ ฅ์ ๋ณด์ฌ์ค๋ค.
ํจํด์ ๊ฐ๊ธฐ ๋ค๋ฅธ ์ดํ๋ฆฌ์ผ์ด์
๊ณผ ์์คํ
์์์ ์ฌํ๋๋ ํน๋ณํ(๊ณ ์ ํ, ํ๋ซํผ ์ข
์์ ์ธ) ์ํคํ์ฒ, ์ ๋ฌธ๊ฐ๋ค์ด ์๋ก์ด ์ดํ๋ฆฌ์ผ์ด์
,๋ถ์ผ์์ ๋ฐ์ํ๋ ํน๋ณํ ๋ฌธ์ ๋ค์ ์ ๊ฑฐํ๋ค. (์์์ ์ฐ์ธ one์ด particular architecture์ ๋๋ฑํ ์์น๋ก ํด์ํ ๋ฐฉ๋ฒ. ๋ค๋ฅธ์๊ฒฌ ์ ์๋ฐ๋-์๋ฏผ
๊ทธ๋ฌ๋ฏ๋ก, ์ ๋ฌธ๊ฐ๋ค์ ์ด๋ป๊ฒ ์๋ก์ด ๋ฌธ์ ์ ๋ํ์ฌ ๊ณ ์ํ๊ณ ํ์ฅ์ฑ์๋ ํด๊ฒฐ์ฑ
์ผ๋ก ์๋ดํ๋ ๋์์ธ ํจํด์ ํ์ฉ ๋ฐฉ๋ฒ์ ์๊ณ ์๋ค.
(๊ทธ๋ฌ๋ฏ๋ก, ์ ๋ฌธ๊ฐ๋ค์ ์๋ก์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๊ธฐ ์ํด ๋ช ์พํ๊ณ ํ์ฅ์ฑ์ด ๋ฐ์ด๋ ๋์์ธ ํจํด์ ์ ์ฉํ๋ ๋ฐฉ๋ฒ์ ์๊ณ ์๋ค.)
(๊ทธ๋ฌ๋ฏ๋ก, ์ ๋ฌธ๊ฐ๋ค์ ์๋ก์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๊ธฐ ์ํด ๋ช ์พํ๊ณ ํ์ฅ์ฑ์ด ๋ฐ์ด๋ ๋์์ธ ํจํด์ ์ ์ฉํ๋ ๋ฐฉ๋ฒ์ ์๊ณ ์๋ค.)
In general, designers -- in numerous domains, not just software -- apply their experience with past problems and solution to new, similar problems. As Duego and Benson(1996) point out, expert designers apply what is known in cognitive psychology and artificial intelligence as case-based reasoning, remembering past cases and applying what they learned there. This is the sort of reasoning that chess masters, doctors, lawyers, and architects empoly to solve new problems. Now, design patterns allow software designers to learn from and apply the experiences of other designers as well. As in other domains, a literature of proven patterns has emerged. As a result, we can "stand on the shoulders of giants" to get us closer to the expert peak. As John Vlissies (1997) asserts, design patterns "capture expertise and make it accessible to non-experts" (p. 32).
๋์์ด๋๋ค-์ํํธ์จ์ด์๋ง ๊ตญํํ์ง ์์ ์๋ง์ ๋ถ์ผ์์-์ ๊ทธ๋ค์ ๊ณผ๊ฑฐ์ ๋ฌธ์ ์, ํด๋ฒ์ ๊ฒฝํ์ ๋น์ทํ ๋ฌธ์ ์ ์ ์ฉ ์ํจ๋ค. Duego์ Genson(1996)์ ์ ๋ฌธ ๋์์ด๋๋ค์ด ์ฌ๋ก๋ฅผ ๊ธฐ๋ฐ์ผ๋ก ๊ฒฝํ์์ ์ธ์งํ ์งํ์์์ ๊ณผ๊ฑฐ์ ์ฌ๋ก๋ฅผ ๊ธฐ์ตํ๊ณ ๊ทธ๋ค์ด ๋ฐฐ์ด๊ฒ์ ์ ์ฉ์ํค๋ ๊ฒ์ ์ฃผ๋ชฉํ๋ค. (์๋ต ๋ฐ ์์ญ) ์ด๊ฒ์ ์ฒด์ค์ ๊ณ ์, ์์ฌ, ๋ณํธ์ฌ ๊ทธ๋ฆฌ๊ณ ๊ฑด์ถ๊ฐ๋ค์ด ์๋ก์ด ๋ฌธ์ ์ ๋์ํ๋ ์ถ๋ก ๋ฐฉ์์ ํ ๋ฐฉ์์ด๋ค. ํ์ฌ, ๋์์ธ ํจํด์ ์ํํธ์จ์ด ๋์์ด๋๋ค์ด ๋ฐฐ์์จ๊ฒ๋ค๊ณผ ๋ค๋ฅธ ๋ถ์ผ์ ๋์์ด๋(other designer)๋ค์ ๊ฒฝํ๋ค ๋ชจ๋๋ฅผ ๊ฐ์ํ๋ค. ์ด๋ฐ ๋
ธ๋ ฅ๋ค์ ๊ฒฐ๊ณผ์ ์ผ๋ก, "๊ฑฐ์ธ์ ์ด๊นจ์ ์ฌ๋ผ์ ์๋๊ฒ" ๊ฐ์ ๋ฐฉ๋ฒ์ผ๋ก ์ฐ๋ฆฌ๋ฅผ ํ๋ฅญํ ๋์์ธ์ ์ด๋์ ์๋ค. John Vlissies(1997)์ ๋์์ธ ํจํด์ "์ ๋ฌธ ์ง์์ ์ก๊ณ ๋น์ ๋ฌธ๊ฐ๋ค์ด ๊ทธ๊ฒ์ ์ด์ฉํ๊ธฐ ์ฝ๊ฒ ํด์ฃผ๋ ๊ฒ์ด๋ผ๊ณ ํํ๋ค. (p. 32).
Design patterns also provide a succinct vocabulary with which to describe new designs and retrospectively explain existing ones. Patterns let us understand a design at a high level before drilling down to focus on details. They allow us to envision entire configurations of objects and classes at a large grain size and communicate these ideas to other designers by name. We can say, "Implement the database access object as a Singleton," rather than, "Let's make sure the database access class has just one instance. The class should include a class variable to keep track of the singl instance. The class should make the instance globally available but control access to it. The class should control when the instance is created and ..." Which would you prefer?
๋์์ธ ํจํด์ ์๋ก์ด ํจํด์ ๊ดํด์ ๊ฐ๋จํ๊ฒ ์๋ฆฌ๋ฅผ ํํํ๊ณ , ํจํด์ ์กด์ฌํ๋ ๋ชจ์ต์ ๊พธ์คํ ์ค๋ช
ํ๋ค.ํจํด์ ์ธ๋ถ๋ด์ฉ์ ๋ค์ด๊ฐ๊ธฐ ์์, ์ข๋ ํฐ ๊ด์ ์ผ๋ก ์ดํด๋ฅผ ํ ์์๊ฒ ํ๋ค. ํจํด์ ์ฐ๋ฆฌ๊ฐ ์ข๋ ํฐ ๊ด์ ์์ผ๋ก ใธ ๋ค๋ฅธ ๋์์ด๋๋ค์ ์๊ฐ์ ๊ตํ์ ๊ฐ์ฒด๊ณผ ํด๋์ค๊ฐ ์ด๋ป๊ฒ ๊ตฌ์ฑ๋์ด ์๋์ง ๋ฌ์ฌํ๋ค. ์ฐ๋ฆฌ๋ "์ฑ๊ธํด ๋ฉ์๋๋ก ๋ฐ์ดํฐ ๋ฒ ์ด์ค ์ ๊ทผ ๋ถ๋ถ์ ๊ตฌ์ฑํ์ต๋๋ค." ๊ทธ๋ฆฌ๊ณ "๋ฐ์ดํฐ ๋ฒ ์ด์ค ์ ๊ทผ์ ์ค์ง ํ๋์ ์ธ์คํด์ค๋ง์ด ์ ๊ทผํ๋๋ก ํด์ต๋๋ค. ๊ทธ ํด๋์ค๋ ์ฑ๊ธ ์ธ์คํด์ค์ ๋ฐฉ๋ฒ ์ฌ์ฉ์ ์ํด์ ํด๋์ค ๋ณ์๋ฅผ ์ฌ์ฉํ ๊ฒ์
๋๋ค. ๊ทธ ํด๋์ค๋ ๊ด์ญ์ผ๋ก ๊ด์ญ์ผ๋ก ์ ๊ทผ๊ฐ๋ฅํ ์ธ์คํด์ค๋ก ๋ ๊ฒ์ด์ง๋ง, ๋์ค๊ณ ์นจ
๊ทธ ํด๋์ค๋ ๊ทธ ์ธ์คํด์ค๊ฐ ๋ง๋ค์ด์ง๊ณ ... "๊ณ ๋งํ ์ ์์ต๋๋ค. ๋น์ ์ ์ด๋ป๊ฒ ์ค๋ช ํ๊ฒ ์ต๋๊น?
๊ทธ ํด๋์ค๋ ๊ทธ ์ธ์คํด์ค๊ฐ ๋ง๋ค์ด์ง๊ณ ... "๊ณ ๋งํ ์ ์์ต๋๋ค. ๋น์ ์ ์ด๋ป๊ฒ ์ค๋ช ํ๊ฒ ์ต๋๊น?
์กธ๋ ค์.. --; ์กฐ๋ง๊ฐ ๋ง์ ํ๊ฒ ์ -- ์์ฒ
1.3. 1.2 Why a Smalltalk Companion? ¶
p3 ์ค๊ฐ๋ถํฐ
Christopher Alexander and his colleagues have written extensively on the use of design patterns for living and working spaces-homes, buildings, communal areas, towns. Their work is considered the inspiration for the notion of software design patterns. In The Timeless Way of Building(1979) Alexander asserts, "Sometimes there are version of the same pattern, slightly different, in different cultures" (p.276). C++ and Smalltalk are different languages, different environments, different cultures-although the same basic pattern may be viable in both languages, each culture may give rise to different versions.
Christopher Alexander์ ๊ทธ์ ์น๊ตฌ, ๋๋ฃ๋ค์ ๋์์ธ ํจํด์ด ๊ณต๊ฐํ์ฉ๊ณผ, ๊ฑด์ถ, ๊ณต๋์ฒด์ ๊ตฌ์ฑ๋ฐฉ๋ฒ ๊น์ง ํ์ฅ๋๋ ๊ฒ์ ๊ดํ ๊ธ์ ์จ์๋ค. ์ฌ๊ธฐ์์ ๊ทธ๋ค์ด ์ถ๊ตฌํ๋ ๋ฐ๋ ์ด๋ฐ ๋ถ์ผ์ ์ ์ฉ์ ํตํ์ฌ, ์ํํธ์จ์ด ๋์์ธ ํจํด์ ์ํ ๋ ๋ค๋ฅธ ์๋ก์ด ์ฐฝ์กฐ์ ์๊ฐ ์ฆ, ์๊ฐ์ ์ป๊ธฐ์ํ ์ผ๋ จ์ ์์
(๊ถ๋ฆฌ)์ด๋ค. The Timeless Way of Building(1979) ์?? Alexander๋ "๋๋ก๋ ์๋ก๋ค๋ฅธ ๋ฌธํ๊ถ์์ ์์ฃผ ์ฝ๊ฐ์ ๋ค๋ฅด๊ฒ ๊ฐ์ ํจํด์ ๋ฒ์ ๋ค์ด ์กด์ฌํ๊ฑธ ๋ณผ์ ์๋ค"(p.276) ๋ผ๊ณ ์ธ๊ธํ๋ค. C++๊ณผ Samlltalk๋ ๋น๋ก ๊ฐ์ ๊ธฐ๋ณธ์ ์ธ ํจํด์์์ ์ถ๋ฐ์ ํด๋ ๋ค๋ฅธ ์ธ์ด, ๋ค๋ฅธ ๊ฐ๋ฐํ๊ฒฝ, ๋ค๋ฅธ ๋ฌธํ๋ก ๋ง๋ฏธ์์ ๊ฐ์ ๋ค๋ฅธ ๋ชจ์์๋ฅผ ๋ณด์ฌ์ค๋ค.
The Gang of Four's Design Patterns presents design issues and solutions from a C+ perspective. It illustrates patterns for the most part with C++ code and considers issues germane to a C++ implementation. Those issue are important for C++ developres, but they also make the patterns more difficult to understand and apply for developers using other languages.
Gang of Four์ Design Patterns ์ C++์ ๊ด์ ์์ ๋์์ธ์ ์ด์์ ํด๊ฒฐ์ฑ
๋ค์ ์ ์ํ๋ค. Design Patterns๋ ๋๋ถ๋ถ C++์ ์ด์ฉํ ํจํด๋ค๊ณผ, C++์ ์ ์ฉ(implementation)๊ณผ ๊ด๋ จ์๋ ์ด์๋ค์ ๊ดํ ๊ฒฌํด๋ฅผ ๋ค๋ฃจ๊ณ ์๋ค. ๊ทธ๋ฌํ ์ด์๋ค์ C++ ๊ฐ๋ฐ์๋ค์๊ฒ๋ ๋งค์ฐ ์ค์ํ ์ง ๋ชจ๋ฅด์ง๋ง, ๋ค๋ฅธ ์ธ์ด๋ค์ ์ด์ฉํ๊ณ ์๋ ๊ฐ๋ฐ์๋ค์๊ฒ๋ ์์นซ ์ดํดํ๊ณ ํจํด์ ์ ์ฉ์ ์ด๋ ค์์ ๊ฐ์ง๊ณ ์จ๋ค.
This book is designed to be a companion to Design Patterns, but one written from the Smalltalk perspective. One way to think of the Smalltalk Companion, then, is as a variation on a theme. We provide the same pattern as in the Gang of Four book but view them through Smalltalk glasses. (In fact, when we were trying out names for the Smalltalk Companion, someone suggested "DesignPattern asSmalltalkCompanion." However, we decided only hard-core Smalltalkers would get it.)
์ด์ฑ
์ Design Patterns ์ ๋ํ ์ง์นจ์, ํธ๋์ผ๋ก ์ ์๋์๋ค. ํ์ง๋ง ๊ด์ ์ Design Pattern์ด C++์ธ๊ฒ์ ๋ฐํ์ฌ ์ด ์ฑ
์ Smalltalk์ ๊ธฐ์ธํ๋ค. ๊ทธ๋ฅ, ์ด ์ฑ
Smalltalk Companion์ ๋ํด์ ํ๋์ ์ฃผ์ (design pattern)์ ๊ดํ ๋ค์ํ ์๋ฃ ์ ๋๋ก ์๊ฐํด ์คฌ์ผ๋ฉด ํ๋ค. ์ฐ๋ฆฌ๋ Gang of Four book์์์ ๊ฐ์ ํจํด์ ์ ๊ณตํ์ง๋ง, Smalltalk๋ผ๋ ์๊ฒฝ์ ํตํด์ ๋ฐ๋ผ๋ณผ๊ฒ์ด๋ค. (์ฌ์ค, ์ฐ๋ฆฌ๊ฐ ์ด๋ฆ์ Samlltalk Companion์ ๋ฃ์๋ ์ด๋ค์ด๋ "DesignPattern asSmalltalkCompanion" ์-์ญ์์ฃผ Smalltalk์ธ์ด์์์์ ํํ๋ฒ ๋๋ฌธ์ธ๊ฒ ๊ฐ์ต๋๋ค.- ์ ์ํ๊ธฐ๋ ํ๋ค. ํ์ง๋ง ๊ทธ๋ฐ ์ด๋ฆ์ hard-core Smalltalkers๋ค๋ง์ด ๊ทธ ์ด๋ฆ์ ๋ฐ์๋ค์ผ๊บผ๋ผ๊ณ ์๊ฐํ๋ค.)
p 3 1.2์ ๋ง์ง๋ง ๋จ๋ฝ๋ถํฐ ๋ฒ์ญ ์์ํฉ๋๋ค. --์ง๊ท
But the Smalltalk Companion goes beyond merely replicating the text of Design Patterns and plugging in Smalltalk examples whereever C++ appeared. As a result, there are numerous situations where we felt the need for additional analysis, clarification, or even minor disagreement with the original patterns. Thus, many of our discussions should apply to other object-oriented languages as well.
ํ์ง๋ง Smalltalk Companion์ Design Patterns ๋ฌธ์๋ฅผ ๋จ์ํ๊ฒ ๋ฐ๋ณต ํ๋๊ฒ ์ด์์ด๊ณ C++ ์ฝ๋๊ฐ ์์ ๊ฒฝ์ฐ Smalltalk ์๋ก ๋ฐ๊พผ๋ค. ๊ฒฐ๊ณผ์ ์ผ๋ก, ์ฐ๋ฆฌ๊ฐ ์ถ๊ฐ์ ์ธ ๋ถ์, ๋ถ๋ฅ, ํน์ ๊ธฐ์กด์ ํจํด์ ๋ํ ์ฝ๊ฐ์ ๋ถ์ผ์นํ๋ค๊ณ ๋๋ผ๋ ๋ง์ ์ํฉ์ด ์๋ค. ๊ทธ๋ฌ๋ฏ๋ก, ์ฐ๋ฆฌ์ ๋ง์ ํ ์๊ฐ ๋ค๋ฅธ ๊ฐ์ฒด ์งํฅ ์ธ์ด์ ์ ์ ์ฉ๋์ผ ํ ๊ฒ์ด๋ค.
Of course, we provide plenty of sample code in Smalltalk. Our examples are, for the most part, not simply Smalltalk versions of the Design Patterns examples. We often felt an alternative would be more useful than a mere translation of the C++ example.
Here in a nutshell are our goals for the Smalltalk Companion as a supplement to Design Patterns :
Here in a nutshell are our goals for the Smalltalk Companion as a supplement to Design Patterns :
- Discussion of issues specific to Smalltalk implementions of the Gang of Four's design patterns
- Much more Smalltalk sample code
- More Smalltalk known uses, especially from the major Smalltalk envirnoments class libraries
- Exploring variations the patterns can embody in Smalltalk and in general
- Many new examples, from application domains(insurance, telecommunications, etc.) and systems development (windowing systems, compilers, etc.)
- Gang of Four's design patterns์ Smalltalk ๊ตฌํ์ ๋ํ ๊ตฌ?์
ๅฒต? ์์ ์ ํ ์๋ฅผ ํ๋ค.
- Smalltalk ์ํ ์ฝ๋ ์ด์์ด๋ค.
- Smalltalk๋ฅผ ์ข๋ ์์๊ณ ์ฌ์ฉํ๋ค. ํนํ ์ฃผ์ํ Smalltalk ํ๊ฒฝ class libraries๋ค์ ์์๋ณธ๋ค.
- Smalltalk๋ก ๊ตฌ์ฒดํ๋ ์ ์๋ ๊ฒ๊ณผ ์ผ๋ฐ์ ์ธ ํจํด์ ๋ณํ๋ฅผ ํํํ์.
- ์์ฉ ํ๋ก๊ทธ๋จ ์์ญ(๋ณดํ, ์๋ฐฉํฅ ํต์ , ๋ฑ๋ฑ.) ๊ณผ ์์คํ
๊ฐ๋ฐ(์๋์ฐ์ฆ ์์คํ
, ์ปดํ์ผ๋ฌ, ๋ฑ๋ฑ.)์ ๋ง์ ์๋ก์ด ์์ ๋ค์ ๋ค๋ฃฌ๋ค.