Christian Carlos Buenosvinos — what a nice name BTW, Carlos “Good Wines” — has written this book on how DDD could be used within software processes where PHP is the predominant language.
The book is with Leanpub and can be found here:
https://leanpub.com/ddd-in-php
I started reading it with great motivation because I only heard good comments about the great value that DDD could be adding to any organization that either develops, maintains or evolves software.
Since I’m relearning PHP now at almost 50 years of age with the compensation that the language is at version +8 with many of its past wrinkles straightened, I thought that adding DDD to this process would only give me the right tool set to improve my skills.
Unfortunately, my excitement ended very soon as I stumbled upon a quote that put a hard stop to my reading at the first chapter.
If your application is data-centric and your use cases mainly manipulate rows in a database and perform CRUD operations — that is, Create, Read, Update, and Delete — you don’t need Domain-Driven Design. Instead, the only thing your company needs is a fancy face in front of your database.
Buenosvinos
I believe the immense majority of PHP web apps and websites around the Internet today are data-centric. And, yes, they perform CRUDs from top to bottom, left to right. PHP was this little thing at the kindergarten when it made friends with MySQL, and they grew up together since then. PHP and data: inseparable.
WordPress, right here in this website, performs CRUD all the time with its posts and pages. In fact, I’m very close to running a new Create method by clicking the red “Publish” button at the upper right corner of the screen where I’m writing this text.
CRUD, CRUD, CRUD…
So it’s confirmed by the author that I don’t need DDD with PHP and I’ll take his words as seriously as when I decided to read his book in the first place.
But, of course, before clicking the X in the browser’s tab I decided to keep reading until I could find an example. I needed a PHP non-CRUD example to make my leave; defeated.
As a gift from the heavens, I didn’t have to read much further, a couple of paragraphs down the page I saw what could be an example taking form, which happens to be this one:
In the case of an online travel agency (OTA), the problem is about dealing with things like flight tickets and booking hotels. Such a Domain can be organized into different Subdomains such as Pricing, Inventory, User Management, etc.
Buenosvinos
Hold on!
- Flight tickets? Data-driven with CRUD
- Booking hotels? Data-driven with CRUD
- Pricing? Data-driven with CRUD
- Inventory? Data-driven with CRUD
- User Management? Data-driven with CRUD
You bet most of what’s in etecetera is also CRUD.
Ok, nobody hard deletes anything these days, so maybe CRUD is a dated concept and we should be saying CRUFD instead: Create, Read, Update, Flag as Deleted.
Regardless, CRUD is all over his very first example, so I rest my case knowing that my “fancy face in front of a database” doesn’t need any DDD.
Peace ✌️
Note: this post is intended to be sarcastic fun with an example that contradicts a strong provocative argument from the authors — yes, Mr. Good Wines was not alone in this project. Christian Soronellas and Keyvan Akbary were also part of it. Good Wines was cherry picked because his surname is remarkable.