Comments (8)
I recently wrote a blog post about this: https://www.alainschlesser.com/interface-naming-conventions/
TL;DR:
Interface
suffix (or prefix) is an unnecessary form of Hungarian Notation, and actually severely limits your architecture (by making it impossible to replace classes with interfaces later on, because their nature is encoded in their name). This forces you to proactively put interfaces everywhere to not cause a lock-in to a specific architecture.
from php-ddd.
For long time I've agreed with prefix/suffix like in Symfony or PSR naming conventions
but recently I've changed my mind and I think exactly like @schlessera. You don't need to put Interface
in name because there IS information that this is interface
(the same goes for traits). IDE will display it too. The only thing I accept now is Abstract
prefix for abstract classes, but I think it's possible I'll drop it too.
You don't introduce yourself JohnName SmithSurname ;-)
from php-ddd.
Upcoming PHP BC Break: PSR and all frameworks will remove Interface suffix and Abstract prefix from their naming conventions by default.
...Couldn't wait until April fools!
from php-ddd.
But PSR-8 doesn't use Interface
suffix.
from php-ddd.
Hey @webdevilopers,
I personally go with the Symfony naming scheme aka ClientInterface
.
from php-ddd.
Generally - even in your Domain Model namespace? Or just inside the bundles?
from php-ddd.
I drop the Interface and place all interfaces inside Contracts directory.
from php-ddd.
There is topic on PHP-FIG mailing group about changing conventions in PSRs (only future ones), but it's dead without conclusion.
Nobody expects such BC break, but for any new software it's not the only way of naming.
from php-ddd.
Related Issues (20)
- Repositories inside or outside Domain Services HOT 1
- Event Enriching and external changes to read-model data
- When, where and how to create Summary Events HOT 3
- Passing read models (value objects representing state) / domain service to aggregate methods HOT 6
- Unit testing value objects with internal datetime calculation HOT 14
- How to test application service command handlers dealing with read models? HOT 12
- Process Manager example with Symfony Messenger Command / Event Bus and ProophOS HOT 5
- Batch / Bulk operations handling multiple event-sourced aggregate roots HOT 3
- How to use factory methods on aggregates in CQRS - WRITE vs. READ model HOT 1
- How to keep read-models up-to-date when a name property was externally changed?
- How to upcast events with Prooph HOT 1
- Are CQRS commands part of the domain model? HOT 13
- Populate Projection with multiple tables HOT 2
- Where to call or pass a domain service? HOT 16
- How to implement the Equatable interface / Equals or SameValueAs method in value objects
- Domain Event Publisher for Doctrine Entities HOT 1
- Event Sourcing vs. Event-Driven Architecture (EDA)
- The repository pattern HOT 4
- Properties on Domain Events HOT 3
- PHP Command DTO with Symfony Constraints equivalent in Angular Forms HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from php-ddd.