Quantcast
Channel: Mathias Verraes
Browsing all 120 articles
Browse latest View live

Interface discovery with PHPUnit’s Mock objects

PHPUnit provides some great features to create mock objects. The idea is that when you are testing code that depends on another class, you provide the object with a mock instance of that class, instead...

View Article



Keep your controllers thin with Doctrine2

Doctrine2 does such a nice job abstracting everything related to the database, that you might be tempted to do everything else in your controllers. Say we have a Bug entity:<?php/** @Entity...

View Article

Accessing private properties from other instances

In PHP, when a property or method is marked private, it can only be accessed from within that class. That includes other instances of the same class. This may seem counter-intuitive at first, because...

View Article

Random thoughts on using Git

A couple of weeks ago, I switched from Subversion to Git for a couple of smaller projects. Below are some of my findings.Switching from SubversionGit is a little harder to understand than Subversion,...

View Article

Representing Money in PHP, Fowler-style

Whenever working with values in object oriented programming, it’s often a good idea to wrap them in a ValueObject. Money is a perfect candidate for a ValueObject: When talking about money, numbers are...

View Article


Beautiful code

Code doesn’t have to be beautiful. Some of the most successful projects have the ugliest code. Marketing, features, vendor lock-in, shiny GUI’s and all kinds of real or imagined qualities are what make...

View Article

Ubiquitous Language

Customers usually have never been forced to really think about their domain in a structured way – let alone explain it in detail to a developer, who doesn’t know anything about that domain. Often the...

View Article

Lazy Loading in PHP with Closures

Closures are a great way to do all kinds of neat tricks in PHP, and they’re particularly useful for Lazy Loading. I’m currently involved in a +200k SLoC legacy project, and the challenge is moving it...

View Article


Coping with Change in Software Development

In a discussion about keeping developers motivated, someone said:“I also try as hard as I can to isolate our developers […] from out-of-spec change requests”Sticking to the plan sure allows developers...

View Article


Image may be NSFW.
Clik here to view.

Code Folder Structure

All code bases I ever read or worked with, share a similar folder structure:Controllers BlogPostControllerCommentControllerModels BlogPostModelCommentModelViews BlogPostsViewBlogPostDetailViewHelpers...

View Article

Image may be NSFW.
Clik here to view.

How to read more books

“You can’t learn everything from books”, people say. It’s nothing but an excuse not to read books. It’s a straw man argument, because no-one has ever claimed that you can. Or, “knowledge from...

View Article

Casting Value Objects to strings

I’m a big fan of Value Objects, as they are very helpful in encapsulating behavior, and communicating intent. In fact, as a friend remarked, Value Objects are the heart and soul of Object Oriented...

View Article

CRUD is an antipattern

CRUD is, as Greg Young calls it, our industry’s Grand Failure. We have deluded our users, and ourselves, that applications are nothing more than a thin layer around our database. We present the user...

View Article


Decoupling (Symfony2) Forms from Entities

I usually tell people to stay away from the Symfony2 Form component, or forms libraries in general. The problem is that all these libraries are designed in a very CRUD mindset. You’ve done all the work...

View Article

Unbreakable Domain Models

VideoSlidesAbstractData Mappers (like Doctrine2) help us a lot to persist data. Yet many projects are still struggling with tough questions:Where to put business logic?How to protect our code from...

View Article


Image may be NSFW.
Clik here to view.

Managed Technical Debt

Update 2020-01-22 I wrote a new version of this.Alberto Brandolini said at IDDD Belgium (quoting from memory):We've always explained 'technical debt' badly to the business. If you have debt with a...

View Article

Image may be NSFW.
Clik here to view.

Systemantics - The Systems Bible

Jon Jagger regularly posts snippets from books he’s read on his blog. I think this is an excellent habit, that has helped me to discover some very interesting books, so I want to start doing the...

View Article


Image may be NSFW.
Clik here to view.

Switch - How to Change Things When Change Is Hard

As I wrote earlier, I want to post some quotes and a mini-review of the books I read. “Switch” compares humans in change processes to Rider (our logical side), riding an Elephant (our emotional side)...

View Article

Image may be NSFW.
Clik here to view.

Facilitating Event Storming

Event Storming is a technique where you get the developers and the business stakeholders in a room, and visualize the business processes. You do this using stickies with domain events and causality...

View Article

Image may be NSFW.
Clik here to view.

Antifragile - Things That Gain from Disorder

What is the opposite of fragile (breaks when confronted with unexpected events)? Changes are people answer with robustness (stays the same under unexpected events). But there’s another way to look at...

View Article
Browsing all 120 articles
Browse latest View live




Latest Images