Avoiding Setter Injection

PHP more or less has two kinds of dependency injection available: constructor injection, and setter injection.

Constructor injection is the process of injecting dependencies through the constructor arguments, like so:

(more…)

Thursday, October 11th, 2018 @ 9:00 am | Comment (2) | Categories: PHP

User Experience Matters

User experience matters.

Nowhere is this clearer than in the case of the accidental missile launch warning that was sent to all of Hawaii.

Here’s a copy of the the actual screen that was used by technicians to send out alerts of various types:

(more…)

Wednesday, February 7th, 2018 @ 2:22 pm | Comments (0) | Categories: PHP, Usability, Web Design

Don’t write useless unit tests

The other day I came across the following code in a project:

class Users
{
    public function __construct(PDO $pdo)
    {
        $this->pdo = $pdo;
    }

    public function getAllUsers()
    {
        $stmt = $this->pdo->prepare('SELECT * FROM users');
        return $stmt->fetchAll();
    }
}

(more…)

Tuesday, January 16th, 2018 @ 9:00 am | Comment (7) | Categories: PHP, Testing

What version of PHP should my package support?

Everybody likes “the new hotness.” Everyone loves a new car, or a new computer, or the state-of-the-art video gaming console. It’s why people camp out for days to get their hands on a new iPhone, when they could just buy one the next week off the shelf. People love to have the hot thing, right now.

Perhaps, then, it shouldn’t be so surprising that people get tremendously excited when a new version of PHP comes out. People look forward to the new features, whether they be the trailing commas in list() syntax or counting of non-countable objects.

(more…)

Tuesday, January 9th, 2018 @ 9:00 am | Comments (0) | Categories: Open Source, PHP

On PHP’s Best Practices

When it comes to best practices, there’s always a healthy debate, and that’s never more true than in the PHP community. The “best practices” that have been written about, agreed upon and talked about don’t exist out of thin air, but are hard-won knowledge derived from experience, plus a little bit of not following best practices.

I want to talk a little bit about what PHP’s best practices are, where they come from, how you can get involved in the next generation, and the best way to use best practices in your day-to-day coding.

(more…)

Friday, July 7th, 2017 @ 9:35 am | Comments (0) | Categories: PHP

Help! My team is full of junior programmers!

Hiring is perhaps the most challenging thing that any manager can ever do. Getting it right is half skill, half luck. Making a good decision on a candidate can be the difference between moving the project forward and setting it back.

So what happens when you’re hoping to hire mid-level or senior engineers, and you end up with a staff of juniors? This isn’t all that uncommon a problem; I’ve seen it at least a dozen times in my career. What do you do next?

(more…)

Tuesday, April 11th, 2017 @ 8:00 am | Comments (0) | Categories: PHP

« Older Entries Newer Entries »

Copyright © 2022 by Brandon Savage. All rights reserved.