Design Patterns: Guides and Practical Know-how | Page 17 | mironsoft Blog
Design Patterns
-
Mar 16, 2025
An ordinary Map used to associate objects with private state prevents those objects from ever being collected by the garbage collector as long as the map exists. WeakMap and WeakSet solve exactly this problem by only weakly referencing their keys, enabling private state that automatically disappears along with its associated object.
-
Mar 12, 2025
Recurring checks like if ($logger !== null) quickly spread across an entire codebase and hide the actual business logic behind defensive programming. The Null Object pattern replaces missing objects with a neutral object of the same interface that simply does nothing, instead of forcing a conditional branch.
-
Mar 6, 2025
Headless UI patterns consistently separate interaction logic from visual presentation, so teams can implement their own design without compromising keyboard control or ARIA semantics. Once you understand how custom hooks, compound components and state machines work together, many use cases no longer need an external headless library at all.
-
Mar 5, 2025
Classic responsive design thinks in fixed device widths and three or four breakpoints. Intrinsic Web Design flips that perspective: the layout reacts directly to its own content and the space actually available, with minmax, clamp, auto-fit and container queries as practical tools for this approach.
-
Feb 28, 2025
Many teams treat Kubernetes as the obvious choice as soon as more than one server is involved, yet very few applications actually justify the operational effort of a full cluster. Knowing the real signals for genuine need lets you make the decision based on facts instead of the latest conference talk.
-
-
Feb 27, 2025
An error inside an async function disappears without a trace, the console shows an unhandled rejection, an empty catch block hides exactly the problem you were looking for. Promise error handling follows its own rules, different from synchronous try catch. This article shows the concrete pitfalls and how to reliably avoid them.
-
Feb 25, 2025
Global variables and singletons feel convenient, yet they make PHP code hard to test, hard to parallelize and unpredictable in large projects. This article shows how to replace Singleton::getInstance(), $GLOBALS and static registries with dependency injection step by step, without rebuilding the whole application at once.
-
Feb 21, 2025
Controllers that write, read, transform and return data all at once are the normal state in many Symfony projects. CQRS consistently separates these responsibilities: commands change state, queries read data. The result is more maintainable, testable and scalable code.
-
Feb 19, 2025
When creating new objects is expensive, the Prototype Pattern copies an existing prototype instead. How Magento uses clone() and Factory::create(), and when you should apply it yourself.