News for hackers. Stuff that matters.
Re:Better Software Design with Clean Architecture by UK-AL on Monday July 03, 2017 @06:57AM (#14687339)
This is actually a part of understanding the specific domain. How do the educational practitioners think about the problem for application your working on? Is the application student or course centric? This is big part of DDD, and involves working domain experts and getting inside each others heads.

You could defiantly model it as the Register method on the course. But this example shows how you can avoid people messing around with internals once you've modeled it. There is only one way of registering for a course.

Re:Better Software Design with Clean Architecture by mbrock on Monday July 03, 2017 @07:05AM (#14687367)
I wonder how to even formulate the question to the practitioners -- it seems like an artificial choice imposed by the computer formalism (single-dispatch OO).

In other words, I don't see how it is a domain question, and it seems likely that the domain practitioners just think "there are courses, and there are students, and students can be registered for courses".

My suspicion is that DDD would basically be better without the focus on single dispatch OO.

Re:Better Software Design with Clean Architecture by redy on Monday July 03, 2017 @07:10AM (#14687387)
See my comment below. The language of the business will almost always guide the design in the right direction. There are rare cases where the business is unaware of a more "essential truth." This isn't about OO it's about faithfully capturing the model of the domain which is all DDD is.
Re:Better Software Design with Clean Architecture by UK-AL on Monday July 03, 2017 @07:16AM (#14687410)
"students can be registered for course" - This is already implying an order.
Re:Better Software Design with Clean Architecture by mbrock on Monday July 03, 2017 @07:27AM (#14687452)
If I say "students can be registered for courses in the school" then you might think the OO model should be

    school.register(student, course)
which does actually seem reasonable to me. Here the school object would basically be the system's logic as a whole, and both the course and the student could just be IDs.

I really think single dispatch OO is a huge distraction and I haven't seen any strong arguments for its use as a general paradigm.

Re:Better Software Design with Clean Architecture by UK-AL on Monday July 03, 2017 @07:28AM (#14687457)
Nothing about DDD says you can't use multi-dispatch. If this how you think about the problem. Then this is your solution if your language is capable of expressing it.
Re:Better Software Design with Clean Architecture by mbrock on Monday July 03, 2017 @07:45AM (#14687541)
Yeah, I'm quite a big fan of Eric Evans and DDD. Especially the more high level parts about ubiquitous language, bounded contexts, anti-corruption layers, and many of the other patterns. Yet I think that the focus on single-dispatch OO kind of dates the book and makes it less general and beautiful, much like how the GoF's "Design Patterns" book is more banal than Christopher Alexander's work on pattern languages because of the overemphasis on specific implementations of single dispatch OO patterns (the notorious visitor pattern, for example).
Re:Better Software Design with Clean Architecture by konschubert on Monday July 03, 2017 @08:01AM (#14687610)
If the pairings of courses and students are registered in the school object, then that's basically OO implementation of a many to many relationship of students and courses.

That's why I like Django. You just tell it that you want a many-to-many between students and courses and it does they for you, symmetrically, without forcing you to introduce a class such as "school".

Re:Better Software Design with Clean Architecture by UK-AL on Monday July 03, 2017 @08:11AM (#14687658)
Bi-directional models come with their own problems.
Re:Better Software Design with Clean Architecture by jstimpfle on Monday July 03, 2017 @07:17AM (#14687418)
That's wishful thinking.
Re:Better Software Design with Clean Architecture by UK-AL on Monday July 03, 2017 @07:19AM (#14687423)
All your trying to do is match their language, so its easier to develop against a description of a use case. Technically either way allows you do what you want to do.
Re:Better Software Design with Clean Architecture by barrkel on Monday July 03, 2017 @07:02AM (#14687355)
I know there are ways to solve the problem; but I believe these are accidental complexities, not essential complexities. That is, these design solutions complect the problem, sacrificing simplicity for a dubious principle.
Re:Better Software Design with Clean Architecture by UK-AL on Monday July 03, 2017 @07:04AM (#14687360)
Actually I think this is a major advantage. They are not complexities, they are putting down into code how you think about your application in your head.

If your design is some data, which you can mutate however you want to get the job done, you don't really have model of the application.

Your business rules can become inconsistent because different developers are implementing different but similar methods in your business logic layer all applying slightly different rules. If the entities themselves enforce these rules, it become a lot less likely.