Domain Objects Without Behavior? The Case of the Anemic Domain Model

Today is a great day: you will begin to develop the new greenfield project of the soon-very-successful startup you work for as a PHP magician. You and Dave (your colleague developer) have been chosen to develop this new application. Finally you will do something else than fixing and refactoring crappy code from old PHP 4 spaghetti projects! Everything begins well. You set up the project’s backbones quickly and Dave is in charge to implement the first functionalities. »

9 min. read

PHP Code Quality Tools to Check and Improve your Code

Oh no! Your boss asked you to fix a bug which crash the company’s website on production. As quick as a jaguar you open the classes responsible of the maelstrom. They were coded by Dave, your colleague developer. The classes are full of formatting errors, poor indentation and weird one letter variables. There are so many dependencies you need to scroll down for minutes to escape the bloated constructor. »

13 min. read

The DRY Principle: Its Cost Explained with Examples

Last update: 2018-08-09 I know what you are thinking: “Again a boring article on DRY? Don’t we have enough already?”. You might be right. However I see too many developers (junior or senior) applying DRY like they are doing some witch hunting. Totally randomly or everywhere they can. So apparently we never have enough DRY principle articles on Internet. A little reminder for those in the back who don’t follow: the DRY principle means “Don’t Repeat Yourself” and was first introduced in the The Pragmatic Programmer. »

11 min. read

PHP 7.2: the Pitfalls to Avoid for a Better and Cleaner Code

What are the pitfalls to avoid with this new version of PHP and its new functionalities? As my previous article on PHP 7 scalar and return types pitfalls, instead of describing the new super cool features of this perfect PHP 7.2, I will describe what can be dangerous for the good health of your application. As Ward Cunningham stated it: “You know you are working on clean code when each routine you read turns out to be pretty much what you expected. »

6 min. read

Vim for PHP: The Complete Guide for a Powerful PHP IDE

Last update: 2018-09-18 Vim, an IDE? I can see you spitting your cereals in front of you computer. “What? A PHP IDE with Vim? Are you insane?” Am I? It’s definitely possible to make a very powerful IDE with Vim, thanks to my ex-colleague kushellig who initiated me to this dark knowledge. The list of plugins I propose here will cover most of your needs: project management, autocompletion, PHPDoc generation, powerful search and replace tools, debugger… all these features will be at your fingertips, for free! »

14 min. read