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 ArticleKeep 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 ArticleAccessing 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 ArticleRandom 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 ArticleRepresenting 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 ArticleBeautiful 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 ArticleUbiquitous 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 ArticleLazy 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 ArticleCoping 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 ArticleCode Folder Structure
All code bases I ever read or worked with, share a similar folder structure:Controllers BlogPostControllerCommentControllerModels BlogPostModelCommentModelViews BlogPostsViewBlogPostDetailViewHelpers...
View ArticleHow 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 ArticleCasting 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 ArticleCRUD 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 ArticleDecoupling (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 ArticleUnbreakable 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 ArticleManaged 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 ArticleSystemantics - 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 ArticleSwitch - 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 ArticleFacilitating 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 ArticleAntifragile - 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
More Pages to Explore .....