Who is this article for? This post is for people that do day-by-day busywork coding, and for team leads that want to direct their peers towards better logging practices. Note that this article comes from my regular need to present these exact points to different people, multiple times a year, in multiple teams, in multiple companies. Also, we will not talk about how to configure a PSR-3 logger, but rather how to use one. Handling errors properly Error/exception handling is the main use-case for logging. When logging exceptions, please pass the Throwable instance to the 'exception' context…
I'm back! The last time I blogged was in 2017: a lot has changed since then, and after a decade of ignoring blogging, I will attempt to put some regularity into it again. The times call for it: having a personal space that is really "our own" is extremely important, and it is as important as having something to read that is written by other humans, and not slop. I mainly stopped blogging for two reasons: Wordpress and similar tools are terrible, for rarely changing content. I'd rather not blog, than host a dynamic website just for serving static webpages My static site generation pipeline…
Today we're talking about Visual debt in our code. As an introduction, I suggest to watch this short tutorial about visual debt by @jeffrey_way. The concept is simple: let's take the example from Laracasts and re-visit the steps taken to remove visual debt. interface EventInterface { public function listen(string $name, callable $handler) : void; public function fire(string $name) : bool; } final class Event implements EventInterface { protected $events = []; public function listen(string $name, callable $handler) : void { $this->events[$name][] = $handler; } public function fire(string…
I've been using a YubiKey Neo for a bit over two years now, but its usage was limited to 2FA and U2F. Last week, I received my new DELL XPS 15 9560, and since I am maintaining some high impact open source projects, I wanted the setup to be well secured. In addition to that, I caught a bad flu, and that gave me enough excuses to waste time in figuring things out. In this article, I'm going to describe what I did, and how you can reproduce my setup for your own safety as well as the one of people that trust you. Yubi-WHAT? In first place, you should know that I am absolutely not a security…
Some time ago, I was asked where I put I/O operations when dealing with aggregates. The context was a CQRS and Event Sourced architecture, but in general, the approach that I prefer also applies to most imperative ORM entity code (assuming a proper data-mapper is involved). Scenario Let's use a practical example: Feature: credit card payment for a shopping cart checkout Scenario: a user must be able to check out a shopping cart Given the user has added some products to their shopping cart When the user checks out the shopping cart with their credit card Then the user was charged for the…
ProxyManager 2.0.0 was finally released today! It took a bit more than a year to get here, but major improvements were included in this release, along with exclusive PHP 7 support. Most of the features that we planned to provide were indeed implemented into this release. As a negative note, HHVM compatibility was not achieved, as HHVM is not yet compatible with PHP 7.0.x-compliant code. As of this release, ProxyManager 1.0.x switches to security-only support. Planned maintenance schedule ProxyManager 2.x will be a maintenance-only release: I plan to fix bugs until January 29, 2017 I plan to…
PRE-REQUISITE: Please note that this article explains complexity in internal ORM operations with the Big-O notation. Consider reading this article, if you are not familiar with the Big-O syntax. What is hydration? Doctrine ORM, like most ORMs, is performing a process called Hydration when converting database results into objects. This process usually involves reading a record from a database result and then converting the column values into an object's properties. Here is a little pseudo-code snippet that shows what a mapper is actually doing under the hood: reflectionFields(); foreach…
TL;DR: Make your classes always final, if they implement an interface, and no other public methods are defined In the last month, I had a few discussions about the usage of the final marker on PHP classes. The pattern is recurrent: I ask for a newly introduced class to be declared as final the author of the code is reluctant to this proposal, stating that final limits flexibility I have to explain that flexibility comes from good abstractions, and not from inheritance It is therefore clear that coders need a better explanation of when to use final, and when to avoid it. There are many other…
Today I finally released version 1.0.0 of the ProxyManager Noticeable improvements since 0.5.2: Windows path length limitations are now mitigated Proxy classes are now re-generated when the library version changes Documentation has been moved to github pages (Markdown documentation will be kept in sync) It is not possible to trigger fatal errors via code-generation anymore Planned maintenance schedule ProxyManager 1.x will be a maintenance-release only: I plan to fix bugs until December 11, 2015 I plan to fix security issues until December 11, 2016 No features are going to be added to…
Read at the source
Your visit, your choice.
Optional Google Analytics helps us understand visits. Microsoft Clarity records masked interactions to improve the site. Optional tools stay off unless you choose them. Privacy details.