Do you use design patterns?

后端 未结 15 2221
盖世英雄少女心
盖世英雄少女心 2020-12-23 09:56

What\'s the penetration of design patterns in the real world? Do you use them in your day to day job - discussing how and where to apply them with your coworkers - or do the

15条回答
  •  一个人的身影
    2020-12-23 10:32

    In my opinion, the question: "Do you use design pattern?", alone is a little flawed because the answer is universally YES.

    Let me explain, we, programmers and designers, all use design patterns... we just don't always realise it. I know this sounds cliché, but you don't go to patterns, patterns come to you. You design stuff, it might look like an existing pattern, you name it that way so everyone understand what you are talking about and the rationale behind your design decision is stronger, knowing it has been discussed ad nauseum before.

    I personally use patterns as a communication tool. That's it. They are not design solutions, they are not best practices, they are not tools in a toolbox.

    Don't get me wrong, if you are a beginner, books on patterns will show you how a solution is best solved "using" their patterns rather than another flawed design. You will probably learn from the exercise. However, you have to realise that this doesn't mean that every situation needs a corresponding pattern to solve it. Every situation has a quirk here and there that will require you to think about alternatives and take a difficult decision with no perfect answer. That's design.

    Anti-pattern however are on a totally different class. You actually want to actively avoid anti-patterns. That's why the name anti-pattern is so controversial.

    To get back to your original question:
    "Do I use design patterns?", Yes!
    "Do I actively lean toward design patterns?", No.

提交回复
热议问题