--
You received this message because you are subscribed to the Google Groups "object-composition" group.
To post to this group, send email to object-co...@googlegroups.com.
To unsubscribe from this group, send email to object-composit...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/object-composition?hl=en.
To post to this group, send email to object-composition@googlegroups.com.
To unsubscribe from this group, send email to object-composition+unsub...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/object-composition?hl=en.
To post to this group, send email to object-composition@googlegroups.com.
To unsubscribe from this group, send email to object-composition+unsub...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/object-composition?hl=en.
To post to this group, send email to object-composition@googlegroups.com.
To unsubscribe from this group, send email to object-composition+unsub...@googlegroups.com.
I have absolutely no experience in Scala. But I'm wondering why did you prefer private methods instead a of private inline class?
To post to this group, send email to object-co...@googlegroups.com.
To unsubscribe from this group, send email to object-composit...@googlegroups.com.
To post to this group, send email to object-co...@googlegroups.com.
To unsubscribe from this group, send email to object-composit...@googlegroups.com.
To post to this group, send email to object-co...@googlegroups.com.
To unsubscribe from this group, send email to object-composit...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/object-composition?hl=en.
--
You received this message because you are subscribed to the Google Groups "object-composition" group.
To view this discussion on the web visit https://groups.google.com/d/msg/object-composition/-/9M-Dcepre94J.
To post to this group, send email to object-co...@googlegroups.com.
To unsubscribe from this group, send email to object-composit...@googlegroups.com.
To post to this group, send email to object-composition@googlegroups.com.
To unsubscribe from this group, send email to object-composition+unsub...@googlegroups.com.
To post to this group, send email to object-composition@googlegroups.com.
To unsubscribe from this group, send email to object-composition+unsub...@googlegroups.com.
To post to this group, send email to object-composition@googlegroups.com.
To unsubscribe from this group, send email to object-composition+unsub...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/object-composition?hl=en.
--
You received this message because you are subscribed to the Google Groups "object-composition" group.
To view this discussion on the web visit https://groups.google.com/d/msg/object-composition/-/9M-Dcepre94J.
To post to this group, send email to object-composition@googlegroups.com.
To unsubscribe from this group, send email to object-composition+unsub...@googlegroups.com.
To post to this group, send email to object-composition@googlegroups.com.
To unsubscribe from this group, send email to object-composition+unsub...@googlegroups.com.
To post to this group, send email to object-composition@googlegroups.com.
To unsubscribe from this group, send email to object-composition+unsub...@googlegroups.com.
To post to this group, send email to object-composition@googlegroups.com.
To unsubscribe from this group, send email to object-composition+unsub...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/object-composition?hl=en.
--
You received this message because you are subscribed to the Google Groups "object-composition" group.
To view this discussion on the web visit https://groups.google.com/d/msg/object-composition/-/9M-Dcepre94J.
To post to this group, send email to object-composition@googlegroups.com.
To unsubscribe from this group, send email to object-composition+unsub...@googlegroups.com.
Oh yes you're right overlooked the way Marvin does that. Although my major question comes from the interaction taking place inside the roles like with Marvin. I might have missed the discussion on that so I'll look it up and join the debate there.
Although I don't see why one would want to pass the context I would rather argue that you only need to pass the role it interacts with.
From my point contexts knows its roles and visa-versa isn't required. Specially since Roles only exist in their own context and thus can't be accessed from the outside.
To post to this group, send email to object-co...@googlegroups.com.
To unsubscribe from this group, send email to object-composit...@googlegroups.com.
To post to this group, send email to object-co...@googlegroups.com.
To unsubscribe from this group, send email to object-composit...@googlegroups.com.
To post to this group, send email to object-co...@googlegroups.com.
To unsubscribe from this group, send email to object-composit...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/object-composition?hl=en.
--
You received this message because you are subscribed to the Google Groups "object-composition" group.
To view this discussion on the web visit https://groups.google.com/d/msg/object-composition/-/9M-Dcepre94J.
To post to this group, send email to object-co...@googlegroups.com.
To unsubscribe from this group, send email to object-composit...@googlegroups.com.
To post to this group, send email to object-co...@googlegroups.com.
To unsubscribe from this group, send email to object-composit...@googlegroups.com.
To post to this group, send email to object-co...@googlegroups.com.
To unsubscribe from this group, send email to object-composit...@googlegroups.com.
To post to this group, send email to object-co...@googlegroups.com.
To unsubscribe from this group, send email to object-composit...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/object-composition?hl=en.
--
You received this message because you are subscribed to the Google Groups "object-composition" group.
To view this discussion on the web visit https://groups.google.com/d/msg/object-composition/-/9M-Dcepre94J.
To post to this group, send email to object-co...@googlegroups.com.
To unsubscribe from this group, send email to object-composit...@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "object-composition" group.
To view this discussion on the web visit https://groups.google.com/d/msg/object-composition/-/dVF84-MuYVwJ.
To post to this group, send email to object-co...@googlegroups.com.
To unsubscribe from this group, send email to object-composit...@googlegroups.com.
To post to this group, send email to object-composition@googlegroups.com.
To unsubscribe from this group, send email to object-composition+unsub...@googlegroups.com.
To post to this group, send email to object-composition@googlegroups.com.
To unsubscribe from this group, send email to object-composition+unsub...@googlegroups.com.
To post to this group, send email to object-composition@googlegroups.com.
To unsubscribe from this group, send email to object-composition+unsub...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/object-composition?hl=en.
--
You received this message because you are subscribed to the Google Groups "object-composition" group.
To view this discussion on the web visit https://groups.google.com/d/msg/object-composition/-/9M-Dcepre94J.
To post to this group, send email to object-composition@googlegroups.com.
To unsubscribe from this group, send email to object-composition+unsub...@googlegroups.com.
To post to this group, send email to object-composition@googlegroups.com.
To unsubscribe from this group, send email to object-composition+unsub...@googlegroups.com.
To post to this group, send email to object-composition@googlegroups.com.
To unsubscribe from this group, send email to object-composition+unsub...@googlegroups.com.
To post to this group, send email to object-composition@googlegroups.com.
To unsubscribe from this group, send email to object-composition+unsub...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/object-composition?hl=en.
--
You received this message because you are subscribed to the Google Groups "object-composition" group.
To view this discussion on the web visit https://groups.google.com/d/msg/object-composition/-/9M-Dcepre94J.
To post to this group, send email to object-composition@googlegroups.com.
To unsubscribe from this group, send email to object-composition+unsub...@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "object-composition" group.
To view this discussion on the web visit https://groups.google.com/d/msg/object-composition/-/dVF84-MuYVwJ.
To post to this group, send email to object-composition@googlegroups.com.
To unsubscribe from this group, send email to object-composition+unsub...@googlegroups.com.
Tom B:
"I have absolutely no experience in Scala. But I'm wondering why did you prefer private methods instead a of private inline class?"
Tom B:
"Although I'm not questioning the way it is implemented. I'm questioning why it is implemented the way it is."
Tom B:
"It basically comes back to the way to the way I see the context and the way you see it. Rather than continuing here. I'll combine this one with the one Trygve posted over here ( https://groups.google.com/d/topic/object-composition/8Qe00Vt3MPc/discussion ) on the DCI-evolution list, cause I feel it is rather the same discussion."
"To me a Role is always defined in terms of its relationships to other roles. ... the definition of Role cannot be separated from the Context. By the same token, a Context is defined largely by its roles and interactions."
"Yes. A role is internal to its context and has no meaning outside it.
BUT, some people feel that this may be too strict. I suspect there might be something interesting hidden here, but I do not now what it is. We must look elsewhere, because simply sharing roles between different contexts makes no sense."
To view this discussion on the web visit https://groups.google.com/d/msg/object-composition/-/9M-Dcepre94J.
To post to this group, send email to object-co...@googlegroups.com.
To unsubscribe from this group, send email to object-composit...@googlegroups.com.
2012/5/13 Tom B. <t.b...@gmail.com>
To unsubscribe from this group, send email to object-composition+unsubscribe@googlegroups.com.
To unsubscribe from this group, send email to object-composition+unsubscribe@googlegroups.com.
To unsubscribe from this group, send email to object-composition+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/object-composition?hl=en.
--
You received this message because you are subscribed to the Google Groups "object-composition" group.
To view this discussion on the web visit https://groups.google.com/d/msg/object-composition/-/9M-Dcepre94J.
Hi,
I know this thread is a bit old, but never the less I find it very interesting. The Marvin-inspired syntax looks really nice, but even the pure Scala, with prefixed role methods, is a usable solution, I think. Especially with the use of Scala duck-typing to define role contracts.
I have one issue with the use of context-private methods to implement role methods, though. And that is that by having every role method globally accessible inside the context I see no way to decompose role method impementations using private methods, like you would do in almost any other case to increase clarity, and have the code communicate which metods are considered public role methods and which are purely decomposed implementation. Have this been discussed previously or is there in general no such need in the DCI paradigm?
Regards,
Jörgen
@Ant
Your Account object is missing one of those methods or return values or parameter types for those methods are wrong.
Just implement increaseBalance(amount :BigDecimal): Unit and balance : BigDecimal in Account class and that should work.
--
You received this message because you are subscribed to the Google Groups "object-composition" group.
To view this discussion on the web visit https://groups.google.com/d/msg/object-composition/-/NPRJgNwV25cJ.
@Ant
Just implement increaseBalance(amount :BigDecimal): Unit and balance : BigDecimal in Account class and that should work.
On Sunday, 13 May 2012 10:16:41 UTC+2, Risto Välimäki wrote:Now, this IS heavy stuff! (+ some 111s here)
--
You received this message because you are subscribed to the Google Groups "object-composition" group.
To view this discussion on the web visit https://groups.google.com/d/msg/object-composition/-/70UawIxuHu4J.
Hi Marc,
I saw your approach using macros some week ago, and I was impressed. But since then I've been following the discussion on this list regarding wether method injection is a good way to implement DCI in laguages available today and I've found my self leaning towards saying NO, due to problems with role methods affecting the objects even outside the contexts where they belong. Not going deeper into the discussion here as it is available in a resent thread on this list.
Then I found Ristos injection-less approach and I think it embodies the spirit of DCI even though, when it comes to role-method-prefixes, does it based on convention rather than compliation support. And that's where my thoughts on public versus private role methods arose.
>
> Duck typing doesn't really give you type safety - only type signature safety! Two different Data objects might have the same decreaseBalance(amount: BigDecimal) signature and do completely different things with that amount!
Isn't that the intention, that different data objects (or other contexts) should be able to play a role in a context if they fulfill the role contract?
> One might start a nuclear war as a side effect and the other printing the amount to the console. Without being able to tell the difference in advance, you can end up with nasty surprises - which defeats one of the purposes of dci.
I think it is up to the code constructing and executing the context to make sure the right implementations are supplied.
>
> I think it's also closer to the end user mental model of a Role when the behavior of that Role "belongs" to that Role. I want Role methods to belong to a Role name space (as they do in my Role traits). With the duck typing solution, Role methods with RoleName-prefixes all hang around in a collective Context name space. The RoleName-prefix could be misspelled and the compiler wouldn't care. Someone new on the team might go ahead reusing Role methods between Roles and give the methods random name-prefixes reflecting "shared functionality". And then we're down the path of blurring Role boundaries, loosing the connection to the mental model and not doing DCI anymore.
Yes, I mostly agree with this. That is somewhat inline with my thought of lack of support for role-private methods. This got me started on thinking about a wrapped approach, but I've understood it is also rather questionable as a badis or a DCI-implementation. I havn't been able to find a discusdion on that as detailed as the one on method injection, so I can't really see all pros and cons.
BR,
Jörgen
23.12.2012 19.50 "Jörgen Andersson" <jorgen.x....@gmail.com> kirjoitti:
>
> Hi Marc,
>
> I saw your approach using macros some week ago, and I was impressed. But since then I've been following the discussion on this list regarding wether method injection is a good way to implement DCI in laguages available today and I've found my self leaning towards saying NO, due to problems with role methods affecting the objects even outside the contexts where they belong. Not going deeper into the discussion here as it is available in a resent thread on this list.
>
> Then I found Ristos injection-less approach and I think it embodies the spirit of DCI even though, when it comes to role-method-prefixes, does it based on convention rather than compliation support. And that's where my thoughts on public versus private role methods arose.
>
Actually my intention is to make a compiler plugin to get rid of Role_method() syntax. That Role_method() thing (that was scarying Ant, btw) is something that only compiler should ever see. Earlier on this "thread" you can find what's the actual code like. As far as I remember, syntax should be like:
class MoneyTransfer( ... role contracts here ...) {
.. constructors and entry points here...
Role Source {
def transferTo(...) {}
}
Role Foo {
def bar() = ...
}
}
I started writing the compiler plugin and managed to find all Role and Role method definitions, but being almost Scala illiterate I had hard times manipulating immutable trees and then I've been far too busy.
I haven't even checked Marc's code yet even it looked very interesting.
> >
> > Duck typing doesn't really give you type safety - only type signature safety! Two different Data objects might have the same decreaseBalance(amount: BigDecimal) signature and do completely different things with that amount!
Compiler checked duck typing + the fact that you as a developer allow Account to play role Moneytransfer::Source combined gives pretty much type safety for me, but yes, you never know for sure.
That is exactly same thing with Interfaces: you can just hope that they are implemented right. Even common super class / Trait doesn't guarantee that everything works as expected, since that method might have been overrided by wrong implementation.
>
> Isn't that the intention, that different data objects (or other contexts) should be able to play a role in a context if they fulfill the role contract?
Yes, that's intented. Biggest reason for this is that we don't want to pollute and also change all the time the structure / base of our application (what-the-system-is part). By not changing structure all the time when we need a new functionality also gives us more safety that our behaviour / what-the-system-does part is not constantly suffering for regressions.
>
> > One might start a nuclear war as a side effect and the other printing the amount to the console. Without being able to tell the difference in advance, you can end up with nasty surprises - which defeats one of the purposes of dci.
>
> I think it is up to the code constructing and executing the context to make sure the right implementations are supplied.
>
> >
> > I think it's also closer to the end user mental model of a Role when the behavior of that Role "belongs" to that Role. I want Role methods to belong to a Role name space (as they do in my Role traits). With the duck typing solution, Role methods with RoleName-prefixes all hang around in a collective Context name space. The RoleName-prefix could be misspelled and the compiler wouldn't care. Someone new on the team might go ahead reusing Role methods between Roles and give the methods random name-prefixes reflecting "shared functionality". And then we're down the path of blurring Role boundaries, loosing the connection to the mental model and not doing DCI anymore.
>
> Yes, I mostly agree with this. That is somewhat inline with my thought of lack of support for role-private methods. This got me started on thinking about a wrapped approach, but I've understood it is also rather questionable as a badis or a DCI-implementation. I havn't been able to find a discusdion on that as detailed as the one on method injection, so I can't really see all pros and cons.
>
> BR,
> Jörgen
>