使用 C# 的设计模式

发布于 2024-10-05 00:31:01 字数 123 浏览 4 评论 0原文

我计划在工作中学习 C#——一个中等复杂(2000 行代码)的项目。我有兴趣一路学习“设计模式”。

谁能推荐一本不需要太多 C# 专业知识并教授设计模式的书?如果这本书不专门讨论设计模式也没关系(它可以是其中一章)。

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).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

桃酥萝莉 2024-10-12 00:31:01

Head First Design Patterns 是一本很棒的书。易于理解和遵循,读起来很有趣。

GoF 书是一切的起点,但我发现它非常干燥和困难去把握。 不是我推荐的学习内容。

示例是用 Java 编写的,但概念可以很好地翻译。

您甚至可以获得C# 示例

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.

江挽川 2024-10-12 00:31:01

HEAD First 系列是一个很好的起点,

我想说请也使用 HEAD First OOAD 书

HEAD First Series is a good starting point

i would say please use HEAD First OOAD book also

喜你已久 2024-10-12 00:31:01

设计模式实际上与语言无关。它们不依赖于特定的语言。例如,任何适用于 Java 的设计模式也适用于 C#。

当然,有些模式适用于特定的语言/技术,例如 MVVM,但我认为您不是在使用 WPF 或 Silverlight 编写,是吗?对于 Web,您可以选择使用 MVC 而不是 WebForms。

关于书籍,您可以看看

因为 C# 是一个完整的 OO语言,您将必须适应 OO 设计原则和模式。

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

Because C# is a full OO language, you will have to adapt to OO design principles and patterns.

给我一枪 2024-10-12 00:31:01

我同意其他回应,即设计模式与语言无关。然而,来自 C# 背景的我发现了这本书 C# 中的设计模式 作者:Steven John Metsker,这是一本很棒的读物,并且与您相关。

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.

罪#恶を代价 2024-10-12 00:31:01

《设计模式》四人帮。

"Design Patterns" The gang of four.

谁许谁一生繁华 2024-10-12 00:31:01

我强烈推荐这个网站来了解设计模式、反模式 UML 和重构

http://sourcemaking.com/

非常好结构清晰,易于阅读!

I would highly recommend this website for design patterns, anti-patterns UML and refactoring

http://sourcemaking.com/

Very well structured and easy to read!!

初见终念 2024-10-12 00:31:01

显而易见的选择是 C# 中的设计模式 ,但我还没有读过,所以无法评论其质量。

编辑: 正如 Popo 提到的,《设计模式》这本书本身是学习设计模式的好方法,但代码不是用 C# 编写的:设计模式:可重用面向对象软件的元素

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

挥剑断情 2024-10-12 00:31:01

有几本关于设计模式的好书(有些已经提到了)。我实际上有大约四个左右。当学习一种模式时,我喜欢在不止一本书中阅读有关它的内容。通常场景和示例会略有不同,这有助于更好地理解想法。 Wikipedia.org 也是一个非常好的资源。

也就是说,我喜欢花一些时间阅读与模式相关的代码。出于显而易见的原因,显示平台优势的代码是很好的。访问时请查看 http://www.dofactory.com。如果您想了解 GoF 和其他企业模式应用于一些实际的编码问题,那么该站点非常好。您必须为参考应用程序和设计模式解决方案付费,但有一些与 Head First 书、GoF 工作以及他们所谓的利用 .NET 的优化变体相关的示例。

我发现一些有用的书:

  • Head First Design Patterns:这是一本获取想法的好书。
  • C# 3.0 设计模式 (Judith Bishop): 不是我最喜欢的对于代码示例,但是将一种模式与其他相关模式进行比较以及为什么您可能会选择一种模式通常有一些不错的观点。
  • 设计模式 (Christopher G. Lasater)一本很好的书,开门见山。

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.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文