Blog: Implementation

My thoughts on software development.

Categories

I have many interests in software development and I enjoy writing about then. As such my blog doesn't cover just one topic.

Using Factories to Write Tests: A Love Letter to Factories

Hello there and welcome to an article I've wanted to write about factories for a very long time. This article is really a love letter to the humble factory. As a pattern it could not be simpler, yet it is the most powerful and paradoxically the most underused pattern when writing tests. An ambitious statement, let's dig in and see where we get. ## What is a Factory Ok, so this seems really basic and I imagine there are a lot of rolling eyeballs right now, but let's go through the definition I'm using, just so we're all on the same page. A factory is something that creates an object in a certain state. Factories return scalar value...
Read more »

Acceptance testing your PHP app with ease

Acceptance tests are core to any stable system, they're how you make sure it actually works, start to finish (My preference is to write them first, use them a guideline to make sure the feature I'm writing works as expected). When writing acceptance tests, it's best to treat the system as a [blackbox](http://softwaretestingfundamentals.com/acceptance-testing/), inputs go in and outputs go out, that's it. This proves our app works and can be interacted with by other systems. Some frameworks come with this built in, like [Laravel](https://laravel.com/), but not every app is written in those frameworks, infact most are not (especially...
Read more »

Why I don't like traits

Traits in PHP are a bit shite. At best they are an ineffective way to append functionality to a class, at worst they are an anti-pattern. They are often used as toggles for internal functionality (see Laravel's Acceptance tests) or as a lazy way to share common functions across a bunch of classes without using another pattern. # Why are they bad? ## Reading: They're hard to read. If you see that a class uses a trait, you have to open the trait to see what it's adding to the class. Usually the trait uses protected properties of the class, this means you have to flip between the trait and the parent class to figure out the type of...
Read more »

Expert help

Have a codebase where change is expensive and risky?