Revisiting Domain Driven Design

Focusing on the wrong chapter Let’s start with a groundbreaking(?) discovery. Concepts like “Entities”, “Value Objects”, “Repositories”, “Services”, referred as tactical patterns in DDD, are not discovered or originally proposed by DDD. They exist in the world of OOP before DDD[1]. The significant contribution of DDD is that it is enabling us to first think…

Design Patterns in Action: Decorator and Symfony Lock component.

Today, we have a look inside the symfony/lock component. As stated in https://symfony.com/doc/current/components/lock.html , “The Lock Component creates and manages locks, a mechanism to provide exclusive access to a shared resource.” The given example describes the idea: $factory = new LockFactory($store); $lock = $factory->createLock(‘pdf-invoice-generation’); if ($lock->acquire()) { // The resource “pdf-invoice-generation” is locked. // You…

Queueing with SKIP LOCKED

In 2018, at last, MySQL (version 8) decided to add support to the famous “SKIP LOCKED” feature. Other RDBMS like Oracle and SQL Server support this feature for more than 15 years and PostgreSQL added support in 2016. If this is the first time you hear about this, it is a flag that tells the…

Passing…Traits

Let’s start with a definition: “a trait is a concept used in object-oriented programming, which represents a set of methods that can be used to extend the functionality of a class” (Wikipedia) So, a set of methods. No properties. No extra state representation. After all, as you may know, this is the fundamental difference between…

Removing code literals

Every piece of software contains literals (usually numbers, strings or booleans). These are values related to application configuration, parts of the business logic, natural or language constants, etc.. We have learned to replace many of these values with variables, constants or function calls for various reasons (security, manageability, readability, expressivity,…), which we are not going…

A long cheatsheet for Redis

Setting up Redis: (on Ubuntu 16.04) Install Redis server apt-get install redis-server Enable Redis as service (start on system boot) systemctl enable redis-server.service Note:  The service configuration can be found at: /etc/systemd/system/redis.service There you can see that Redis will be running as user redis: User=redis Group=redis The Redis server will always restart after reboot: Restart=always…