gateway.save(...);
id = gateway.get_id_of_last_registered_object();
--
The only way to go fast is to go well.
---
You received this message because you are subscribed to the Google Groups "Clean Code Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clean-code-discu...@googlegroups.com.
To post to this group, send email to clean-code...@googlegroups.com.
Visit this group at http://groups.google.com/group/clean-code-discussion.
So it is an exception?It is not that I am saying that there cannot ever be any exceptions. Perhaps that is one part of being a pragrammatic programmer. To allow yourself to break some patterns.Do you agree that "save()" feels like a command function?Could you elaborate on "Furthermore, the Principle of Least Astonishment and the SRP are respected."?
On Sat, Jan 10, 2015 at 5:12 PM, Julien <jh.w3...@gmail.com> wrote:
I guess that it is because there is no other way of doing it.
Furthermore, the Principle of Least Astonishment and the SRP are respected.
Temporary coupling like this feels wrong :
gateway.save(...);
id = gateway.get_id_of_last_registered_object();
--
The only way to go fast is to go well.
---
You received this message because you are subscribed to the Google Groups "Clean Code Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clean-code-discussion+unsub...@googlegroups.com.
To post to this group, send email to clean-code...@googlegroups.com.
Visit this group at http://groups.google.com/group/clean-code-discussion.
--
The only way to go fast is to go well.
---
You received this message because you are subscribed to the Google Groups "Clean Code Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clean-code-discu...@googlegroups.com.
To post to this group, send email to clean-code...@googlegroups.com.
Visit this group at http://groups.google.com/group/clean-code-discussion.
To unsubscribe from this group and stop receiving emails from it, send an email to clean-code-discussion+unsub...@googlegroups.com.
To post to this group, send email to clean-code...@googlegroups.com.
Visit this group at http://groups.google.com/group/clean-code-discussion.
To unsubscribe from this group and stop receiving emails from it, send an email to clean-code-discu...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to clean-code-discussion+unsub...@googlegroups.com.
To post to this group, send email to clean-code...@googlegroups.com.
Visit this group at http://groups.google.com/group/clean-code-discussion.
To unsubscribe from this group and stop receiving emails from it, send an email to clean-code-discu...@googlegroups.com.
To post to this group, send email to clean-code...@googlegroups.com.
Visit this group at http://groups.google.com/group/clean-code-discussion.
Well if it is a technical key, would you really generate that in the useCase class?
On Wed, Jan 14, 2015 at 1:58 PM, Dirk Dreyer-Hochstein <pro...@t-online.de> wrote:
Hi,
another option for the ID would be to "calculate" it before the save. The book "Implementing Domain-Driven-Design" shows it and its really a nice idea because you can save an object and use the ID already for other connected objects if needed.
Am Montag, 12. Januar 2015 16:53:06 UTC+1 schrieb Lasse Bergström:
One way of addressing the issue could be to use the natural id instead of a technical id, e.g. database id.For example when storing a person/user to use username, which should be unique, or social security number. Some natural id which the user/client is providing.Then when adding things to the entity the client need not to get hold of the technical id but could use the natural id instead.
On Mon, Jan 12, 2015 at 4:16 PM, Colin Williams <lac...@gmail.com> wrote:
It does seem natural to return something related to the saved object, especially on creation.Actually, if you think about "new" in most languages, it violates command query separation in much the same way (constructing the object and returning it). This is allowed in Command Query Separation because it's considered initialization. Maybe, instead of thinking of save as a command, we think of it as initialization in some form of persistence.
On Saturday, January 10, 2015 at 7:10:07 AM UTC-5, Lasse Bergström wrote:In the Java Case Study a Gateway is implemented. In that gateway there is a save function. To me save sounds like a command function and not a query one.How is it then that it was chosen to return the object it was saved? I can see one reason. In order to connect other things to the newly created and saved entity we need some kind of id. That id is established at the moment when the save function is executed. I see need for that.It still bothers me that the save function does not feel like a query function. Still it returns something.Is this an exception the command-query pattern?Best regards /Lasse
--
The only way to go fast is to go well.
---
You received this message because you are subscribed to the Google Groups "Clean Code Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clean-code-discussion+unsubscri...@googlegroups.com.
To post to this group, send email to clean-code...@googlegroups.com.
Visit this group at http://groups.google.com/group/clean-code-discussion.
--
--
The only way to go fast is to go well.
---
You received this message because you are subscribed to the Google Groups "Clean Code Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clean-code-discussion+unsub...@googlegroups.com.
To post to this group, send email to clean-code...@googlegroups.com.
Visit this group at http://groups.google.com/group/clean-code-discussion.