MSI – Multi Source Inventory: source selection algorithm, custom SSA
Multi Source Inventory (MSI) is one of the largest refactorings in Magento 2 history – introduced in version 2.3. Instead of a single global stock state, products can have stock in multiple sources (warehouses, physical stores, dropshipping). The Source Selection Algorithm decides which source to fulfil the order from. I show the MSI architecture, how the default algorithm works, and how to write a custom one.
- Published in Magento / Adobe Commerce
Flyweight pattern – object sharing, instance cache, Magento 2
Flyweight is a structural pattern that minimises memory usage by sharing as much data as possible between similar objects. Instead of creating thousands of objects with repeated data – you create one object and references to it. In Magento 2 this pattern appears in many places: translations, store configuration, EAV objects. I show an implementation from scratch and how to recognise it in existing code.
- Published in Wzorce projektowe
Skip List – probabilistic data structure O(log n), PHP implementation
Skip List is a probabilistic data structure invented by William Pugh in 1990. It combines the simplicity of a singly linked list with the performance of a binary tree – search, insert and delete operations run in O(log n) on average, without the need for balancing like AVL or Red-Black Trees. Rarely used in PHP, but it illustrates perfectly how randomness can replace complex balancing algorithms.
- Published in Algorytmy
Git course #7 – debugging and rescue: bisect, reflog, reset vs revert
Every developer eventually breaks something in a repository. Good news: Git rarely loses data permanently – reflog records every HEAD change. Bisect cuts hours of regression hunting to minutes. Reset has three modes and mixing them up causes pain. Revert is the safe alternative on public branches. This post is the rescue map.
- Published in Other
