Blog Articles on DDD, Event Sourcing and software development in general, with a sprinkle of PHP and sarcasm.

Folder Structure and Frameworks: What is exerting control?

Recently I've been thinking about folder structures, specifically how we structure our web apps to encourage the design we want and to enable other developers to explore and understand the codebase. This train of thought was spurred by a problem we faced with one of our apps, which I'll go into shortly. ## Folders Give Context When we open up an application the folder structure is the first thing we see, even before we glance down at the readme. It conveys the hierarchy of concepts and hopefully how they relate to each other. A haphazard folder hurts more than it helps, especially if you have to hop around from folder to folder. Ch...
Read on »

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 shite? ## 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 ...
Read on »