Page 10 - Design Patterns
-
Maxim Mironjuk
-
August 18, 2025
While oklch() and lab() describe self-contained color models, the generic color() function opens CSS up to a whole set of named color spaces, including display-p3, a98-rgb, prophoto-rgb and rec2020. Anyone wanting to render product photos or brand colors faithfully on modern displays with a wider color range has to deal with this function, but also needs a clean fallback for older screens and browsers.
-
Maxim Mironjuk
-
August 18, 2025
Magento's DI container creates shared objects by default, and that is singleton behavior. Where it is useful, where it causes problems, and how to cleanly refactor legacy singletons.
-
Maxim Mironjuk
-
August 14, 2025
Slot based component APIs replace a component's root element with exactly one passed child element instead of inserting an extra DOM element. Radix popularized this approach under the name asChild, but the underlying slot component can also be built yourself in a few lines without any third party library.
-
Maxim Mironjuk
-
August 13, 2025
Anyone who wants to understand order numbers, invoice numbers, or custom entity IDs in Magento 2 cannot avoid sequence tables: dedicated single-column tables that atomically reserve AUTO_INCREMENT values while being completely decoupled from the internal primary key of the entity table. This article explains the architecture of sequence_meta and sequence_profile, shows a custom sequence table for a custom entity via db_schema.xml and a data patch, and provides concrete SQL commands for diagnosis and repair in production.
-
Maxim Mironjuk
-
August 13, 2025
The Registry Pattern was omnipresent in Magento 1 and is deprecated in Magento 2. When it made sense, which problems it causes and what you should use instead.
-
Maxim Mironjuk
-
August 08, 2025
The hexagonal architecture, also known as Ports and Adapters, frees the domain logic from coupling to frameworks, databases, and external services. In Symfony it can be implemented precisely with PHP interfaces as Ports and Symfony services as Adapters: fully testable domain code without a single framework import in the core logic.
-
Maxim Mironjuk
-
August 03, 2025
Higher Order Functions treat functions like any other value: they get passed around, returned, and composed at runtime. In PHP 8.4 this replaces loops, conditionals and boilerplate with clearly named, reusable building blocks, without needing an extra framework.
-
Maxim Mironjuk
-
August 01, 2025
Signals are a reactivity pattern that Vue, Solid, Preact and Angular implemented independently of each other, yet all rely on the same few building blocks. Anyone who understands how a minimal signals system built from getters, setters and automatic dependency tracking works can use reactivity in any vanilla JavaScript project, with no framework dependency at all.
-
Maxim Mironjuk
-
July 27, 2025
As soon as more than one product uses the same Tailwind design system, every change to tokens or components becomes a potential breaking change for someone else's code. Semantic versioning, a maintained changelog and clear deprecation periods turn a risky update into a planned, communicated step.
-
Maxim Mironjuk
-
July 26, 2025
A fluent interface is supposed to make code more readable, yet in practice it often ends up as a chain that is hard to debug and has no clear error path. With return $this, careful type safety between self and static, and immutability, you can build a fluent interface that actually makes method chaining safe instead of just making it look elegant.
-