DEV Community

CodingBlocks

Episode 58 – Why Domain Driven Design

This week, Michael asks his customers about their anemic domain model, Allen talks in front of people, and Joe plays Rocket League as we begin our dive into understanding domain driven design.

Are you reading this episode’s show notes via your podcast player? You can find this episode’s full show notes at http://www.codingblocks.net/episode58.

Become a Part of the Community

Care to join in on the conversation? Join the conversation in the Slack community by heading over to http://www.codingblocks.net/slack to join today.

Survey

This week, we ask: Which (programming) language are you most envious of?

#yop-poll-container-35_yp58fd4c4166900 { width: 1000; background:#fff; padding:10px; color:#555; overflow:hidden; font-size:12px; } #yop-poll-container-35_yp58fd4c4166900 input[type='text'] { margin:0px 0px 5px 0px; padding:2%; width:96%; text-indent:2%; font-size:12px; } .yop-poll-name-35_yp58fd4c4166900 { font-weight:bold; background:#327BD6; color:#fff; padding:5px; text-align:center; font-size:12px; } #yop-poll-questions-container-35_yp58fd4c4166900 { font-size:14px; margin:5px 0px; } .yop-poll-question-container-35_yp58fd4c4166900 { padding: 2px; } .yop-poll-question-35_yp58fd4c4166900 { background:#327BD6; color:#fff; margin-bottom: 21px; margin-top: -10px; font-style: italic; text-align: center; width: 100%; padding:5px; } .yop-poll-answers-35_yp58fd4c4166900 { } .yop-poll-answers-35_yp58fd4c4166900 ul { list-style: none outside none; margin: 0; padding: 0; } .yop-poll-li-answer-35_yp58fd4c4166900 { font-style:normal; margin:0px 0px 10px 0px; padding:0px; font-size:12px; margin-bottom:20px; } .yop-poll-li-answer-35_yp58fd4c4166900 input { margin:0px; float:none; } .yop-poll-li-answer-35_yp58fd4c4166900 label { margin:0px; font-style:normal; font-weight:normal; font-size:12px; float:none; } .yop-poll-results-35_yp58fd4c4166900 { font-size: 12px; font-style: italic; font-weight: normal; margin-left: 15px; } .yop-poll-customs-35_yp58fd4c4166900 { } .yop-poll-customs-35_yp58fd4c4166900 ul { list-style: none outside none; margin: 0; padding: 0; } .yop-poll-li-custom-35_yp58fd4c4166900 { padding:0px; margin:0px; font-size:14px; } /* Start CAPTCHA div style*/ #yop-poll-captcha-input-div-35_yp58fd4c4166900 { margin-top:5px; } #yop-poll-captcha-helpers-div-35_yp58fd4c4166900 { width:30px; float:left; margin-left:5px; height:0px; } #yop-poll-captcha-helpers-div-35_yp58fd4c4166900 img { margin-bottom:2px; } #yop-poll-captcha-image-div-35_yp58fd4c4166900 { margin-bottom:5px; } #yop_poll_captcha_image_35_yp58fd4c4166900 { float:left; } /* End CAPTCHA div style*/ .yop-poll-clear-35_yp58fd4c4166900 { clear:both; } #yop-poll-vote-35_yp58fd4c4166900 { } /* Start Result bar*/ .yop-poll-results-bar-35_yp58fd4c4166900 { background:#f5f5f5; height:10px; } .yop-poll-results-bar-35_yp58fd4c4166900 div { background:#555; height:10px; } /* End Result bar*/ /* Start Vote Button*/ #yop-poll-vote-35_yp58fd4c4166900 div#yop-poll-vote-35_yp58fd4c4166900 button { float:left; } #yop-poll-vote-35_yp58fd4c4166900 div#yop-poll-results-35_yp58fd4c4166900 { float: right; margin-bottom: 20px; margin-top: -20px; width: auto; } #yop-poll-vote-35_yp58fd4c4166900 div#yop-poll-results-35_yp58fd4c4166900 a { color:#fff; text-decoration:underline; font-size:12px; } #yop-poll-vote-35_yp58fd4c4166900 div#yop-poll-back-35_yp58fd4c4166900 a { color:#555; text-decoration:underline; font-size:12px; } #yop-poll-vote-35_yp58fd4c4166900 div#yop-poll-archive-35_yp58fd4c4166900 a { color:#555; text-decoration:underline; font-size:12px; } #yop-poll-vote-35_yp58fd4c4166900 div { float:left; width:100%; } /* End Vote Button*/ /* Start Messages*/ #yop-poll-container-error-35_yp58fd4c4166900 { font-size:12px; font-style:italic; color:red; text-transform:lowercase; margin-bottom:20px; text-align:center; } #yop-poll-container-success-35_yp58fd4c4166900 { font-size:12px; font-style:italic; color:green; margin-bottom:20px; text-align:center; } /* End Messages*/#yop-poll-container-35_yp58fd4c4166900 img { max-width: 1000; } .yop-poll-forms-display{}
Which (programming) language are you most envious of?
  • C
  • C#
  • C++
  • F#
  • Go
  • Haskell
  • Java
  • JavaScript
  • Python
  • R
  • Ruby
  • Swift
  • Typescript
  • VB.NET

