Template Method – algorithm skeleton, hooks, abstract vs hook, comparison with Strategy
Template Method defines the skeleton of an algorithm in a base class and lets subclasses fill in specific steps. It is the backbone of inheritance-based extensibility – and one of the most widely used patterns in frameworks like Magento 2, Symfony and Laravel. I show the classic GoF implementation, the difference between abstract steps and hooks, and a comparison with Strategy.
- Published in Wzorce projektowe
MSI – Source, Stock, SSA, custom algorithm, migrating from legacy API
Multi Source Inventory replaced the old single-stock Magento inventory system. MSI introduces Sources (physical locations), Stocks (virtual aggregations), and Source Selection Algorithms (how to fulfil orders). Most shops use only default configurations, but once you have multiple warehouses or need custom fulfilment logic, MSI requires deep understanding. I show the architecture and how to write a custom SSA.
- Published in Magento / Adobe Commerce
Quicksort – variants, Introsort, benchmark vs native sort()
Quicksort is the most widely used sorting algorithm in practice – it is the basis of PHP’s built-in sort(), most standard library implementations, and many database engines. I show the classic recursive implementation, the three-way partition variant for arrays with many duplicates, and benchmark it against PHP’s native sort() and usort() to see when writing your own makes any sense at all.
- Published in Algorytmy
Custom payment method – authorize/capture/refund, JS renderer, PCI DSS
Building a custom payment method in Magento 2 is one of the more complex integrations you can do on the platform. It touches frontend JavaScript, backend PHP, REST API configuration, and security requirements. I walk through the complete implementation – authorize, capture, refund, the JS renderer for checkout, and PCI DSS considerations.
- Published in Magento / Adobe Commerce
