Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
YouTube Security VideosAndroid Police: Samsung is smashing records! #shorts #tech #phones(21.09.2026 um 13:55 Uhr)
YouTube Security Videosheise & c't: Bundesnetzagentur wollte diesen Futterautomaten verbieten(21.09.2026 um 13:53 Uhr)
YouTube Security VideosNeil Patel: Your Google Traffic Isn't An Asset It's A Loan #shorts(21.09.2026 um 14:05 Uhr)
Windows Tipps & SecurityF-14 A Tomcat Top Gun endlich als Revell Klemmbausteinmodell erhältlich(21.09.2026 um 14:27 Uhr)
Sichere ProgrammierungShow the Hand-Back Sample Before Approving an Agent Score(21.09.2026 um 14:15 Uhr)
Sichere ProgrammierungHybrid retrieval in one Postgres query: RRF over tsvector + pgvector(21.09.2026 um 14:15 Uhr)
YouTube Security VideosAndroid Police: Samsung is smashing records! #shorts #tech #phones(21.09.2026 um 13:55 Uhr)
YouTube Security Videosheise & c't: Bundesnetzagentur wollte diesen Futterautomaten verbieten(21.09.2026 um 13:53 Uhr)
YouTube Security VideosNeil Patel: Your Google Traffic Isn't An Asset It's A Loan #shorts(21.09.2026 um 14:05 Uhr)
Windows Tipps & SecurityF-14 A Tomcat Top Gun endlich als Revell Klemmbausteinmodell erhältlich(21.09.2026 um 14:27 Uhr)
Sichere ProgrammierungShow the Hand-Back Sample Before Approving an Agent Score(21.09.2026 um 14:15 Uhr)
Sichere ProgrammierungHybrid retrieval in one Postgres query: RRF over tsvector + pgvector(21.09.2026 um 14:15 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

DDD CRUD-Like Repository

The repository pattern is an essential part of object-oriented software development. It has become the most popular abstraction to retrieve data from the database and map them into business objects (Aggregates). Lately I have noticed…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

The repository pattern is an essential part of object-oriented software development. It has become the most popular abstraction to retrieve data from the database and map them into business objects (Aggregates).



Lately I have noticed that many developers choose to restrict their repository to follow a CRUD (Create, Read, Update, and Delete) pattern, where the methods' names are generic and contain a verb associated with CRUD such as get or delete. The methods are stay highly versatile by accepting a object parameter with many properties so the consumer ca re-use the method in many different scenarios.



Example of a User repository interface (typescript):




export interface IUserRepository {
getUser({ id?: number, email?: string, role?: string }): Promise<User>
}






This pattern seem to be loosely inspired by Eric Evan's description of a specification-based repository.




A SPECIFICATION is a way of allowing a client to describe (specify) what it wants without concern for how it

will be obtained in the process creating an object that can actually carry out the selection




The issue comes when constraining repositories to only follow a specification / CRUD interface. Methods suddenly have to cover many cases and they become bloated. Additionally, the method names do not convey the same intent as compared to "hard-coded" methods




await playerRepository.getPlayer({ location: 'USA', highScore: 500 })

await playerRepository.getPlayerFromUSAWithHighScore(500)






In the example above, we can see the two different approaches. The "Specification-Based" does not convey the intent very well. It is not obvious if it is retrieving a Player from the USA and with a high score of 500, or if it is retrieving a Player from the USA or with a high score of 500.



Additionally, Eric Evans pointed out that we should allow for repositories to contain hardcoded methods, so as to maintain clarity in the domain design.




Even a REPOSITORY design with flexible queries should allow for the addition of specialized hard-coded

queries. These might be convenience methods that encapsulate an often-used query, or a non-object query

such as mathematical summaries of selected objects. Frameworks that don’t allow for such contingencies

tend to distort the domain design or get bypassed by developers.




Having said that, it is important for hardcoded methods not to encapsulate the definition of domain terms. For example:




interface IArticleRepository {
getMostPopularArticles(limit: number)
}






In this example, we are defining what a "Popular" article is within the implementation of a repository, which should belong as an infrastructure concern. We are violating the segregation of concern.



Finally, I would like to point out that the specification-based example given here do not follow Eric Evan's example of what a specification-based query should look like. It just happens to be the most common repository structure I come across.



If you're curious, this is an example of a specification-based repository query given by Eric Evans in his book:




const criteria = new Criteria();
criteria.equal(TradeOrder.SECURITY, "WCOM");
criteria.equal(TradeOrder.ACCOUNT, "123");

const order = tradeOrderRepository.matching(criteria);









Domain-Driven Design by Eric Evans

My website

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten DDD CRUD-Like Repository

Thematisch verwandte Begriffe: CRUDLike, Repository · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-94097 | A vulnerability was determined in Netcore NBR200V2 1.3.241127.071246. Th…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick