development

디자인 패턴 학습 / 구현 (초보자 용)

big-blog 2020. 9. 15. 18:55
반응형

디자인 패턴 학습 / 구현 (초보자 용)


나는 혼란스러워하는 초보자이자 취미 프로그래머이기 때문에 내 질문이 약간 틀리거나 이해가되지 않으면 용서해주세요.

나는 디자인 패턴의 사용과 관련된 많은 질문을 보았고, 누군가가 디자인 패턴에 대해 배우고 구현할 수있는 좋은 리소스를 가지고 있는지 궁금합니다. 나는 일반적인 아이디어를 이해하고 몇 가지 (Singletons, Factory methods)를 사용하는 방법 / 언제를 알고 있지만 내가 놓치고 있다는 것을 알고 있습니다.

(중요한 경우를 대비하여 선호하는 언어는 C #이지만 다른 언어의 예제에서 배울 수 있습니다)


헤드 퍼스트 디자인 패턴

대체 텍스트

그리고 Design Pattern Wikipedia 페이지 는 초보자를위한 최고의 리소스입니다. FluffyCatJavaPHP의 디자인 패턴에 대한 또 다른 좋은 무료 온라인 리소스입니다 .

네 책의 갱은 이후 갈 곳이지만, 다른 자원에서 꽤 확고한 이해를 가지고 때까지 기다릴 것, 그래서 그것은 상당히 고급입니다.


디자인 패턴은 여러 가지 이유로 훌륭합니다.

  1. 일반적인 문제를 해결하기위한 시작을 제공합니다.
  2. 개발자에게 매우 간결한 방식으로 문제를 해결하는 특정 방법에 대해 이야기 할 수있는 어휘를 제공합니다.
  3. 디자인 패턴을 알고 있고 솔루션에서 디자인 패턴을 사용하는 개발자와 함께 작업하면 솔루션을 훨씬 더 빨리 이해할 수 있습니다.

하지만 목표가 디자인 패턴을 배우는 것이라면 기본을 놓치고 있다고 생각합니다. 모든 디자인 패턴은보다 일반적인 원칙을 기반으로합니다. 높은 응집력, 낮은 커플 링 개방 폐쇄 원리, DRY, Liskov 대체 원리 등. 이러한 기본 사항에 대해 다음 책을이 순서대로 읽었습니다.

  1. Head First 객체 지향 분석 및 설계 (Head First) [그림] (페이퍼 백)
  2. UML 및 패턴 적용 (하드 커버)
  3. C #의 Agile Principles, Patterns, Practices (Robert C. Martin 시리즈) (하드 커버)

그 후 네 가지 디자인 패턴의 기본 갱단을 준비합니다

  1. Head First Design Patterns (Head First) [ILLUSTRATED] (페이퍼 백)
  2. 성경
  3. 멋진 웹 사이트 (아무것도 사지 마세요, 가치가 없습니다) http://dofactory.com/Patterns/Patterns.aspx (이 사이트의 일부 구현은 토론 할 가치가 있습니다

다음 단계:

  1. 엔터프라이즈 애플리케이션 아키텍처의 패턴 (Addison-Wesley 서명 시리즈) (양장본)
  2. POSA 책

그리고 항상 기억하십시오 : 패턴은 목표가 아닙니다!


나는 것을 추가 할 것입니다 디자인 패턴은 은 "네 명"에서 예약 심각 디자인 패턴에 관심있는 누군가를위한 성경입니다.


내 팁 :

다른 출처의 패턴에 대해 많이 읽으십시오.

작성중인 모든 코드에 가능한 한 많은 패턴을 적용하려고하면 좋은 결과를 얻을 수 없습니다. 대신 정보가 잠시 동안 두뇌에 머물게하십시오 (읽기 : 몇 달).

Suddenly you'll find yourself stumbling upon a problem or piece of code and you'll vaguely remember that you've seen something that might work as a solution to this particular problem. Now is the time to look up the details on the pattern you are thinking of and try to apply it.

That's what has worked for me, anyway.


Design Patterns

This tutorial site contains following sub-sections

  • Intent of each design pattern
  • Real World Structure for the design pattern
  • A Problem statement
  • Detailed discussion on the problem
  • Checklist on how to arrive at a pattern
  • Rules of thumb while arriving at pattern.
  • Code snippets for the design pattern which includes C#, C++, Delphi, Java and PHP

This site also contains guide on Anti Patterns, UML and Refactoring.


Bruce Eckel has a book on design patterns, although it's Java, it's like all of his books amazing. And the best thing is, they are free!


C# 3.0 Design Patterns for a C# perspective on design patterns.

대체 텍스트
(source: oreilly.com)


An introductory book that I found useful and well written is Design Patterns Explained by Alan Shalloway and James Trott (Addison Wesley).

대체 텍스트

Do not start from the Gang of Four book, for it is not an introductory book by any means.


I would recommend taking a look at Jean Paul Boodhoo's quintology (?) on Demystifying Design Patterns on DNRtv, urls supplied below. The videocasts touches on Singleton, Abstract Factory among others- the difference being that you can watch him code as he discusses the theory. Good to watch over lunch on a rainy weekday.

http://www.dnrtv.com/default.aspx?showNum=63 http://www.dnrtv.com/default.aspx?showNum=65 http://www.dnrtv.com/default.aspx?showNum=68 http://www.dnrtv.com/default.aspx?showNum=71 http://www.dnrtv.com/default.aspx?showNum=92


An annotation to the above comments.

A Quick Reference For GOF Patterns

Here is a good place you can start dofactory.com/patterns/patterns.aspx - You can find link to each pattern, along with corresponding implementations.

How ever, remember that these are GOF patterns. You might need to read and understand advanced patterns as well, once you gain enough expertise in OOAD. Head First Design Patterns is a good start, and after making some progress, go with Martin Fowler's Enterprise Application Architecture Patterns.

Applying Design Patterns - The Thought Process

Another main aspect - Applying Design patterns is as important as just knowing them. Reading these articles might help you as well.

Applying Design Patterns Part I

Applying Design Patterns Part II

Hope this helps


Head First Design Patterns is a good one like others already noted. Besides this, of course the original book and C# Design Patterns. Also there are good websites already mentioned.

Besides self-learning, I seriously recommend starting or attending a pattern study group in your area. See A Learning Guide To Design Patterns for explanation and great order to study the patterns in. We did this and I can honestly say that I would not understand as much as I do now. A weekly meeting with other interested people keeps you surprisingly disciplined when learning something abstract like design patterns.

Happy studies!


Before spending money on books I would recommend Wikipedia's excellent design patterns page. Also for something different Google for "design pattern screencasts" or search for "design patterns" on YouTube. Getting the same information presented differently often helps the penny drop.

The Gang of Four book is the definitive text on the most well known patterns but is not that easy to read and with C++ examples not everyone's favourite.

The Head First Design Patterns text is far more accessible but only contains a subset of the Gang of Four patterns.

The most important thing is to understand where and why a particular pattern is useful. Afterwards search the web for implementation examples in the language of your choice and experiment until you "get it". Understand one pattern before moving on to the next. Everyone understands some patterns better than others (and there are hundreds of lesser known ones).

Just keep plugging away.


디자인 패턴      
(source: Amazon)


Patterns of Enterprise Application Architecture (Hardcover) by Martin Fowler

Refactoring to Patterns (Hardcover) by Joshua Kerievsky

Continuous Integration: Improving Software Quality and Reducing Risk (Paperback) by Paul Duval et.al.

Beyond Software Architecture: Creating and Sustaining Winning Solutions (Paperback) by Luke Hohmann


Design patterns are like any library function, read about them, then when a problem comes up, the design pattern will be in your "Toolchest". There are many design patterns books all patterned after the original "Gang of four" design patters.

For any programmers, I think that and the Refactoring book by Fowler are the absolute minimal requirements.


For websites, a very good site is http://ajaxpatterns.org, from one of the developers of the ajaxian website


The original Design Patterns book is a must-read for all programmers.

It is an excellent book on every level: layout, clarity, insight, depth. It's one of those great books that you first read cover-to-cover, and then use as a reference until you literally know it inside out.

You could start by the Wikipedia page, but treat yourself with the great book too.


Applying UML and Patterns by Craig Larman. Start from the basic of analysis, design and uses a simple Case scenario. Introduces most of the basic patterns in a simple way.


If you read about design patterns you'll notice that Java seems to have a few of them implemented.

Look at the source for any framework and you can glean info about design patterns. Personally I don't see them fitting in perfectly to any of my code, sometimes the examples in books and tutorials seem a little idealized, especially for the lone coder.

Design patterns aren't for lazy coders.


For me and my colleagues study Design Pattern that following on Pattern Study Group. They prepare a list of each pattern that we should learn in order and also have the opening questions that make more discussion in group.


I also suggest having a shufty at Refactoring to Patterns once you've read Head First Design Patterns.

Note: The code examples are in Java, but should be very similar to C# examples...


It does not make too much sense to me for someone with very little experience to delve too far deeply into design patterns. It is great to know they exist, but at this point you should focus more on other things rather than just learning about design patterns.

They are useful in context of a problem - as a concept for a new/beginner developer they are really not too much practical value aside form knowing that you should make use of them when and where you can.

EDIT To clarify - many design patterns are a result of problems found in some domains. A new programmer can hardly be expected (IMO) to know the design pattern(s) to use for some set of problems. Just as we get a smattering of algorithms in CS studies, we need an understanding of the things we can do with patterns and their benefits, but when a person is still building hello world or discovering stl there is not much practical need for design patterns. Patterns are great. But they are not the silver bullet.

(Neither was CASE (tools), neither is/was UML, neither is SCRUM, neither is TDD, nor STL, nor Java, nor XML, etc. ) These are all just aspects of our profession and to treat these topics as the second coming is naive.


Patterns comprise the high level vocabulary programmers use to talk about abstract design. If you are reusing an abstract solution, it is helpful to refer to it by name. If you invent a pattern, it is professional to do a little checking to make sure it hasn't already been given a name. If it has been named, then the description may be useful.

After you code even a tiny bit, you will notice yourself writing something similar to what you coded before. This is a pattern. Even if it is a tiny pattern, it is worth noticing. Is there a better pattern? Do you see certain tiny patterns cooperating together to solve a larger problem? Well next time, when you want to solve larger problem, the entire pattern comes into your mind as a single chunk. Fleshing out the detailed lines of code becomes mechanical.

패턴을 더 많이 알아 차릴수록 프로그래밍이 쉬워지며 다른 프로그래머가 작업 한 가장 크고 최상의 패턴을 더 많이 인식하게 될 것입니다. MVC 패턴을 마스터 해보십시오. 어떤 식 으로든 변형은 사소한 디자인 결정에서도 모든 곳에서 나타납니다.


개념을 이해 한 후에는 Eclipse 소스 코드 또는 디자인을 살펴보고 이러한 패턴에 대한 정말 좋은 예제를 많이 살펴보십시오 (놀랍지 않게 Gamma는 디자이너 중 하나였습니다).


이 웹 사이트의 디자인 패턴 기사는 정말 이해하기 쉽습니다.

C #의 디자인 패턴

참고 URL : https://stackoverflow.com/questions/244706/learning-implementing-design-patterns-for-newbies

반응형