Misused design patterns

前端 未结 15 1459
故里飘歌
故里飘歌 2021-02-01 19:54

Are there, in the canonical Gang of Four list, any design patterns that you often find misused, misunderstood or overused (other than the highly debated Singleton)? In other wor

15条回答
  •  深忆病人
    2021-02-01 20:42

    I just wanted to add another comment after seeing some of the "All patterns are bad" answers.

    If you are a half decent programmer working on moderately challenging problems, nearly all the patters should have presented themselves to you at one point or another as the "Obvious" solution to a problem.

    The only real point of the Design Patterns book was to put names to what we all do every day so we could communicate better.

    I suppose if you are a newish programmer, it would be very helpful to read through them so that the day you need one you don't have to figure it out on your own, it's already in your toolbox, but in general--any of these could be figured out by a Gang of One (anyOne!).

    If there are any of these you didn't already know, you probably just never needed it.

    It is pretty useful to put names to the patters and formalize them a little though, I'm not complaining about the book at all. If you don't see the occasional need for nearly all of the patterns here, you just aren't working on very hard code (or you duplicate code a lot, something I consider THE cardinal sin).

提交回复
热议问题