Code quality and design

53 posts
How to integrate Elasticsearch in your Laravel App - 2024

How to integrate Elasticsearch in your Laravel App - 2024

Integrating Elasticsearch with Laravel enhances search capabilities beyond simple LIKE matches. This guide covers Elasticsearch basics, setting up a local environment with Docker, creating a demo application, and implementing Elasticsearch integration using observers and repositories.

Liskov Substitution Principle Explained

Liskov Substitution Principle Explained

The Liskov Substitution Principle is one of the five design principles that make for SOLID code, and probably one of the hardest to fully grasp. Before we dive into how we can apply it to our code, let’s take a look at the definition: In a computer program, if...

Does code need to be perfect?

Does code need to be perfect?

In the past months, I have asked myself a lot why we always strive to write perfect code. Picking up coding again for an internal project made me realise our team (and probably a large part of the rest of the software development world) spend a lot of time on...

Refactoring towards testability

Refactoring towards testability

When working on a legacy codebase, you often have to make changes in code you don’t fully understand. When this code is not tested, you’re never sure that it will still work after adapting it. And will it have unexpected effects on other parts of the codebase? As...

Avoiding Conditionals, an example

Avoiding Conditionals, an example

I didn’t like the code I wrote for a particular feature. It was “notify users when someone comments in a discussion” with these requirements: * Notify discussion author, if not the comment creator * Notify users assigned to the parent model that is associated with the discussion, except: * the discussion author...

Commands, events, global functions and testing

Commands, events, global functions and testing

The other day I was listening to the FullStackRadio episode 34 which is about dealing with dependencies in Active Record models. This is a very interesting topic and they suggest a few solutions for it. I liked the suggestions and I tried to implement it differently (first try and second...

*AwareInterfaces: simple interfaces with getter and setter

*AwareInterfaces: simple interfaces with getter and setter

Sometimes you see simple interfaces with a getter and a setter for a specific type of object. Some examples are league/event‘s EmitterAwareInterface and league/container‘s ImmutableContainerAwareInterface. Also Zend Framework 2 has a ton of *AwareInterfaces like (but not limited to) these: These packages often come with a...

Why You Should Avoid Over-Abstracting

Why You Should Avoid Over-Abstracting

Some time ago I started working on an existing project, so I read the documentation before diving in. At the top of the contributing.md file there was this sentence: “Abstract when possible”. Quickly I learned the project contained more abstract classes than a normal project. This leads to too...

You’ve successfully subscribed to madewithlove
Welcome back! You’ve successfully signed in.
Great! You’ve successfully signed up.
Success! Your email is updated.
Your link has expired
Success! Check your email for magic link to sign-in.