Writing on software design, PHP, and web development

All of my long-form thoughts on programming, product design, and more, collected in chronological order.

The benefits of keeping functions short

There are undeniable benefits to limiting the scope and size of our functions. I don't like to focus so much on 'keeping them short', as I believe this can often lead to decision making based on cosmetics alone, but it's a quick way to get the message across nonetheless.

PHP interfaces, what are they and when should you use them?

As a junior PHP developer, you could probably be forgiven if you have not yet stumbled across or made use of interfaces. As someone more senior, you've obviously not been keeping up. Interfaces have been around since PHP 5.0 and are now widely adopted in most well written libraries and applications. With that in mind, I'm sure you'd agree that it's worth spending a couple of minutes to figure out what an interface is and when you might consider using one.

Laravel – Selecting columns when eager loading relations

Eloquent, the ORM native to Laravel can be powerful when used in the right hands. However, if you're unaware of how things work beneath the hood you may, at times, find yourself struggling. I'm often asked questions related to how eager loading works, and selecting columns when using eager loading seems to raise a common issue.

Boost your search engine CTR with structured content

Structured content is said to be playing an ever increasing role in SEO. It's underestimated, underutilised and it's importance is growing. If you're not using it, then you're missing out on a chance to Boost to your SEO and CTR(click through rate). Oh, and the cherry on the cake is that it's reasonably straightforward to implement.

How I used the strategy pattern to tidy up some legacy code

I was recently hired to add some new functionality to an existing PHP application, built using ZF1. The application was developed quite some time ago, and parts of the code-base are slightly dated. After discussion with the client, it was decided early on that as well as adding the new functionality, I would make an effort to improve the existing code. Read on for an overview of how I achieved this.

© John Richardson Development. All rights reserved.