Let's discuss an example I got from real code on how to avoid conditionals and end up having code that is actually easier to read.
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. The result was really nice.
Less known type hints in PHP: self and parent. Why do we not use them as often? How long have they been around? Why and when are they useful?
We all know them, search pages which allow you to filter through vast data sets by checking or unchecking filters. In most cases each filter is followed by a counter which indicates how many results will be shown when you apply that filter. Those counters inform the user about their next move before they perform it.
What happens if you need to perform a large number of concurrent requests? If you don't control the number of request you might end up with a dangerously large amount of open TCP sockets to a server. Let's see how to protect ourselves from that.
As applications grow bigger and bigger, our codebase needs to accommodate for more and more business actions. After a while you will have code that impacts a large amount of business actions without knowing exactly what they are. Changes to that code become more and more stressful. We had long been feeling the need to handle this complexity of our applications in a more explicit and clearer way.