this post was submitted on 22 Jun 2023
4 points (100.0% liked)

Domain-Driven Design

258 readers
2 users here now

"Domain-Driven Design is an approach to software development that centers the development on programming a domain model that has a rich understanding of the processes and rules of a domain. The name comes from a 2003 book by Eric Evans that describes the approach through a catalog of patterns. Since then a community of practitioners have further developed the ideas, spawning various other books and training courses. The approach is particularly suited to complex domains, where a lot of often-messy logic needs to be organized." -- Martin Fowler (link)

Rules

  1. Follow programming.dev rules
  2. Be excellent to each other, no hostility towards users for any reason
  3. No spam of tools/companies/advertisements. It’s OK to post your own stuff part of the time, but the primary use of the community should not be self-promotion.

founded 2 years ago
MODERATORS
 

This video shows a really nice and clear example of refactoring an anemic domain model into a rich one.

top 3 comments
sorted by: hot top controversial new old
[–] canpolat 2 points 2 years ago (1 children)

Good talk. Watching refactoring is fun.

I feel like most of what he talks about is common knowledge now. But then again, I stumble upon code written by experienced developers that is just like the one he started with: unclear responsibilities, poor encapsulation, etc. What is even worse is: I sometimes catch myself writing code like that :)

What we do requires continuous attention to detail. We sometimes get tired or lose focus. And that may result in poor quality code. However, that's only one reason to end up with such code. I think the other (and more common) reason is accumulating functionality. Einar Høst's talk about technical debt touches upon that aspect. You start with a beautiful model. But then if statements start raining on it. If we are not diligent, we end up with a mess.

[–] sisyphean 2 points 2 years ago (1 children)

I feel like most of what he talks about is common knowledge now.

You would be surprised how uncommon this knowledge is, and how many developers I introduced to domain modeling by sending them this video :)

What we do requires continuous attention to detail. We sometimes get tired or lose focus. And that may result in poor quality code.

This is definitely true. I think maintaining and adding features to existing software is a lot like gardening. There are always tiny chores to do, you need to be constantly reorganizing small parts of the garden, there are always new opportunities for small improvements, and if you neglect doing them for a while, the problems add up, and the entire thing ends up looking messy and terrible to work with.

[–] canpolat 2 points 2 years ago

Was it Voltaire who said "Common sense is not so common"? I agree with your gardening analogy. It has an element of zen in it (just like gardening).