程序员必须/应该知道的模式和原则列表是什么?

发布于 2024-09-03 07:56:15 字数 152 浏览 1 评论 0 原文

我已经编码了几年,但仍然觉得我的知识还不够广泛,不足以成为一名专业人士。我研究过一些与设计模式相关的书籍,但我知道还有很多其他的。

那么有人可以列出您认为有利于成为更好、更专业的程序员的模式和原则吗?

我使用的编程语言:C#、Ruby、Javascript。

I have been coding for a few years and still feel that my knowledge is not broad enough to become a professional. I have studied some books related to design patterns, but I know there are many others.

So could somebody list the patterns and principles which you think are good to learn to become a better programmer and more professional?

Programming Languages I work on: C#, Ruby, Javascript.

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

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

发布评论

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

评论(8

你列表最软的妹 2024-09-10 07:56:15

设计模式的百科全书式知识不会让你一事无成。大量的经验应用它们将会。这将教您何时使用它们以及何时不使用它们。

也就是说,最初的设计模式书仍然是我的最爱之一。在进行过程中选择其他模式。

Encyclopedic knowledge of design patterns will get you nowhere. Plenty of experience applying them will. This will teach you when to use them and when not to.

That said, the original Design Patterns book is still one of my favorites. Pick up other patterns as you go along.

独守阴晴ぅ圆缺 2024-09-10 07:56:15

原则是我开始的地方,模式紧随其后。

原则:有一个完整的木筏,但这些是我从中获得实际里程的:

其中很多(当组合在一起时)被称为SOLID(面向对象设计)。

模式:

  • 我最喜欢的是依赖倒置原则 (DIP),也众所周知作为(或至少非常类似于)控制反转 (IoC)。它非常适合抽象出接口背后的数据访问实现。 Martin Fowler 称其为不同的名称(抱歉,我面前没有我的《企业应用程序架构模式》副本)。
  • 延迟加载也很有用。
  • 工厂模式是一种众所周知的模式 - 这是有充分理由的。
  • 外观模式也帮助我摆脱了麻烦。

维基百科有一个非常好的软件设计模式列表,假设您还没有见过它然而。

最后要记住的是,存在三种基本类型的模式(加上第四类多线程/并发);了解这些类别并在做某事时牢记它们会有所帮助,它们是:

  • 创造
  • 结构
  • 行为

The principles is where I'd start, with the patterns being a close second.

Principles: There's a whole raft, but these are the ones I get practical mileage from:

A lot of these (when grouped together) are known as SOLID (object-oriented design).

Patterns:

  • My biggets favourite by a mile is the Dependency Inversion Principle (DIP), also commonly known as (or at least very similar to) Inversion of control (IoC). It's really good for abstracting out data access implementations behind interfaces. Martin Fowler calls it a different name (sorry don't have my copy of 'Patterns of Enterprise Application Architecture' in front of me).
  • Lazy Load is also useful.
  • Factory pattern is a very well known one - for good reason.
  • Facade pattern has also helped me keep out of trouble.

Wikipedia has a pretty good list of Software design patterns, assuming you haven't seen it yet.

A final thing to keep in mind is that there are three basic types of patterns (plus a fourth category for multi-threaded / concurrency); it can help just to know about these categories and to bear them in mind when you're doing something, they are:

  • Creational
  • Structural
  • Behavioral
少年亿悲伤 2024-09-10 07:56:15

我目前正在学习/努力提高我的整体编码能力的一些更独立于语言的技能。

  • 编写干净、可读和可维护的代码
  • 重构面向
  • OOP 语言的正确对象设计
  • 正确使用正确的源代码控制系统。 Sourcesafe 不算数 :D
  • 单元测试 &测试驱动开发
  • 正确应用设计模式。学习它们是一回事,学习何时何地应用它们则要棘手得多。

一些书籍推荐问题的链接@SO:

