[LRUG] Rails - The Missing Parts
Stephen Best
bestie at gmail.com
Tue Mar 4 06:15:56 PST 2014
@Riccardo Using decorators over extend gives you
* No method / instance variable naming collisions (counts for private
methods too)
* Separate state
* Very obvious which decorations have been applied
* You can unwrap the decorators and get the original object back
The annoying this really is that the difference in effort is negligible yet
the module approach is widely cargo-culted.
Using modules to mix in behaviour is the same as inheritance and the
composition over inheritance argument has already been had.
On 4 March 2014 10:24, Riccardo Tacconi <rtacconi at gmail.com> wrote:
> I created this project (very incomplete) to try few things and one was
> DCI:
> https://github.com/rtacconi/scriptrunner/blob/master/app/contexts/runner_on_project.rb.
> Yes I used 'extend' but it is 'expensive' and using mixins seems okay to
> me. What's the advantage of using decorators?
>
>
> On 4 March 2014 09:37, Stephen Best <bestie at gmail.com> wrote:
>
>> Also why do Ruby developers insist on implementing DCI by mixing in
>> modules at runtime? It's just completely unnecessary, why not decorate?
>>
>>
>> Stephen Best
>>
>> +44 7745 790523
>> theaudaciouscodeexpiment.com
>> github.com/bestie
>> @thebestie
>>
>>
>> On 4 March 2014 09:35, Stephen Best <bestie at gmail.com> wrote:
>>
>>> DHH as usual saying the best way to design your objects is don't. GOOD
>>> LUCK WITH THAT.
>>>
>>>
>>> Stephen Best
>>>
>>> +44 7745 790523
>>> theaudaciouscodeexpiment.com
>>> github.com/bestie
>>> @thebestie
>>>
>>>
>>> On 3 March 2014 23:09, Mark Burns <markthedeveloper at gmail.com> wrote:
>>>
>>>> It's kind of similar, but DCI is kind of like a run-time only
>>>> ActiveSupport::Concern.
>>>> It's still a big bag o' methods, but a big dynamic bag of methods.
>>>> Maybe less chance of collisions, but
>>>> the principle is still the same as AS::Concern.
>>>> Interactors in the sense of the interactor gem are cleaner as you're
>>>> not polluting a potentially already
>>>> overloaded domain model/persistence object hybrid.
>>>>
>>>>
>>>> On 3 March 2014 22:18, Riccardo Tacconi <rtacconi at gmail.com> wrote:
>>>>
>>>>> Hi Tom,
>>>>>
>>>>> Your interactor reminds me the I part (interaction) of DCI, am I
>>>>> wrong? I see few similarities.
>>>>>
>>>>>
>>>>> On 3 March 2014 20:38, Tom Blomfield <tomblomfield at gmail.com> wrote:
>>>>>
>>>>>> Hi all,
>>>>>>
>>>>>> I wrote a blog post on Interactors in Rails -
>>>>>> http://eng.joingrouper.com/blog/2014/03/03/rails-the-missing-parts-interactors
>>>>>>
>>>>>> You might enjoy the discussion on HN, with DHH wading in
>>>>>> https://news.ycombinator.com/item?id=7335211
>>>>>>
>>>>>> Tom
>>>>>>
>>>>>> _______________________________________________
>>>>>> Chat mailing list
>>>>>> Chat at lists.lrug.org
>>>>>> http://lists.lrug.org/listinfo.cgi/chat-lrug.org
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Riccardo Tacconi
>>>>> Ruby on Rails and PHP development - System Administration
>>>>> VIRTUELOGIC LIMITED <http://www.virtuelogic.net/>
>>>>>
>>>>> http://github.com/rtacconi
>>>>> http://riccardotacconi.blogspot.com
>>>>> http://twitter.com/rtacconi
>>>>>
>>>>> _______________________________________________
>>>>> Chat mailing list
>>>>> Chat at lists.lrug.org
>>>>> http://lists.lrug.org/listinfo.cgi/chat-lrug.org
>>>>>
>>>>>
>>>>
>>>> _______________________________________________
>>>> Chat mailing list
>>>> Chat at lists.lrug.org
>>>> http://lists.lrug.org/listinfo.cgi/chat-lrug.org
>>>>
>>>>
>>>
>>
>
>
> --
> Riccardo Tacconi
> Ruby on Rails and PHP development - System Administration
> VIRTUELOGIC LIMITED <http://www.virtuelogic.net/>
>
> http://github.com/rtacconi
> http://riccardotacconi.blogspot.com
> http://twitter.com/rtacconi
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20140304/98b96827/attachment-0003.html>
More information about the Chat
mailing list