--
You received this message because you are subscribed to the Google Groups "object-composition" group.
To unsubscribe from this group and stop receiving emails from it, send an email to object-composit...@googlegroups.com.
To post to this group, send email to object-co...@googlegroups.com.
Visit this group at http://groups.google.com/group/object-composition.
For more options, visit https://groups.google.com/d/optout.
On 26 Oct 2014, at 18:06, rune funch <funchs...@gmail.com> wrote:I think the main issue with The build in ruby features we've discussed is that role methods are leaked ie they are available even when the object is not playing that particular role either because the context has ended it's lifespan or because we're in another context where the same object plays a role. Don't know if this is true for refinement based approaches.
The second objection I've heard was speed but that was specific to extend based solutions (Those two objections were the main reason why I created the maroon gem). The down side of that is that you move to a more static view of objects than what you generally have in Ruby
As Matz described it, refinement fixes both of these problems.
On 26 Oct 2014, at 21:47, Matthew Browne <mbro...@gmail.com> wrote:If this means that a correct DCI implementation (or very close) is possible in native Ruby, that brings up the question of what the official Ruby DCI examples should be written in. Currently, the example on fulloo.info is written in native Ruby. Would it be better to update it to use Ruby's refinement feature, or to post a version using Maroon so the syntax is more ideal for DCI (along with an explanation that Maroon is required)? I think perhaps the best thing would be to post both versions...
--
You received this message because you are subscribed to a topic in the Google Groups "object-composition" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/object-composition/AsvEI7iJSDs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to object-composit...@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "object-composition" group.
To unsubscribe from this group and stop receiving emails from it, send an email to object-composit...@googlegroups.com.
module MoneyTransfer@MoneySource, @MoneySink
refine MoneySource do....endrefine MoneySink do....endend
The issues with refinements in the past, as I saw it, was that firstly it was an experimental feature and wasn't a part of standard Ruby until the 2.1 release. You could use it, but most developers would not compile Ruby with the proper settings to enable it.The other issue with both Ruby and refinements is that the objects never lose their roles.While you can contextually alter the features of a module in Ruby using the refine keyword, if you extend an object like this:role_player.extend(RoleModule)... that role_player object never loses its role. It will forever (until the object goes through garbage collection) return true if you ask if role_player.is_a?(RoleModule)This presents the problem that a user object could accidentally be marked as an Employee and Manager in the same context where it should only be one or the other.Ruby has no "unextend" behavior to remove the role from the ancestry.If the original example code would be used to get around this, I don't understand how.If Matz is agreeable to adding something like:object.role-name.method arg argto the parser, that would be fantastic. I'm not exactly clear how that "role-name" part would reconcile with the related module but if there is some contextual method lookup then that pretty much solves Ruby's problem with DCI.Have I misunderstood any part of this?
— Copemailto: try...@ifi.uio.no
Morgedalsvn. 5A http://folk.uio.no/trygver/
N-0378 Oslo http://fullOO.info
Norway Tel: (+47) 22 49 57 27
AFAICR, the main problem with Ruby and other languages is not to add functionality just in time, but to get rid of it when it's no longer needed.
AFAICR, the main problem with Ruby and other languages is not to add functionality just in time, but to get rid of it when it's no longer needed.
Also, in BabyIDE an object is forced to execute a role method without it ever becoming part of the object's class. This avoids any name clashes with the object's local behavior and the behavior of any other roles the object may be mapped to at the same time.
--
--
You received this message because you are subscribed to the Google Groups "object-composition" group.
To unsubscribe from this group and stop receiving emails from it, send an email to object-composit...@googlegroups.com.
To post to this group, send email to object-co...@googlegroups.com.
Visit this group at http://groups.google.com/group/object-composition.
For more options, visit https://groups.google.com/d/optout.
On 28 Oct 2014, at 01:30, Jim Gay <j...@saturnflyer.com> wrote:AFAICR, the main problem with Ruby and other languages is not to add functionality just in time, but to get rid of it when it's no longer needed.
Finally: Who are we to prohibit future programmers to give all three role methods the same name? (e.g., computeDistance)
My main torture test is the following:
My main torture test is the following:
It's a bad code example, but does the torturing job pretty well.
i.e.* objects (without classes) as role players
* accessing role player properties
Should be OK* multiple contexts
* method name clashes inside a context
* role name clashes between different contexts
* multiple roles for a role player
* calling method on role player when passed into a function outside of context
* callbacks into context role methods
* at the end of the scenario, the role players should be the same(given object player before and after the Tournament call, it should be impossible to tell the difference between them)
--
You received this message because you are subscribed to the Google Groups "object-composition" group.
To unsubscribe from this group and stop receiving emails from it, send an email to object-composit...@googlegroups.com.
To post to this group, send email to object-co...@googlegroups.com.
Visit this group at http://groups.google.com/group/object-composition.
For more options, visit https://groups.google.com/d/optout.
On 28.10.2014 11:57, Egon Elbre wrote:
Should be OKMy main torture test is the following:
It's a bad code example, but does the torturing job pretty well.
i.e.* objects (without classes) as role players
Should be OK if it is through messages in the RoleObjectContract.* accessing role player properties
Should be OK* multiple contextsShould be OK* method name clashes inside a contextShould be OK* role name clashes between different contexts
Should be OK* multiple roles for a role player
I don't think I understand this one.* calling method on role player when passed into a function outside of context
A role method can call a method in the role player. This method can, in principle, do anything.
But the DCI separation of concerns limit the useful 'anything'. Intuitively, I think that it should not access other role-players 'behind the scenes'. This point needs more work on it.
Roles and role players cannot be visible outside their context because role methods reference other roles in the context.
Good point. I should like to see callbacks into the context object, and I believe this should be possible. I can't see callbacks into roles via role methods. An object cannot uniquely identify which role it is playing at a given point in time. (if there are moe than one candidate)* callbacks into context role methods
Lion : {say: function() {console.log(Id + " [" + this.name + "] " + "Meow.....");},fight: function() {// invoking role method via callbackcallback(function(){Lion.say();});}}
??? Both role-object mapping and the state of the role-playing objects may have changed* at the end of the scenario, the role players should be the same(given object player before and after the Tournament call, it should be impossible to tell the difference between them)