Learning / implementing design patterns (for beginners)

I am a confused novice and amateur programmer trying to figure this out, so forgive me if my question is little or no sense.

I see a lot of questions about how SO revolves around using design patterns, and I wonder if anyone has any good resources to learn and implement design patterns? I understand the general idea and know how / when to use a couple of them (Singletons, Factory methods), but I know what I'm missing.

(Just in case, this is important, my preferred language is C #, but I could learn from examples in other languages)

+83
oop design-patterns
Oct 28 '08 at 20:22
source share
25 answers

Draw the first design templates.

alt text

and Design Pattern Wikipedia page are the best resources for beginners. FluffyCat is another good free online resource for design patterns like Java and PHP .

The Gang of Four book is where to go next, but it’s pretty advanced, so I would wait until you have a pretty solid grasp on other resources.

+84
Oct 28 '08 at 20:24
source share

Design patterns are great for a variety of reasons:

  • gives you a start to solve common problems.
  • gives developers vocabulary to talk about some ways to solve problems very compactly.
  • When working with developers who know design patterns and use design patterns in their solutions, they will understand the solutions much faster.

But when your goal is just to learn design patterns, I think you are lacking in reason. All design patterns are based on more general principles. High adhesion, low adhesion principle with open closed principle, dry, Liskov replacement principle, etc. For these basics, I read the following books in the following order:

After that, you are ready for the main group of four design templates.

  1. The head of the first design templates (first chapter) [ILLUSTRATED] (Paperback)
  2. BIBLE
  3. Good site (don’t buy anything, it’s not worth it) http://dofactory.com/Patterns/Patterns.aspx (some implementations of this site are worth a discussion

Next step:

  1. Enterprise Application Architecture Templates (Addison-Wesley Signature Series) (Hardcover)
  2. POSA books

And always remember: the template is not the goal!

+26
Oct 28 '08 at 21:17
source share

I would add that the Design Patterns book from The Gang of Four is a bible for anyone seriously interested in design patterns.

+20
Oct 28 '08 at 20:26
source share

My advice:

Read a lot about templates from different sources.

Trying to get as many templates as possible to use all the code you write, as this point will not give good results. Instead, give information in your brain for a while (read: months).

Suddenly, you run into a problem or part of the code, and you vaguely remember that you saw something that could work as a solution to this particular problem. It is time to look at the details of the template you are thinking about and try to apply it.

What worked for me, anyway.

+13
Oct 28 '08 at 20:30
source share

Design Patterns

This training site contains the following subsections.

  • The purpose of each design pattern
  • Real world structure for design pattern.
  • A Problem Statement
  • Detailed discussion of the problem
  • Checklist on how to get the template.
  • Thumb rules when reaching a pattern.
  • Code snippets for a design pattern that includes C #, C ++, Delphi, Java, and PHP

This site also contains a guide to Anti Templates , UML and Refactoring .

+9
01 Sep '09 at 9:08
source share

Bruce Eckel has a book on design patterns , although this is Java, it, like all his books, is awesome. And best of all, they are free!

+8
Oct 28 '08 at 20:30
source share
+7
Oct 28 '08 at 20:34
source share

An introductory book that I found useful and well written, Design patterns by Alan Shellaway and James Trott (Addison Wesley) were developed .

alt text http://ecx.images-amazon.com/images/I/5172GGH8QHL._SL500_AA240_.jpg

Do not start with the Gang of Four , as it is not an introductory book.

+5
Oct. 29 '08 at 0:09
source share

I would recommend taking a look at the quintology of Jean Paul Boudoux (?) On the Demystifying Design Patterns on DNRtv below. Video castes relate to Singleton, Abstract Factory among others - the difference is that you can look at the code to discuss the theory. It's nice to watch 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

+4
Oct 29 '08 at 12:51
source share

Annotations to the comments above.

Quick Reference to GOF Templates

Here is a good place where you can start dofactory.com/patterns/patterns.aspx - you can find a link to each template along with the corresponding implementations.

Be that as it may, remember that these are GOF templates. You may need to read and understand advanced templates as soon as you have enough experience with OOAD. Head First Design Patterns is a good start, and after some progress, move on to Martin Fowler enterprise application architecture patterns.

Applying Design Patterns - A Thinking Process

Another important aspect is that applying design patterns is as important as just knowing them. Reading these articles may also help you.

Applying Design Patterns Part I

Applying Design Patterns Part II

Hope this helps

+4
Dec 15 '08 at 7:34
source share

Head First Design Patterns are good, like others already noted. Other than that, of course, the original book and C # design samples. There are also good sites that have already been mentioned.

In addition to self-study, I seriously recommend starting or attending a model group of samples in your area. See the Template Design Tutorial for an explanation and how to learn about templates. We have done this, and I can honestly say that I will not understand how I am now. A weekly meeting with other interested people keeps you wonderfully disciplined when you learn something abstract, like design templates.

Happy research!

+3
Oct 29 '08 at 9:21
source share

Before spending money on books, I would recommend Wikipedia a great template design . Also for something else Google for “design patterns” or the search for “design patterns” on YouTube . Getting the same information, presented in different ways, often helps a penny drop.

Gang of Four is the final text on the most famous templates, but it is not so easy to read, and with examples in C ++ not everyone is loved.

Head First Design Patterns text is much more accessible, but contains only a subset of Gang of Four patterns.

The most important thing is to understand where and why a particular template is useful. After that, find on the Internet examples of implementation in your chosen language 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 connecting.

+3
Dec 22 '09 at 14:13
source share

Martin Fowler Enterprise Application (Hardcover) Architecture Templates

Pattern Refactoring (Hardcover) by Joshua Kerievsky

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

Beyond Software Architecture: Creating and Maintaining Victory Solutions (Paperback) by Luc Hochman

+2
Oct 28 '08 at 20:26
source share

Design patterns are similar to any library function, they are read about them, and then, when a problem arises, the design pattern will be in your "Tool". There are many books on design patterns that were formed after the original “gang of four design patterns”.

For any programmers, I think Fowler’s Refactoring book is an absolute minimum requirement.

+2
Oct 28 '08 at 20:27
source share

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

+2
Oct 28 '08 at 20:29
source share

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

This is a great book at every level: layout, clarity, insight, depth. This is one of those great books that you first read with the cover, and then use it as a reference until you recognize it literally inside out.

You can start on the Wikipedia page , but also treat yourself to a wonderful book.

+2
Oct 28 '08 at 20:30
source share

Application of UML and templates from Craig Larman. Start with the basics of analysis, design, and use a simple Case script. Represents most basic templates in a simple way.

+2
Oct 28 '08 at 20:30
source share

If you read about design patterns, you will notice that Java seems to have some of them implemented.

Look at the source of a structure and you can get information about design patterns. Personally, I don’t see that they fit perfectly with any of my codes, sometimes the examples in books and textbooks seem a little idealized, especially for a single encoder.

Design patterns are not intended for lazy encoders.

+2
Oct 28 '08 at 20:35
source share

For me and my colleagues, a design pattern is being studied next to the Pattern Study Group . They prepare a list of each template, which we must study in order, and also open the questions that are discussed more in the group.

+2
Nov 27 '08 at 4:14
source share

It doesn't make much sense to me for someone who has very little experience to think deeply about design patterns. It's great to know that they exist, but at this point you should focus more on other things, and not just study design patterns.

They are useful in the context of the problem - as a concept for a new / novice developer, in fact it is not too practical, except that you should use them when and where you can.

EDIT To clarify, many design patterns are the result of problems found in some areas. It is impossible to expect a new programmer (IMO) to find out a project template that will be used for some problems. Just as we get a small number of algorithms in CS research, we need to understand what we can do with templates and their advantages, but when a person is still building a welcome world or discovering stl, there is no practical need for design templates. The templates are great. But they are not a silver bullet.

(There was also no CASE (tools), none of them were UML, nor SCRUM, nor TDD, nor STL, nor Java, nor XML, etc.). These are all just aspects of our profession and considering these topics since the second coming is naive.

+1
Oct 28 '08 at 20:29
source share

I also suggest having shufty in Template Refactoring after you read Samples of the Design Front End.

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

+1
Oct 28 '08 at 20:30
source share

Templates include high-level dictionaries that use talk of abstract design. If you are reusing an abstract solution, it is useful to access it by name. If you are inventing a template, professionally do a little test to make sure it has not yet been given a name. If it was named, then the description may be useful.

After you encode a little bit, you will notice that you are writing something similar to what you encoded before. This is a template. Even if it is a tiny drawing, you should pay attention. Is there a better sample? Do you see some tiny models interacting with each other to solve a big problem? The next time you want to solve a big problem, the whole template comes to your mind as a single piece. Smoothing detailed lines of code becomes mechanical.

The more you notice patterns, the easier programming becomes, and the more you will appreciate some of the biggest and best models developed by other programmers. Try to master the MVC pattern. One way or another, variations are ubiquitous, even in tiny design decisions.

+1
Oct 28 '08 at 21:48
source share

Once you understand the concept, go through the Eclipse source code or design, there are a lot of really good examples of these templates (it is not surprising that Gamma was one of the designers).

+1
Nov 27 '08 at 4:20
source share

I found Design Pattern articles on this website are very easy to understand.

C # Design Patterns

+1
Aug 23 '09 at 22:07
source share



All Articles