Pattern Hatching Design Patterns Applied Pdf 20

0 views
Skip to first unread message
Message has been deleted

Kian Trip

unread,
Jul 11, 2024, 5:26:26 AM7/11/24
to tlisisolde

This succinct, example-driven book empowers practicing software developers who are using design patterns, arguably today's most popular object-oriented programming concept. Design Patterns' co-author John Vlissides blends his intimate knowledge of the pattern development process with practical techniques for better pattern application. The result is a thought-provoking guide that will help you improve your next software design by putting patterns to work successfully. Pattern Hatching demystifies the fine points of patterns, placing them in the broader context of basic object-oriented design principles. It dispels many of the misconceptions about patterns that have spread in the software development communityclearly articulating what patterns are and how they ease the development process. The book also presents themes and variations on several established patterns, yielding many new insights. With the instruction in this book, you will become better able to tailor patterns to the design problem at hand.

Software developers now recognize the value of design patterns in helping build better software more efficiently. As a result, design patterns have become extremely popular in the software development community. Pattern Hatching explains and enhances the information from the seminal work in the field, Design Patterns: Elements of Reusable Object-Oriented Software. The hands-on approach offered by John Vlissides, co-author of Design Patterns, enables you to better understand the pattern development process, and therefore identify and write your own patterns. The author's insights will further allow you to apply the original 23 patterns by example.

Pattern Hatching Design Patterns Applied Pdf 20


Download https://vbooc.com/2yLW9s



This succinct, example-driven book empowers software developers who are using design patterns, arguably today's most popular object-oriented programming concept. Design Patterns' co-author John Vlissides blends his intimate knowledge of the pattern development process with practical techniques for better pattern application. The result is a thought-provoking guide that will help you improve your next software design by putting patterns to work successfully.

Pattern Hatching demystifies the fine points of patterns, placing them in the broader context of basic object-oriented design principles. It dispels many of the misconceptions about patterns that have spread in the software development community--clearly articulating what patterns are and how they ease the development process. The book also presents themes and variations on several established patterns, yielding many new insights. With the instruction in this book, you will become better able to tailor patterns to the design problem at hand.

Edit:
I'd like to add that I read DPs through "Head First Design Patterns" and although it's one of the best books to understand the pattern. I don't think I've been able to transition the Pizza examples to real world scenarios.

I think this is one of the most influential books on DP but we can still have a book that may enumerate the various popular business scenarios that demand a particular pattern alongside that pattern. This knowledge is still implicit to a large extent I think. Such a book would be a very nice quick reference don't you think :))

in 99.99% of the cases: Factory Pattern, Singleton (Like everyone I use it in many places because is simple to implement, and in practice I tend to remove it while refactoring the code). Then: Object Pool(if I have resources I want to reuse - some of my projects are games and I need a good management of resources), Strategy and Template Method (because they are great for decoupling and serve well the purpose to make the code easy to extend). Then the Adapter is something to use when you have a library you want to use, without relying on it(decoupling).

Same as Above, if I didn't use them yet. It works also in the opposite way. If I don't find the reason to use a design pattern I remove it or skip it while writing the code (it happens all the time with singleton and from time to time with factories. Sometime I use a factory which is also a singleton to provide me those which were supposed to be singletons objects; not sure if it's wise thing to do, but it works for me).

The only code hint I might think it the number of references you have to a class. You can also use PMD, jDepend and Architecture Rules to spot the places where the classes contains too many dependencies. I'm not sure it this is a coding tip. In the design phase and not only there when you decide to use a design pattern just think to the benefits. I found that Software Design Principles are extremely important to help you understand when and why (not) to use a design pattern, but they are unknown to many programmers who are using design patterns.

I'm not sure what do you mean by Micro DP. I'm trying to use DPs only when I find reasons to use them and when the benefits seem to be bigger than the problems. I avoid the overuse because it leads you to loosing time implementing and maintaining factory patterns instead of real software.

I think there is a tendency, at least for those who newly learn design patterns, to over-apply a pattern; when you have a hammer, everything starts to look like a nail. A better way to go about it is to consider the alternatives for an API and their respective advantages and tradeoffs, then select whichever is appropriate. A design pattern is more of a terminologic help that allows developers to effectively relay what they are doing than to provide a guideline of how one should write code. That is, some things recurr in code and it is easier to tell your coworker that you used a factory than to explain that you had some object that you passed around that created other objects.... but just because the notion of factories exist does not mean you should try to make everything you see into a factory. Make sense?

A Design Pattern describes a general reusable solution to a recurrent problem in a given context. You apply a pattern when you identity design problem(s) a pattern can solve. This can happen during initial design, during coding, during maintenance, etc. There is no absolute recipe, IMO.

I think it wrong approach to eiher just blindly decide on a favourite pattern, or first code and then refactor to a known pattern. When you see a problem you will have to recognize the similarity to other problems that might be solved using known patterns.

3: What patterns that are predominant depends very much on the domain. State patterns, proxies and facades are very common when doing applications that communicates alot to other systems. GUI application have different requirements, etc.

In my industry (Banking): I see a lot of the following GOF patterns: Factory Method, Singleton, Adapter, and Facade. Behaviour patterns are more or less killed by the predominant java-ee 14 layers of antipatterns that were mode du jour 10 years ago.

5: I think that the main indicator for a specific pattern is more related to the problem, and its similarity to other problems that have been solved by a particular pattern. Yes, If the code smells, that indicates that it might be needing a rewrite, and the problem should be analyzed again. While some problems are complicated, and can't be reduced, most can and a pattern may help to organize the problem a bit.

However. As a consequence of the observation that complex problems require complex solutions, thick people tend to write complex code; What out for that. Eg. State-patterns (which I am fond of) can complicate things to unimaginable levels if they are overused.

6: My collegues seems to like me, so I am probably not overdoing anything. I am myself rather annoyed by the overuse of Factories and Factory Methods in code that is not likely to change or exist in different implementations at the same time - and if it eventually will be changed, it will require a rewrite anyway. That's just a waste of time, and complicates the code and delays bug hunting.

In my experience it depends on the methodology and level of up front design as to when patterns get applied. Typically in an agile process I will see a pattern emerge fairly quickly as the intent of the code develops then refactor accordingly.

At the risk of stating the obvious unit testing alleviates a lot of the risk but the earlier you do it the better. I've never done a major refactor of code in support to implement a new pattern as the effort involved has rarely shown significant benefit. Unless the project is about to move into a new phase of development.

Most of the time I don't "apply a design pattern" one to one. They need adaption. Design patterns are like a catalog of experience. You just know some common or typical patterns and change them to the solution you need. (Note: they are patterns, not solutions.)

And you don't learn patterns to implement them, that's the wrong way, you learn then so you can talk about code with other programmers. It's more a extension to your normal language then anything else. Use it in your code when needed, but not before :-)

In my case the single best impact I got it from getting to breathe SOLID. Imho you can relate a lot of scenarios & patterns to those principles, and following an evolving code base mindset along with it usually reveals the needs for all those other patterns for you.

I have seen a program where they used the facade pattern between the GUI and logic. They considered that no objects may be transported over this, so only primitive types were used which made it difficult to code.

When you misuse it, or, sometimes worse, when you use a pattern unneccessarily. The latter drives me nuts because when I analyze a piece of code, I naturally first assume there's a reason for everything in there, and when I can't see a reason for something, the safest default assumption is that I'm missing something. And since I don't want to risk breaking code in unknown or unpredictable ways, I waste time trying to figure out why it's in there before I mess with it.

7fc3f7cf58
Reply all
Reply to author
Forward
0 new messages