Understanding Gang of Four's Facade Design Pattern

TL;DR: use Facade Design Pattern to simplify usage of a complex subsystems and reduce number of dependencies your code has

During recent Design Patterns training I've attended at Inviqa (delivered by @_md) we had quite emotional discussion about differences between Facade and Adapter patterns (which are intuitively different but it was hard to understand why). This discussion led me to this blog post and I'd like to summarise our conclusions.

Read More

Scaling Symfony2 apps with RabbitMQ

Dealing with resource-consuming tasks in PHP can affect performance or even make you lose money because of poor user experience. Fortunately there are strategies for dealing with such problems and one of these is queueing.

In this session we will focus on what RabbitMQ is, how it works, how we can use it with PHP and integrate it with Symfony2 applications. After this talk you will have an idea of where you can apply queues in your system, and then make them fly and scale!

Read More

Dealing with floating-point calculations in PHP

Long time ago – while learning PHP – I found the following piece of code:

echo intval((0.1+0.7)*10); // int(7)

and then I forgot about it. And while I can understand that the above code returns the number 7 instead of 8, the knowledge and memory of this is critically important while performing any arithmetic calculations.

Read More