[TYPO3-50-general] FLOW3 and DDD
Nino Martincevic
don at zampano.com
Mon Jan 19 19:06:42 CET 2009
Hi Robert,
perhaps you are right and we just talk about different things.
Trying to clarify for me a bit here.
Robert Lemke schrieb:
> Hi Nino,
>
> we both know the books, we're talking about the same, but I've got the
> feeling that you misinterpret my mails. What you write about DD is
> certainly
> true, but it doesn't contradict what I wrote or how it is implemented in
> FLOW3.
I am sure I understood how you implemented it. Technically it is easy to
solve it this way. But I doubt that it is helpful.
Let me take the last example of two (empty) customers C1 and C2.
You would save them with the repository manager by uisng their hash code.
So e.g. let's take a form where I can register myself on your site.
I open two windows and two forms and type in exactly the same data on
page 1.
I submit both forms. Technically no problem, they are distinguished by
their hash code. Now I'm on the last page and save.
What happens now?
Either
a) I got two Customers in the DB, with two different DB Ids but
identical data (if there are no other unique constraints).
b) I get an exception in the second form with customer C2 saying that
such a customer already exists (C1).
So, if you say the first is true then it is just the problem of the
domain developer, right?
And in the second case it's also his problem but also with a solution
for avoiding duplicate identical objects being persisted.
That would not avoid the logical constraints clashes given by the
domain. But it would lead to better software because people could not
easily create "Object with identity" without identity.
BUT:
imagine my domain being held in cache or memory, I have such a case
here, I have in-memory (cached) entities I don't want to persist (they
are domain events but entities because I have to distinguish same but no
need for persisting).
I would have a problem with the current solution. Because I'd have
identical objects that I query by their identity attributes via their
repository and not their hash code.
What I ask myself: would it be very hard to obtain an unique key from
the developer before saving it with a repository manager? Technically
that would be no problem, because you could use again a hash internally,
but now a combination of the class and the parameters.
I think we are d'accord on what identity means.
But I'm sure this is an easy change in the Repository Manager at no cost.
But surely you know more of this, it's your baby ;-)
Nino
More information about the TYPO3-project-5_0-general
mailing list