The power of contributing to OSS ⌨️

What is Open-Source Software (OSS)? 🤔

OSS shares similarities with free software but it’s not the same.

Free software is a form of OSS, but that doesn’t necessarily mean that it has to be free. For example:

  • PHPUnit is an example of OSS which is free.
  • Spryker is an example of OSS which is not free.

OSS is basically software that is public, open to the world.

Benefits — for a company 🛕

  • Adoption: the easier the access, the easier the adoption.
    Training and tutorials help the system to grow.
  • Tech: often on the cutting edge of technology.
    Tech moves fast. They will get obsolete if they don’t.
  • Community: the people around…

Why choosing when you can have both?

Pull Requests

A Pull Request (PR) is basically a way of showing your suggested code changes such that they are easily comparable with the existing source code. This is part of a workflow that helps developers to share knowledge about the changes that are being done within the system.

A Pull Request is the moment where you ask your peers to review and check out your code changes.

Usually, it’s also used:

  1. For discussions about code style.
  2. To spot potential bugs.
  3. For architectural or design discussions once the solution is done.

The main problem with these topics above is that PR’s are…

Who moved my cheese?🧀

Published in 1998 and I just read it at the beginning of 2021. Better late than never. Actually, thanks to my brother Jesús, who recommended it to me.

The book Who moved my cheese? presents a tale inside the main story that consists of four characters: two mice, Sniff and Scurry, and two little persons, Hem and Haw.

They live in a Maze (that represents one’s environment) and in order to survive they need to go out of their comfort zone and look for cheese (which represents happiness and success).

The tale starts when both groups end up at “Cheese…

The new functional language. Fully interoperability with PHP 🚀

The Phel Language

Phel is a Functional Programming (FP) language that compiles to PHP. It is a dialect of Lisp inspired by Clojure and Janet.


  • Built on PHP’s ecosystem
  • Good error reporting
  • Different Datastructures (Arrays, Tables, and Tuples)
  • Macros
  • Recursive functions
  • Powerful but simple Syntax
  • REPL

Why Phel?

Phel is a creation of Jens Haase and, as he mentions on the website, “it is the result of many failed attempts to do functional programming in PHP”. He was looking for something with these characteristics:

  • A LISP-inspired
  • Functional Programming language
  • That runs on cheap hosting providers
  • And is easy to write and debug

From my point…

How to escape the mocking hell

What is actually happening when we create a mock? Which types of mocks are there? Is mocking good or bad? Well, as always, everything depends on the context. And here we will consider some of the main situations about when to mock and when not to mock, but especially why.

What happens when you mock something?

First of all, we should define what a mock is:

In a unit test, mock objects can simulate the behavior of complex, real objects and are therefore useful when it is impractical or impossible to incorporate a real object into a unit test.

Mocking makes sense in a unit testing

Another way of sharing quick suggestions with your team

You are reviewing a Pull Request (PR) and you see some minor improvements or suggestions that you would like to share with the author. You might write some comments, and usually, that would be sufficient.

But imagine that in order to transmit your “whole idea” you would need to change some files because just communicating the full picture will end up in a huge comment which might be not as clear as it could be.

Well, there are multiple options.

The spread operator to the rescue.

Flattening a one-level array

I have seen people using the array_merge function in a loop like:

$lists = [
[1, 2],
[3, 4],
[5, 6],
$merged = [];foreach($lists as $list) {
$merged = array_merge($merged, $list);
// $merged === [1, 2, 3, 4, 5, 6];

This is a very bad practice because it’s a (memory) performance killer!

Instead, you should use the spread operator (in PHP since 5.6!):

$lists = [
[1, 2],
[3, 4],
[5, 6],
$merged = array_merge(...$lists);
// === [1, 2, 3, 4, 5, 6];

What if you had an assoc-array instead like this one?

$lists = […

An alternative to the missing feature in PHP: Generics

The perfect combination

Having a class, `Customer`:

* @psalm-immutable
final class Customer
// Using PHP 8 constructor property promotion
public function __construct(
public string $name,
) {}
// We create a list of 6 customers
$customers = array_map(
fn(int $i): Customer => new Customer("name-{$i}"),
range(1, 6)

Whenever we want to manipulate a…

How to focus and have self-discipline

The Pilsum Lighthouse, on Germany’s North Sea coast.

No goal should be an achievement on its own, but the process itself that helps us to go in the direction of these goals.

Goals, in business and in life in general, should be conceived as directions, where their real intention is to help us accomplish more in the way we planned or want.

If we get rewarded only for results and not for processes, we will become pretty miserable.

Society doesn’t reward the journey, but the results. And that’s exactly part of the problem when you are too focused on how society acts on you. Of course, it’s important…

How to write proper unit tests to already written code.

These tests are also known as Characterization tests.

A characterization test describes the actual behavior of an existing piece of software, and therefore protects existing behavior of legacy code against unintended changes via automated testing. This term was coined by Michael Feathers.

They enable and provide a safety net for extending and refactoring code that does not have adequate unit tests. A test can be written that asserts that the output of the legacy code matches the observed result for the given inputs.

How to start?

These are my learnings one year after reading Working Effectively with Legacy Code and applying it to…

Jose Maria Valera Reales

Aka: Chema. I love what I do: software, music, and sport, but here I write mostly about software.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store