{"id":2210,"date":"2018-08-14T22:42:14","date_gmt":"2018-08-14T21:42:14","guid":{"rendered":"https:\/\/www.entropywins.wtf\/blog\/?p=2210"},"modified":"2020-02-12T00:23:21","modified_gmt":"2020-02-11T23:23:21","slug":"clean-architecture-bounded-contexts","status":"publish","type":"post","link":"https:\/\/www.entropywins.wtf\/blog\/2018\/08\/14\/clean-architecture-bounded-contexts\/","title":{"rendered":"Clean Architecture + Bounded Contexts"},"content":{"rendered":"<p>In this follow-up to <a href=\"https:\/\/www.entropywins.wtf\/blog\/2016\/11\/24\/implementing-the-clean-architecture\/\">Implementing the Clean Architecture<\/a> I introduce you to a combination of The Clean Architecture and the strategic DDD pattern known as Bounded Contexts.<\/p>\n<p>At <a href=\"https:\/\/wikimedia.de\/en\/\">Wikimedia Deutschland<\/a> we use this combination of The Clean Architecture and <a href=\"https:\/\/martinfowler.com\/bliki\/BoundedContext.html\">Bounded Contexts<\/a> for our fundraising applications. In this post I describe the structure we have and the architectural rules we follow in the abstract. For the story on how we got to this point and a more concrete description, see my post <a href=\"https:\/\/www.entropywins.wtf\/blog\/2018\/08\/14\/bounded-contexts-in-the-wikimedia-fundraising-software\/\">Bounded Contexts in the Wikimedia Fundraising Software<\/a>. In that post and at the end of this one I link you to a real-world codebase that follows the abstract rules described in this post.<\/p>\n<p>If you are not yet familiar with The Clean Architecture, please first read <a href=\"https:\/\/www.entropywins.wtf\/blog\/2016\/11\/24\/implementing-the-clean-architecture\/\">Implementing the Clean Architecture<\/a>.<\/p>\n<h2>Clean Architecture + Bounded Contexts<\/h2>\n<p><small><em>Diagram by Jeroen De Dauw, Charlie Kritschmar, Jan Dittrich and Hanna Petruschat. Click image to enlarge<br \/>\n<\/em><\/small><\/p>\n<p><a href=\"https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2018\/08\/CleanArchitecture_DomainDrivenDesign.png\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"2345\" data-permalink=\"https:\/\/www.entropywins.wtf\/blog\/2018\/08\/14\/clean-architecture-bounded-contexts\/cleanarchitecture_domaindrivendesign\/\" data-orig-file=\"https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2018\/08\/CleanArchitecture_DomainDrivenDesign.png\" data-orig-size=\"1367,882\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Clean Architecture + Bounded Contexts\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2018\/08\/CleanArchitecture_DomainDrivenDesign.png\" class=\"alignnone wp-image-2345\" src=\"https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2018\/08\/CleanArchitecture_DomainDrivenDesign.png\" alt=\"Diagram depicting Clean Architecture + Bounded Contexts\" width=\"850\" height=\"548\" \/><\/a><\/p>\n<p>In the top layer of the diagram we have applications. These can be web applications, they can be console applications, they can be monoliths, they can be microservices, etc. Each application has presentation code which in bigger applications tends to reside in a decoupled presentation layer using patterns such as presenters. All applications also somehow construct the dependency graph they need, perhaps using a Dependency Injection Container or set of factories. Often this involves reading configuration from somewhere. The applications contain ALL framework binding, hence they are the place where you will find the Controllers if you are using a typical web framework.<\/p>\n<p>Since the applications are in the top layer, and dependencies can only go down, no code outside of the applications is allowed to depend on code in the applications. That means there is 0 binding to mechanisms such as frameworks and presentation code outside of the applications.<\/p>\n<p>In the second layer we have the Bounded Contexts. Ideally one Bounded Context per subdomain. At the core of each BC we have the Domain Model and Domain Services, containing the business logic part of the subdomain. Dependencies can only point inwards, so the Domain model which is at the center cannot depend on anything more to the outside. Around the Domain Model are the Domain Services. These include interfaces for persistence services such as Repositories. The UseCases form the final ring. They can use both the Domain Model and the Domain Services. They also form a boundary around the two, meaning that no code outside of the Bounded Context is allowed to talk to the Domain Model or Domain Services.<\/p>\n<p>The Bounded Contexts include their own Persistence Layer. The Persistence Layer can use a relational database, files on the file system, a remote web API, a combination of these, etc. It has implementations of domain services such as Repositories which are used by the UseCases. These implementations are the only thing that is allowed to talk to and know about the low-level aspects of the Persistence Layer. The only things that can use these service implementations are other Domain Services and the UseCases.<\/p>\n<p>The UseCases, including\u00a0their Request Models and Response Models, form the public interface of the Bounded Context. This means that there is 0 binding to the persistence mechanisms outside of the Bounded Context. It also means that the code responsible for the domain logic cannot be directly accessed elsewhere, such as in the presentation layer of an application.<\/p>\n<p>The applications and Bounded Contexts contain all the domain specific code. This code can make use of libraries and of course the runtime (ie PHP) itself.<\/p>\n<p>As examples of Bounded Contexts following this approach, see the <a href=\"https:\/\/github.com\/wmde\/fundraising-donations\">Donation Context<\/a> and <a href=\"https:\/\/github.com\/wmde\/fundraising-memberships\">Membership Context<\/a>. For an application following this architecture, see the <a href=\"https:\/\/github.com\/wmde\/FundraisingFrontend\">FundraisingFrontend<\/a>, which uses both the Donation Context and Membership Context. Both these contexts are also used by another application the code of which sadly enough is not currently public. You can also read the stories of <a href=\"https:\/\/www.entropywins.wtf\/blog\/2016\/11\/24\/rewriting-the-wikimedia-deutschland-funrdraising\/\">how we rewrote the FundraisingFontend to use the Clean Architecture<\/a> and <a href=\"https:\/\/www.entropywins.wtf\/blog\/2018\/08\/14\/bounded-contexts-in-the-wikimedia-fundraising-software\/\">how we refactored towards Bounded Contexts<\/a>.<\/p>\n<h3>Further reading<\/h3>\n<p>Sign up below to receive news on my upcoming Clean Architecture book, including a discount:<\/p>\n<div id=\"mc_embed_signup\">\n<form id=\"mc-embedded-subscribe-form\" class=\"validate\" action=\"https:\/\/wtf.us19.list-manage.com\/subscribe\/post?u=5e9453f7bede9f5b0220b2c42&amp;id=9df25d9e9d\" method=\"post\" name=\"mc-embedded-subscribe-form\" novalidate=\"\" target=\"_blank\">\n<div id=\"mc_embed_signup_scroll\">\n<div class=\"mc-field-group\"><input id=\"mce-EMAIL\" class=\"required email\" name=\"EMAIL\" type=\"email\" value=\"\" placeholder=\"Your email address\" \/><\/div>\n<div id=\"mce-responses\" class=\"clear\">\n<div id=\"mce-error-response\" class=\"response\" style=\"display: none;\"><\/div>\n<div id=\"mce-success-response\" class=\"response\" style=\"display: none;\"><\/div>\n<\/div>\n<div style=\"position: absolute; left: -5000px;\" aria-hidden=\"true\"><input tabindex=\"-1\" name=\"b_5e9453f7bede9f5b0220b2c42_9df25d9e9d\" type=\"text\" value=\"\" \/><\/div>\n<div class=\"clear\"><input id=\"mc-embedded-subscribe\" class=\"button\" name=\"subscribe\" type=\"submit\" value=\"Subscribe\" \/><\/div>\n<\/div>\n<\/form>\n<\/div>\n<p>If you are not yet familiar with Bounded Contexts or how to design them well, I recommend reading <a href=\"https:\/\/www.goodreads.com\/book\/show\/28602719-domain-driven-design-distilled\">Domain-Driven Design Distilled<\/a>.<\/p>\n<blockquote class=\"twitter-tweet\" data-cards=\"hidden\" data-lang=\"en\">\n<p dir=\"ltr\" lang=\"en\">Blogged: Clean Architecture + Bounded Contexts <a href=\"https:\/\/t.co\/r30eiw4OP4\">https:\/\/t.co\/r30eiw4OP4<\/a> <a href=\"https:\/\/twitter.com\/hashtag\/CleanCode?src=hash&amp;ref_src=twsrc%5Etfw\">#CleanCode<\/a> <a href=\"https:\/\/twitter.com\/hashtag\/CleanArchitecture?src=hash&amp;ref_src=twsrc%5Etfw\">#CleanArchitecture<\/a> <a href=\"https:\/\/twitter.com\/hashtag\/DDDesign?src=hash&amp;ref_src=twsrc%5Etfw\">#DDDesign<\/a><\/p>\n<p>\u2014 @JeroenDeDauw <a href=\"https:\/\/twitter.com\/JeroenDeDauw\/status\/1029989608870895616?ref_src=twsrc%5Etfw\">August 16, 2018<\/a><\/p><\/blockquote>\n<p><script async src=\"https:\/\/platform.twitter.com\/widgets.js\" charset=\"utf-8\"><\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this follow-up to Implementing the Clean Architecture I introduce you to a combination of The Clean Architecture and the&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[7],"tags":[426,429,328,405,416,197,430],"class_list":["post-2210","post","type-post","status-publish","format-standard","hentry","category-programming","tag-bounded-contexts","tag-clean-architecture","tag-clean-code","tag-domain-driven-design","tag-maintainability","tag-planet-wikimedia","tag-software-architecture"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Clean Architecture + Bounded Contexts - Blog of Jeroen De Dauw<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.entropywins.wtf\/blog\/2018\/08\/14\/clean-architecture-bounded-contexts\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Clean Architecture + Bounded Contexts\" \/>\n<meta property=\"og:description\" content=\"In this follow-up to Implementing the Clean Architecture I introduce you to a combination of The Clean Architecture and the&hellip;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.entropywins.wtf\/blog\/2018\/08\/14\/clean-architecture-bounded-contexts\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog of Jeroen De Dauw\" \/>\n<meta property=\"article:published_time\" content=\"2018-08-14T21:42:14+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-02-11T23:23:21+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2018\/08\/CleanArchitecture_DomainDrivenDesign.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1367\" \/>\n\t<meta property=\"og:image:height\" content=\"882\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Jeroen\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:title\" content=\"Clean Architecture + Bounded Contexts\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2018\/08\/CleanArchitecture_DomainDrivenDesign.png\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/JeroenDeDauw\" \/>\n<meta name=\"twitter:site\" content=\"@JeroenDeDauw\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jeroen\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/2018\\\/08\\\/14\\\/clean-architecture-bounded-contexts\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/2018\\\/08\\\/14\\\/clean-architecture-bounded-contexts\\\/\"},\"author\":{\"name\":\"Jeroen\",\"@id\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/#\\\/schema\\\/person\\\/4e2ef14f2ca7dc3a0ac137d1692b66b7\"},\"headline\":\"Clean Architecture + Bounded Contexts\",\"datePublished\":\"2018-08-14T21:42:14+00:00\",\"dateModified\":\"2020-02-11T23:23:21+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/2018\\\/08\\\/14\\\/clean-architecture-bounded-contexts\\\/\"},\"wordCount\":721,\"commentCount\":5,\"publisher\":{\"@id\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/#\\\/schema\\\/person\\\/4e2ef14f2ca7dc3a0ac137d1692b66b7\"},\"image\":{\"@id\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/2018\\\/08\\\/14\\\/clean-architecture-bounded-contexts\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/08\\\/CleanArchitecture_DomainDrivenDesign.png\",\"keywords\":[\"Bounded Contexts\",\"Clean Architecture\",\"Clean Code\",\"Domain Driven Design\",\"Maintainability\",\"Planet Wikimedia\",\"Software Architecture\"],\"articleSection\":[\"Programming\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/2018\\\/08\\\/14\\\/clean-architecture-bounded-contexts\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/2018\\\/08\\\/14\\\/clean-architecture-bounded-contexts\\\/\",\"url\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/2018\\\/08\\\/14\\\/clean-architecture-bounded-contexts\\\/\",\"name\":\"Clean Architecture + Bounded Contexts - Blog of Jeroen De Dauw\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/2018\\\/08\\\/14\\\/clean-architecture-bounded-contexts\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/2018\\\/08\\\/14\\\/clean-architecture-bounded-contexts\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/08\\\/CleanArchitecture_DomainDrivenDesign.png\",\"datePublished\":\"2018-08-14T21:42:14+00:00\",\"dateModified\":\"2020-02-11T23:23:21+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/2018\\\/08\\\/14\\\/clean-architecture-bounded-contexts\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/2018\\\/08\\\/14\\\/clean-architecture-bounded-contexts\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/2018\\\/08\\\/14\\\/clean-architecture-bounded-contexts\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/08\\\/CleanArchitecture_DomainDrivenDesign.png\",\"contentUrl\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/08\\\/CleanArchitecture_DomainDrivenDesign.png\",\"width\":1367,\"height\":882},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/2018\\\/08\\\/14\\\/clean-architecture-bounded-contexts\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Clean Architecture + Bounded Contexts\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/\",\"name\":\"Entropy Wins\",\"description\":\"A blog on Software Architecture, Design and Craftsmanship\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/#\\\/schema\\\/person\\\/4e2ef14f2ca7dc3a0ac137d1692b66b7\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.entropywins.wtf\\\/blog\\\/#\\\/schema\\\/person\\\/4e2ef14f2ca7dc3a0ac137d1692b66b7\",\"name\":\"Jeroen\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d62e6b5b8e332335cf17854fac850d9c70ba367c4692872613c3110ebd4e009b?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d62e6b5b8e332335cf17854fac850d9c70ba367c4692872613c3110ebd4e009b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d62e6b5b8e332335cf17854fac850d9c70ba367c4692872613c3110ebd4e009b?s=96&d=mm&r=g\",\"caption\":\"Jeroen\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d62e6b5b8e332335cf17854fac850d9c70ba367c4692872613c3110ebd4e009b?s=96&d=mm&r=g\"},\"sameAs\":[\"https:\\\/\\\/www.linkedin.com\\\/in\\\/jeroendedauw\\\/\",\"https:\\\/\\\/x.com\\\/https:\\\/\\\/twitter.com\\\/JeroenDeDauw\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Clean Architecture + Bounded Contexts - Blog of Jeroen De Dauw","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.entropywins.wtf\/blog\/2018\/08\/14\/clean-architecture-bounded-contexts\/","og_locale":"en_US","og_type":"article","og_title":"Clean Architecture + Bounded Contexts","og_description":"In this follow-up to Implementing the Clean Architecture I introduce you to a combination of The Clean Architecture and the&hellip;","og_url":"https:\/\/www.entropywins.wtf\/blog\/2018\/08\/14\/clean-architecture-bounded-contexts\/","og_site_name":"Blog of Jeroen De Dauw","article_published_time":"2018-08-14T21:42:14+00:00","article_modified_time":"2020-02-11T23:23:21+00:00","og_image":[{"width":1367,"height":882,"url":"https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2018\/08\/CleanArchitecture_DomainDrivenDesign.png","type":"image\/png"}],"author":"Jeroen","twitter_card":"summary_large_image","twitter_title":"Clean Architecture + Bounded Contexts","twitter_image":"https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2018\/08\/CleanArchitecture_DomainDrivenDesign.png","twitter_creator":"@https:\/\/twitter.com\/JeroenDeDauw","twitter_site":"@JeroenDeDauw","twitter_misc":{"Written by":"Jeroen","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.entropywins.wtf\/blog\/2018\/08\/14\/clean-architecture-bounded-contexts\/#article","isPartOf":{"@id":"https:\/\/www.entropywins.wtf\/blog\/2018\/08\/14\/clean-architecture-bounded-contexts\/"},"author":{"name":"Jeroen","@id":"https:\/\/www.entropywins.wtf\/blog\/#\/schema\/person\/4e2ef14f2ca7dc3a0ac137d1692b66b7"},"headline":"Clean Architecture + Bounded Contexts","datePublished":"2018-08-14T21:42:14+00:00","dateModified":"2020-02-11T23:23:21+00:00","mainEntityOfPage":{"@id":"https:\/\/www.entropywins.wtf\/blog\/2018\/08\/14\/clean-architecture-bounded-contexts\/"},"wordCount":721,"commentCount":5,"publisher":{"@id":"https:\/\/www.entropywins.wtf\/blog\/#\/schema\/person\/4e2ef14f2ca7dc3a0ac137d1692b66b7"},"image":{"@id":"https:\/\/www.entropywins.wtf\/blog\/2018\/08\/14\/clean-architecture-bounded-contexts\/#primaryimage"},"thumbnailUrl":"https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2018\/08\/CleanArchitecture_DomainDrivenDesign.png","keywords":["Bounded Contexts","Clean Architecture","Clean Code","Domain Driven Design","Maintainability","Planet Wikimedia","Software Architecture"],"articleSection":["Programming"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.entropywins.wtf\/blog\/2018\/08\/14\/clean-architecture-bounded-contexts\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.entropywins.wtf\/blog\/2018\/08\/14\/clean-architecture-bounded-contexts\/","url":"https:\/\/www.entropywins.wtf\/blog\/2018\/08\/14\/clean-architecture-bounded-contexts\/","name":"Clean Architecture + Bounded Contexts - Blog of Jeroen De Dauw","isPartOf":{"@id":"https:\/\/www.entropywins.wtf\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.entropywins.wtf\/blog\/2018\/08\/14\/clean-architecture-bounded-contexts\/#primaryimage"},"image":{"@id":"https:\/\/www.entropywins.wtf\/blog\/2018\/08\/14\/clean-architecture-bounded-contexts\/#primaryimage"},"thumbnailUrl":"https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2018\/08\/CleanArchitecture_DomainDrivenDesign.png","datePublished":"2018-08-14T21:42:14+00:00","dateModified":"2020-02-11T23:23:21+00:00","breadcrumb":{"@id":"https:\/\/www.entropywins.wtf\/blog\/2018\/08\/14\/clean-architecture-bounded-contexts\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.entropywins.wtf\/blog\/2018\/08\/14\/clean-architecture-bounded-contexts\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.entropywins.wtf\/blog\/2018\/08\/14\/clean-architecture-bounded-contexts\/#primaryimage","url":"https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2018\/08\/CleanArchitecture_DomainDrivenDesign.png","contentUrl":"https:\/\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2018\/08\/CleanArchitecture_DomainDrivenDesign.png","width":1367,"height":882},{"@type":"BreadcrumbList","@id":"https:\/\/www.entropywins.wtf\/blog\/2018\/08\/14\/clean-architecture-bounded-contexts\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.entropywins.wtf\/blog\/"},{"@type":"ListItem","position":2,"name":"Clean Architecture + Bounded Contexts"}]},{"@type":"WebSite","@id":"https:\/\/www.entropywins.wtf\/blog\/#website","url":"https:\/\/www.entropywins.wtf\/blog\/","name":"Entropy Wins","description":"A blog on Software Architecture, Design and Craftsmanship","publisher":{"@id":"https:\/\/www.entropywins.wtf\/blog\/#\/schema\/person\/4e2ef14f2ca7dc3a0ac137d1692b66b7"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.entropywins.wtf\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.entropywins.wtf\/blog\/#\/schema\/person\/4e2ef14f2ca7dc3a0ac137d1692b66b7","name":"Jeroen","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/d62e6b5b8e332335cf17854fac850d9c70ba367c4692872613c3110ebd4e009b?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/d62e6b5b8e332335cf17854fac850d9c70ba367c4692872613c3110ebd4e009b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d62e6b5b8e332335cf17854fac850d9c70ba367c4692872613c3110ebd4e009b?s=96&d=mm&r=g","caption":"Jeroen"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/d62e6b5b8e332335cf17854fac850d9c70ba367c4692872613c3110ebd4e009b?s=96&d=mm&r=g"},"sameAs":["https:\/\/www.linkedin.com\/in\/jeroendedauw\/","https:\/\/x.com\/https:\/\/twitter.com\/JeroenDeDauw"]}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p74TBF-zE","jetpack-related-posts":[{"id":2358,"url":"https:\/\/www.entropywins.wtf\/blog\/2018\/09\/09\/clean-architecture-bounded-contexts-diagram\/","url_meta":{"origin":2210,"position":0},"title":"Clean Architecture + Bounded Contexts diagram","author":"Jeroen","date":"2018-09-09","format":false,"excerpt":"I\u2019m happy to release a two Clean Architecture + Bounded Contexts diagrams into the public domain (CC0 1.0). I created these diagrams for Wikimedia Deutchland with the help of Jan Dittrich, Charlie Kritschmar and Hanna Petruschat. They represent the architecture of our fundraising codebase. I explain the rules of this\u2026","rel":"","context":"In &quot;Programming&quot;","block_context":{"text":"Programming","link":"https:\/\/www.entropywins.wtf\/blog\/category\/programming\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2018\/09\/FunArchitecture.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2018\/09\/FunArchitecture.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2018\/09\/FunArchitecture.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2018\/09\/FunArchitecture.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2018\/09\/FunArchitecture.png?resize=1050%2C600&ssl=1 3x"},"classes":[]},{"id":2278,"url":"https:\/\/www.entropywins.wtf\/blog\/2018\/08\/14\/bounded-contexts-in-the-wikimedia-fundraising-software\/","url_meta":{"origin":2210,"position":1},"title":"Bounded Contexts in the Wikimedia Fundraising Software","author":"Jeroen","date":"2018-08-14","format":false,"excerpt":"In this follow-up to rewriting the Wikimedia Deutschland fundraising I tell the story of how we reorganized our codebases along the lines of the DDD strategic pattern Bounded Contexts. In 2016 the FUN team at Wikimedia Deutschland rewrote the Wikimedia Deutschland fundraising application. This new codebase uses The Clean Architecture\u2026","rel":"","context":"In &quot;Programming&quot;","block_context":{"text":"Programming","link":"https:\/\/www.entropywins.wtf\/blog\/category\/programming\/"},"img":{"alt_text":"Diagram depicting Clean Architecture + Bounded Contexts","src":"https:\/\/i0.wp.com\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2018\/08\/Such-Clean-Diagram.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2018\/08\/Such-Clean-Diagram.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2018\/08\/Such-Clean-Diagram.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2018\/08\/Such-Clean-Diagram.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2018\/08\/Such-Clean-Diagram.png?resize=1050%2C600&ssl=1 3x"},"classes":[]},{"id":1807,"url":"https:\/\/www.entropywins.wtf\/blog\/2016\/09\/09\/clean-architecture-diagram\/","url_meta":{"origin":2210,"position":2},"title":"Clean Architecture diagrams","author":"Jeroen","date":"2016-09-09","format":false,"excerpt":"I'm happy to release a few Clean Architecture related diagrams into the public domain (CC0 1.0). Update 2018-9-9: new diagrams featuring Bounded Contexsts are now available! These diagrams where created at Wikimedia Deutchland by Jan Dittrich, Charlie Kritschmar and myself for an upcoming presentation I'm doing on the Clean Architecture.\u2026","rel":"","context":"In &quot;Programming&quot;","block_context":{"text":"Programming","link":"https:\/\/www.entropywins.wtf\/blog\/category\/programming\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2016\/09\/Clean_Architecture_core.svg_.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2016\/09\/Clean_Architecture_core.svg_.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2016\/09\/Clean_Architecture_core.svg_.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":1846,"url":"https:\/\/www.entropywins.wtf\/blog\/2016\/11\/24\/implementing-the-clean-architecture\/","url_meta":{"origin":2210,"position":3},"title":"Implementing the Clean Architecture","author":"Jeroen","date":"2016-11-24","format":false,"excerpt":"Both Domain Driven Design and architectures such as the Clean Architecture and Hexagonal are often talked about. It's hard to go to a conference on software development and not run into one of these topics. However it can be challenging to find good real-world examples. In this blog post I'll\u2026","rel":"","context":"In &quot;Programming&quot;","block_context":{"text":"Programming","link":"https:\/\/www.entropywins.wtf\/blog\/category\/programming\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2016\/11\/CleanArchitecture.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2016\/11\/CleanArchitecture.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2016\/11\/CleanArchitecture.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/www.entropywins.wtf\/blog\/wp-content\/uploads\/2016\/11\/CleanArchitecture.jpg?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":1792,"url":"https:\/\/www.entropywins.wtf\/blog\/2016\/07\/14\/notes-implementing-ddd-chapter-2\/","url_meta":{"origin":2210,"position":4},"title":"Notes: Implementing DDD, chapter 2","author":"Jeroen","date":"2016-07-14","format":false,"excerpt":"Notes from Implementing Domain Driven Design, chapter 2: Domains, Subdomains and Bounded Contexts (p58 and later only) User interface and service orientated endpoints are within the context boundary Domain concepts in the UI form the Smart UI Anti-Pattern A database schema is part of the context if it was created\u2026","rel":"","context":"In &quot;Programming&quot;","block_context":{"text":"Programming","link":"https:\/\/www.entropywins.wtf\/blog\/category\/programming\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2044,"url":"https:\/\/www.entropywins.wtf\/blog\/2017\/05\/24\/generic-entity-handling-code\/","url_meta":{"origin":2210,"position":5},"title":"Generic Entity handling code","author":"Jeroen","date":"2017-05-24","format":false,"excerpt":"In this blog post I outline my thinking on sharing code that deals with different types of Entities in your domain. We\u2019ll cover what Entities are, code reuse strategies, pitfalls such as Shotgun Surgery and Anemic Domain Models and finally Bounded Contexts. Why I wrote this post I work at\u2026","rel":"","context":"In &quot;Programming&quot;","block_context":{"text":"Programming","link":"https:\/\/www.entropywins.wtf\/blog\/category\/programming\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.entropywins.wtf\/blog\/wp-json\/wp\/v2\/posts\/2210","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.entropywins.wtf\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.entropywins.wtf\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.entropywins.wtf\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.entropywins.wtf\/blog\/wp-json\/wp\/v2\/comments?post=2210"}],"version-history":[{"count":22,"href":"https:\/\/www.entropywins.wtf\/blog\/wp-json\/wp\/v2\/posts\/2210\/revisions"}],"predecessor-version":[{"id":2707,"href":"https:\/\/www.entropywins.wtf\/blog\/wp-json\/wp\/v2\/posts\/2210\/revisions\/2707"}],"wp:attachment":[{"href":"https:\/\/www.entropywins.wtf\/blog\/wp-json\/wp\/v2\/media?parent=2210"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.entropywins.wtf\/blog\/wp-json\/wp\/v2\/categories?post=2210"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.entropywins.wtf\/blog\/wp-json\/wp\/v2\/tags?post=2210"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}