当然,还有前面评论中提到的实用程序员书籍

Some of the more language-independent skills that I'm currently learning/working towards to improve my coding as a whole.

  • Writing clean, readable and maintainable code
  • Refactoring
  • Proper object design for OOP languages
  • Using a proper source control system correctly. Sourcesafe doesn't count :D
  • Unit-testing & test-driven development
  • Applying design patterns correctly. Learning them is one thing, learning when and where to apply them is much trickier.

Some links to book recommnendation questions @ SO:

And of course, the Pragmatic Programmer books as mentioned in the earlier comment.

总以为 2024-09-10 07:56:15

掌握工具(例如编程范例、模式、源代码控制、单元测试...)是必不可少的,但仅仅称自己为“专业”还不够:恕我直言,真正专业程序员的标志是能够理解她的客户需要。不幸的是,这种知识很难从书本上学到。

Mastering tools (e.g. programming paradigms, patterns, source control, unit tests...) is essential, but it's not enough to call yourself a "professional": IMHO, the mark of a truly professional programmer is the ability to understand what her client needs. Unfortunately, this kind of knowledge is very hard to learn from a book.

月光色 2024-09-10 07:56:15

我认为最好的方法是学习大量的语言。
LISP、Scheme、Python、Smalltalk、Erlang、Prolog、Eiffel 等

并用它们构建东西。

I think the best way is to learn plenty of language.
LISP, Scheme, Python, Smalltalk, Erlang, Prolog, Eiffel and many others

And build stuff with them.

大姐,你呐 2024-09-10 07:56:15

Martin Fowler 的企业应用程序架构模式,用于与其他开发人员建立共享词汇表(例如存储库、活动记录、领域模型、工作单元)。

Douglas Crockford 的 Javascript:优秀部分,真正了解 Javascript 的工作原理。

我真的建议进入 TDD(测试驱动开发)。有很多很好的 TDD 书籍,但如果您正在进行棕地开发(我们大多数人都是这样),那么我真的会推荐 Michael Feather 的 有效处理旧代码

最后,这本书向您展示了如何重构和干净的代码:
Bob 叔叔的简洁代码

Martin Fowler's Patterns of Enterprise Application Architecture to build up a shared vocabulary with other developers (e.g. Repository, Active Record, Domain Model, Unit of Work).

Douglas Crockford's Javascript: The Good Parts to actually understand how Javascript works.

And I'd really recommend getting into TDD (Test Driven Development). There are a bunch of good TDD books but if you are doing brownfield development (which most of us are) then I'd really recommend Michael Feather's Working Effectively with Legacy Code.

And finally the book that shows you just how refactored and clean code can be:
Uncle Bob's Clean Code.

孤凫 2024-09-10 07:56:15

除了编写代码之外,您还应该尝试阅读代码。例如,从开源项目下载代码,尝试修改它并了解它在做什么以及为什么。
或者尝试查看您自己以前项目中的代码。现在你会采取什么不同的做法?您还能理解为什么要这样做吗?

您可能还想研究敏捷社区中的一些实践。尤其是 测试驱动开发 是提高代码质量的好方法。

In addition to writing code you should also try reading code. For example, download code from open source projects, try to tinker with it and understand what it's doing and why.
Or try reviewing your own code from a previous project. What would you do differently now? Can you still understand why you built it the way you did?

You may also want to look into some of the practices that have come out of the agile community. Especially Test Driven Development comes to mind as a great way to improve the quality of your code.

红颜悴 2024-09-10 07:56:15

我认为,
《Head First Design Pattern》一书中描述的所有模式都是设计师/程序员必须了解的最低限度。我建议从这本书开始学习设计模式。
另一本书《设计模式工作手册》也很好练习。

I think,
All the patterns described in the book Head First Design Pattern are the minimum that a designer/programmer must know. I suggest this book to start learning design patterns.
Another book, Design Pattern Work Book is also good to practice.

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