Fernando Castillo·Jan 12, 2025Things I like about encapsulation: levels of understandingEncapsulation is a good technique to optimize our code for reading.A response icon3A response icon3
Fernando Castillo·Oct 20, 2024Please don’t: using the same models for write and read in PHPIs it a good idea to use the same model that you use to write data also for reading data?A response icon16A response icon16
Fernando Castillo·Oct 8, 2024Why I prefer service objects over higher order functions in PHPIn PHP, there are different ways in which some code can invoke a capacity defined somewhere else. Reasons for doing that may include…A response icon1A response icon1
Fernando Castillo·Sep 11, 2024Simulate function overloading in PHP with Union TypesFunction (or method) overloading allows multiple implementation for the same function name given different arguments. PHP does not allow…A response icon1A response icon1
Fernando Castillo·Aug 25, 2024Php and Postgres team up to optimize multi-insertsIn some scenarios you need to insert more than one row in a table. Maybe in more than one table. Typical techniques require sending a…A response icon1A response icon1
Fernando Castillo·Aug 8, 2024Please don’t: over complicating array translation in PHPThis code example based on a real case shows an attempt to solve a problem in a way that appears to anticipate a complication that wasn’t…
Fernando Castillo·Aug 4, 2024Postgres: type casting for writing better queriesA cast in Postgres is a specification of a conversion between two types. Postgres packs some casts out of the box, like converting integer…
Fernando Castillo·Jun 9, 2024Factory Pattern can encapsulate complexity in PHPSometimes I hear comments against the Factory Pattern, meaning that it just introduces complexity with no real value, and I want to explore…
Fernando Castillo·Jun 1, 2024Extend your Symfony Console app with events and attributesYou can easily build a console application using the Symfony Console component, but did you know that you could extend it just as easily?
Fernando Castillo·May 19, 2024Value Objects in PHP can protect you from bad dataOne of the things that we need to care about when working with object oriented programming is that the data we are working with is valid at…A response icon5A response icon5