PHPNews

Avoid Dependency Injection

At least, avoid it when building DDD Aggregates: Dependency injection of a Repository or a Domain Service into an Aggregate should generally be viewed as harmful. The motivation may be to look up a dependent object instance from inside the Aggregate. The dependent object could be another Aggregate, or a number of …

Continue reading »

Written by Paul M. Jones - - Aggregated on Tuesday December 5, 2017


Choose Dependency Injection — If You Can

Some people say, “You don’t need to use dependency injection for everything. Sometimes dependency injection is not the best choice.” It occurs to me that the people who say this are the ones who can’t use it for everything. They say “choose what’s best for your situation”, but their situation precludes the use of …

Continue reading »

Written by Paul M. Jones - - Aggregated on Tuesday October 17, 2017


Atlas.Orm 2.0 Is Now Stable

I am very happy to announce that Atlas , a data-mapper for your persistence layer in PHP, is now stable for production use! There are no changes, other than documentation updates, since the beta release two weeks ago. You can get Atlas from Packagist via Composer by adding … "require": { …

Continue reading »

Written by Paul M. Jones - - Aggregated on Tuesday October 17, 2017


A Few Right Ways, But Infinitely More Wrong Ways

A response to the saying: “There’s no one ‘right’ way to do things. There are different ways of doing something that are ‘right’. So stop criticizing my chosen way of doing things — you cannot prove that it is wrong.” For any question, there is a certain number of right answers, but an infinite number of wrong ones. …

Continue reading »

Written by Paul M. Jones - - Aggregated on Tuesday October 10, 2017


Atlas.Orm 2.0.0-beta1 Released

I am very happy to announce that I have just released 2.0.0-beta1 of Atlas , a data mapper for your SQL persistence model. You can get it via Composer as atlas/orm . This new major version requires PHP 7.1 and uses typehints, but best of all, it is backwards compatible with existing 1.x generated Atlas classes! I. …

Continue reading »

Written by Paul M. Jones - - Aggregated on Tuesday October 3, 2017


Quality: Program vs Product

I. Why it is that programmers and their employers have different attitudes toward the quality of a project? Thinking of myself as a programmer, I have sometimes formulated it like this: The programmers who do the work are usually the ones who care more about “quality.” Why? They have a reputation to …

Continue reading »

Written by Paul M. Jones - - Aggregated on Tuesday September 26, 2017


“Before” (not “Beyond”) Design Patterns

(N.b.: This has been languishing at the bottom of my blog heap for years; time to get it into the sun.) The 2013 article Beyond Design Patterns takes the approach of reducing all design patterns to a single pattern: “Abstracting Communication Between ‘Components’.” The author concludes, in part: Instead of …

Continue reading »

Written by Paul M. Jones - - Aggregated on Tuesday September 19, 2017


A “Systems” Addendum To Semantic Versioning

tl;dr: When using semantic versioning, consider not only changes to the public API, but also changes to system requirements. Semantic Versioning concentrates on the public API signature as the determiner of when to change version numbers. If the public API changes in a backwards-incompatible way, then you have …

Continue reading »

Written by Paul M. Jones - - Aggregated on Tuesday September 12, 2017


Original MVC Resources from Reenskaug

This is from Trygve Reenskaug: MVC: Xerox PARC 1978-79 . Some quotes: The essential purpose of MVC is to bridge the gap between the human user’s mental model and the digital model that exists in the computer. The ideal MVC solution supports the user illusion of seeing and manipulating the domain information …

Continue reading »

Written by Paul M. Jones - - Aggregated on Monday August 28, 2017


Slim and Action-Domain-Responder

I’ve had a warm place in my heart for Slim for a long time, and especially so since recognizing the Action-Domain-Responder pattern. In this post, I’ll show how to refactor the Slim tutorial application to ADR. One nice thing about Slim (and most other HTTP user interface frameworks ) is that they are already …

Continue reading »

Written by Paul M. Jones - - Aggregated on Tuesday August 22, 2017


Why MVC doesn’t fit the web

[MVC is] a particular way to break up the responsibilities of parts of a graphical user interface application. One of the prototypical examples is a CAD application: models are the objects being drawn, in the abstract: models of mechanical parts, architectural elevations, whatever the subject of the particular …

Continue reading »

Written by Paul M. Jones - - Aggregated on Friday August 18, 2017


Domain Logic and Email Templates

From an email conversation with a reader: Hi Paul, I’ve been following your writing and examples about the ADR pattern for some time now. It’s taken me awhile to wrap my head around it but ADR has really added a lot of structure to my code and I’m thankful for your work! One dilemma that I’ve been struggling …

Continue reading »

Written by Paul M. Jones - - Aggregated on Tuesday July 18, 2017


Controllers and Domain Exceptions

A few months ago I had a great email conversation with a correspondent about how to handle business logic exceptions in his controller code. His message follows, lightly edited for brevity and clarity: I think controller has single responsibility – to mediate communication between caller’s context and actual …

Continue reading »

Written by Paul M. Jones - - Aggregated on Tuesday May 23, 2017


“Action Injection” As A Code Smell

Circumstance has conspired to put Action Injection discussions in front of me multiple times in the past few days. Having seen the approach several times before, I have come to think that if Action Injection is the answer, you might be asking the wrong question. I find it to be a code smell, one that indicates the …

Continue reading »

Written by Paul M. Jones - - Aggregated on Tuesday May 16, 2017


“A False Sense of Simplicity”

These year-old posts from Piotr Solnica are about Ruby On Rails … My time with Rails is up Abstractions and the role of a framework … but the experiences related therein should be valuable to anyone using or building a full-stack PHP framework. (I can imagine it applying to CMSes as well.) Does this …

Continue reading »

Written by Paul M. Jones - - Aggregated on Tuesday April 25, 2017


Atlas ORM 1.2.0 Released

The 1.2.0 release adds the ability to define WHERE conditions on relationships . (The 1.1.0 release added functionality to ignore foreign key string case when wiring up objects in memory, and 1.0.0 was released pretty quietly a couple of weeks ago.) Try it out today , because you like keeping your persistence …

Continue reading »

Written by Paul M. Jones - - Aggregated on Tuesday April 18, 2017