Right now I’m reading Design Patterns and Best Practices in Java by Kamalmeet Singh, Adrian Ianculescu and Lucian-Paul Torje, a very good book that explains the multitude of design patterns that the Java language has and some best practices in Java. During development I’m already used to identify opportunities and use creational patterns such as Singleton, Factory and Builder. However, I never really read a book listing design patterns like that, which was always a point of worry for me as a developer and I’m trying to fix that now to evolve even more in my development skills.
However, advancing through the reading one question arose, principally regarding the behavioral patterns I’m reading right now. The book is very clear in the explanation of what the patterns do, examples and applicability, but there is the old saying: “it is easier said than done”. In my opinion it should feel natural, you cannot write code trying to find excuses to use X or Y design pattern. How developers develop this kind of habit? How they know that, looking to a problem, that they should use, for example, observer pattern or mediator pattern, without resorting to a book to remember their use cases? Is it just a matter of experience? How to gain experience without falling into excessive use of patterns?
My familiarity with creational patterns comes from its solid use in Java itself and many famous libraries, I saw that they were convenient and started to use them myself. However, creational patterns are much more concrete and easily identifiable than behavioral patterns. It sounds hard to do the same natural process that I did with creational patterns.
What did you people do to make it natural, if anything at all? Should I worry about it that much? What are the most important patterns that you think it is necessary to know to apply on the fly? I’m looking forward to your points of view in this subject that are always in vogue in the development community. 🙂
暂无评论内容