News

  • Thank you to everyone that left us a review! It really means a lot to us.
    • iTunes reviews: tumoxe, drkaj, rumberger_, robbydiesal, heberej, Caffeine Slayer, ArgggGamer, gbmillard, Bob Minteer, wpdevguy, SanJustoEs, Tokachu, Mordef, DK4501, RCF9, ABSquaredX, Shenril, D***qAllTehNICKNAMEZtaken, ze durham, LucasandRico
    • Stitcher reviews: JoeZacksBeard, MrE DBA, MoJoRisin, topswagcode, Joshua Kaluba, tackaman, Cruz, ssfcultra
  • Top 10 things which make programmers unhappy at MyBroadband. A brief summary of this academic paper.
  • nate_the_dba points out: Don’t use Allen’s SQL debugging Tip-of-the-Week in production as it can lock tables. (Or use it carefully.) And Michael asks, why are you debugging in production?
  • Allen gives a presentation on Serverless Architecture (YouTubeMeetup). Unfortunately, he felt a bit uneasy following an extremely well polished presentation on JavaScript Everywhere (YouTube).
  • Facebook announces React Fiber (TechCrunch)
  • OMG, we’re already at Angular 4.0 (Blogspot)
  • Joe moved to Orlando!
    • So many more Meetups to attend.
  • Joe attended the Orlando Code Camp.

Swag

I know, I know, your swagger game is tight. But, and hear me out, it could be better. Check out http://www.codingblocks.net/swag for more information on how to get some of your favorite Coding Blocks stickers and t-shirts.

Domain Driven Design (DDD)

Why Domain Driven Design

  • What is the “domain”?
  • Set of principles and patterns to solve difficult problems
  • Clear and testable code that represents the domain
  • Interact with domain experts
  • In contrast to some approaches, you focus on a single domain at a time
  • Business logic is in one area

Drawbacks?

  • Need access to the domain experts
  • Time and effort, initially, much higher
  • Have to really think about how to isolate domain logic from other portions of your application
  • Learning curve – as with any new framework / pattern
  • No reason to do it in place of a simple crud app – if there’s not complex business domains to manage, this is overkill
  • Gotta get buy in from upper management
  • Is DDD anti-agile? http://stackoverflow.com/questions/39245741/what-makes-domain-driven-design-worthwhile

Ubiquitous Language

  • One of the most important aspects of DDD
  • “Client” means something totally different to a UI developer vs a domain expert working with customers
  • Common vocabulary MUST be established – and all communications should be carried out with that vocabulary
  • Need to focus on how the domain works – nothing regarding implementation details

Getting into the details…a bit

  • Bounded context – specific responsibility with explicit boundaries that separate it from other parts of a system
    • “Explicitly define the context within which a model applies…Keep the model strictly consistent within these bounds, but don’t be distracted or confused by issues outside” – Eric Evans
  • Terms:
    • Problem domain – the specific problem you’re working on solving
    • Core domain – key to the customer’s business – cannot be outsourced
    • Sub domain – separate pieces your software must interact with
    • Context mapping – identifying bounded contexts and their relationships to one another
    • Shared kernel – part of the model that is shared by more than one team – will not change without collaboration between teams

Resources We Like

Tip of the Week

Share With a Friend

Would you like to help us? You can. And it’s easy. Share Coding Blocks with a friend. See. Now wasn’t that easy? And what’s even better, now your friend knows that you’re a genius. So, win-win right?

And hey, there’s one last way you can help us. How’s that you ask? Simply leave us a review. Head to http://www.codingblocks.net/review to tell the world about us.

Episode source