Vos commentaires

Hi!

"Replace Temp with Query" is often an interim step in larger refactoring efforts aimed at simplifying and improving the design of the code. By replacing temporary variables with queries, you're not only making the code more modular but also preparing it for further refactorings that can significantly enhance its readability and maintainability. In this context, any initial increase in complexity or debugging difficulty is temporary and strategic.

As you progress with further refactorings, such as "Extract Method" or "Inline Method," the overall structure of the code becomes cleaner and more coherent, ultimately simplifying the debugging process. To minimize interim issues, focus on incremental testing and refactoring in small steps, ensuring each change preserves the functionality and improves the codebase's navigability.

Hi!

Sorry for answering in English.

Thanks for asking! I used OmniGraffle (sadly, only available on macOS) with heavily customized UML stencils.

The comics were drawn using Inkscape.

Hi!

Yes, you can print one copy for personal use as per the ebook license.

Sorry, I'm still not sure I understand your case. By stacking, I mean that each decorator may affect the outcome of the thing it decorates, and if multiple decorators are stacked together, you get a complex result. For the IsOpen() behavior each decorator would override the true/false result of the previous decorator (which, arguably, makes a little sense).

I could imagine a good case for this if your color decorators stack, and this results into a mixed color from some sort of getColor() method. So, if you have blue, and then yellow, you get the green color in the end (but I'm not sure whether it's what you want). But I have hard time understanding the case where you have color decorators and HasZombie decorator. What is the supposed behavior that is common to both?

If you can explain what you're trying to achieve without mentioning any patterns, that might be a better start of this discussion.

Why do you need Decorators? What do they "decorate"? Do their behaviors stack?