CodingBlocks
Episode 60 – Software Architecture – The Domain in Domain Driven Design
We continue our Domain Driven Design conversation this week as Allen is indecisive, Michael decides for him, and Joe can’t handle the night life.
Using your podcast player to read these notes? Head to http://www.codingblocks.net/episode60 to see the full show notes in all of their glory.
Do You Even Slack?
If you don’t, you should. Head over to http://www.codingblocks.net/slack to be a part of the conversation.
Survey
This week we want to know: What is your headphone style of choice while coding?
#yop-poll-container-37_yp592ba3348ce0c { width: 1000; background:#fff; padding:10px; color:#555; overflow:hidden; font-size:12px; } #yop-poll-container-37_yp592ba3348ce0c input[type='text'] { margin:0px 0px 5px 0px; padding:2%; width:96%; text-indent:2%; font-size:12px; } .yop-poll-name-37_yp592ba3348ce0c { font-weight:bold; background:#327BD6; color:#fff; padding:5px; text-align:center; font-size:12px; } #yop-poll-questions-container-37_yp592ba3348ce0c { font-size:14px; margin:5px 0px; } .yop-poll-question-container-37_yp592ba3348ce0c { padding: 2px; } .yop-poll-question-37_yp592ba3348ce0c { background:#327BD6; color:#fff; margin-bottom: 21px; margin-top: -10px; font-style: italic; text-align: center; width: 100%; padding:5px; } .yop-poll-answers-37_yp592ba3348ce0c { } .yop-poll-answers-37_yp592ba3348ce0c ul { list-style: none outside none; margin: 0; padding: 0; } .yop-poll-li-answer-37_yp592ba3348ce0c { font-style:normal; margin:0px 0px 10px 0px; padding:0px; font-size:12px; margin-bottom:20px; } .yop-poll-li-answer-37_yp592ba3348ce0c input { margin:0px; float:none; } .yop-poll-li-answer-37_yp592ba3348ce0c label { margin:0px; font-style:normal; font-weight:normal; font-size:12px; float:none; } .yop-poll-results-37_yp592ba3348ce0c { font-size: 12px; font-style: italic; font-weight: normal; margin-left: 15px; } .yop-poll-customs-37_yp592ba3348ce0c { } .yop-poll-customs-37_yp592ba3348ce0c ul { list-style: none outside none; margin: 0; padding: 0; } .yop-poll-li-custom-37_yp592ba3348ce0c { padding:0px; margin:0px; font-size:14px; } /* Start CAPTCHA div style*/ #yop-poll-captcha-input-div-37_yp592ba3348ce0c { margin-top:5px; } #yop-poll-captcha-helpers-div-37_yp592ba3348ce0c { width:30px; float:left; margin-left:5px; height:0px; } #yop-poll-captcha-helpers-div-37_yp592ba3348ce0c img { margin-bottom:2px; } #yop-poll-captcha-image-div-37_yp592ba3348ce0c { margin-bottom:5px; } #yop_poll_captcha_image_37_yp592ba3348ce0c { float:left; } /* End CAPTCHA div style*/ .yop-poll-clear-37_yp592ba3348ce0c { clear:both; } #yop-poll-vote-37_yp592ba3348ce0c { } /* Start Result bar*/ .yop-poll-results-bar-37_yp592ba3348ce0c { background:#f5f5f5; height:10px; } .yop-poll-results-bar-37_yp592ba3348ce0c div { background:#555; height:10px; } /* End Result bar*/ /* Start Vote Button*/ #yop-poll-vote-37_yp592ba3348ce0c div#yop-poll-vote-37_yp592ba3348ce0c button { float:left; } #yop-poll-vote-37_yp592ba3348ce0c div#yop-poll-results-37_yp592ba3348ce0c { float: right; margin-bottom: 20px; margin-top: -20px; width: auto; } #yop-poll-vote-37_yp592ba3348ce0c div#yop-poll-results-37_yp592ba3348ce0c a { color:#fff; text-decoration:underline; font-size:12px; } #yop-poll-vote-37_yp592ba3348ce0c div#yop-poll-back-37_yp592ba3348ce0c a { color:#555; text-decoration:underline; font-size:12px; } #yop-poll-vote-37_yp592ba3348ce0c div#yop-poll-archive-37_yp592ba3348ce0c a { color:#555; text-decoration:underline; font-size:12px; } #yop-poll-vote-37_yp592ba3348ce0c div { float:left; width:100%; } /* End Vote Button*/ /* Start Messages*/ #yop-poll-container-error-37_yp592ba3348ce0c { font-size:12px; font-style:italic; color:red; text-transform:lowercase; margin-bottom:20px; text-align:center; } #yop-poll-container-success-37_yp592ba3348ce0c { font-size:12px; font-style:italic; color:green; margin-bottom:20px; text-align:center; } /* End Messages*/#yop-poll-container-37_yp592ba3348ce0c img { max-width: 1000; } .yop-poll-forms-display{}- On-Ear - Great sound in a compact shape
- Over-Ear - Sweet pillows of sound
- In-Ear - I need all of the sound in my head
- Earbuds - Because the pain is worth it
News
- Lots of love and thanks to everyone that left a review. We greatly appreciate it.
- iTunes reviews: ELiktman?ELichtman?’sThat it?, Andreas Risberg, ChrisB777, martinrocket, Hegele, Ashy Lary, TSouza1985, Ilcawthorne, Basicallysteve
- Stitcher reviews: We’ll never know since Stitcher was down at the time of this recording. However, we will be sure to include those in the next episode.
- Allen can’t decide which laptop to buy. So he bought both.
- Microsoft has the largest Git repo on the planet.
- Why Google Stores Billions of Lines of Code in a Single Repository. (watch via YouTube, read the article at ACM)
- Should we have a National Code Forgiveness Day?
- Kinda like https://emaildebtforgiveness.me/, but for code.
- Quick and Dirty.
- Should you do it?
- Is it wrong?
Coding Blocks Gear
You need some Coding Blocks stickers in your life. And maybe a shirt. Check out http://www.codingblocks.net/swag to get yours.
The Domain in Domain Driven Design
Domain Layer
- Try not to use anemic domain models, which focus on state rather than behavior
- Do use rich domain models – these focus on behavior, not just the state
- Should represent concepts of the business
- Should contain information about the business situation
- Contains business rules
- Technical details of storing these things are delegated to the infrasturcture layer….NOT HERE
- Behaviors are king – “what can you DO” – not what attributes are saved
Entities
- An object that’s not just a bundle of values – must live on – has an identity and are mutable
- Associating entities – if you can get by with single direction associations, you will GREATLY simplify your life
- Start with single way associations
- Shouldn’t have an equals operator?
Value Objects
- Measure, quantify or describe a thing in the domain
- It’s identity is the composition of it’s values – does not carry an identity field
- Immutable
- Compared using a combination of all its values
- Can’t have side effects
- Money is a great value object. 100,000 means nothing without a unit – prime candidate for a value object
- You should strive to use value objects wherever possible rather than entities
- A time range, as described in the Pluralsight course is a great example as well – a start and an end date – and those may have additional methods
Domain Services
- Important operations that don’t belong to a particular Entity or Value Object
- Have interfaces defined in terms of other domain model elements
- Stateless (but may have side effects)
- Exist in the core of the app
- A domain service would be responsible for things like processing a payment
Resources We Like
- Domain-Driven Design Fundamentals by Julie Lerman and Steve Smith (available at Pluralsight)
- Modern Software Architecture: Domain Models, CQRS, and Event Sourcing by Dino Esposito (available at Pluralsight)
- Domain Driven Design – Tackling Complexity in the Heart of Software by Eric Evans (available at Amazon)
- http://DDDCommunity.org
- http://DomainLanguage.com
Tip of the Week
- Want help on your side project? Make it easy for others to help:
- Put your code on GitHub.
- Create a README with instructions on how to build and run the project.
- If it’s trivial, then it will be trivial to document.
- Create an issue describing the issue as “help wanted”
- Assign the issue to Joe. /8)
- Think you know PowerShell? Check out how Mike F Robbins gets our feed.
- Remarkable – Markdown parser, done right (available on GitHub).
- Format your JSON with ease:
Spread the Word
Do you know how you can help us? Tell someone about the show. That’s it. It’s that easy. And, we’d appreciate it. Super appreciate it.
And if you haven’t already, head to http://www.codingblocks.net/review to leave us a review. The world needs to hear your opinion.