I am planning to learn C# on the job - a moderately complex (2000 lines of code) project. I am interested in picking up "design patterns" along the way.
Can anyone suggest a book that doesn't assume too much of c# expertise and teaches design patterns? It's ok if the book is not devoted to design patterns (it could be one of the chapters).
An excellent book is Head First Design Patterns. Easy to understand and follow and a fun read.
The GoF book is where it all started, but I found it very dry and difficult to grasp. Not what I would recommend for learning.
Examples are in Java, but the concepts translate well.
You can even get C# examples.
HEAD First Series is a good starting point
i would say please use HEAD First OOAD book also
Design patterns are actually language agnostic. They are not tied to a particular language. So for instance any design pattern that works with Java, will work for C# too.
Of course there are patterns which works with a particular language/technology such as MVVM, but I don't think you are writing in WPF or Silverlight, do you? For web you can choose to go with MVC instead of WebForms.
And about the books, you can take a look at
- Object-Oriented Thought Process, The (3rd Edition)
- Design Patterns For Dummies
Because C# is a full OO language, you will have to adapt to OO design principles and patterns.
I agree with the other responses that design patterns are language agnostic. However, coming from a C# background, I have found the book Design Patterns in C# by Steven John Metsker to be a great read and would be relevant for you.
"Design Patterns" The gang of four.
I would highly recommend this website for design patterns, anti-patterns UML and refactoring
http://sourcemaking.com/
Very well structured and easy to read!!
The obvious choice would be Design Patterns in C#, but I've not read it, so I can't comment on its quality.
Edit: As mentioned by Popo, the Design Patterns book itself is a great way to learn design patterns, but the code is not in C#: Design Patterns: Elements of Reusable Object-Oriented Software
There are several good books (some already mentioned) on design patterns. I actually have around four or so. When learning a pattern I like to read about it in more than one book. Usually the scenarios and examples will be a little different, which helps get the idea better. Wikipedia.org is a pretty good resource too.
That said, I like to spend some time reading code related to the patterns. Code that shows strengths of a platform is nice for obvious reasons. Check out http://www.dofactory.com while you are at it. If you want to see the GoF and other enterprise patterns applied to some real coding problems, then that site is excellent. You have to pay for the reference app and design patterns solutions, but there are examples related to the Head First book, the GoF work, and what they call optimized variations that leverage .NET.
Some books I found useful:
- Head First Design Patterns: Great book for getting the ideas.
- C# 3.0 Design Patterns (Judith Bishop) : Not my favorite for the code examples, but there are usually some nice points around comparing a pattern to other related patterns and why you might pick one over another.
- Design Patterns (Christopher G. Lasater): A pretty good book that is straight to the point.
精彩评论