The thing is that DM hooks are literally a thin wrapper around what I showed above. In that context, like I said, I am personally becoming more comfortable just using the OO tools at my disposal, especially since callbacks tend to become complex creatures with the addition of things like :if, and various supported callbacks forms. Being able to simply use a method *feels* right to me. YMMV, obviously. -- Yehuda
On Tue, Mar 10, 2009 at 11:29 AM, Rafael George <[email protected]>wrote: > > @Yehuda, but i really don't want to know what's the hook is doing in > this context, i just want to know what it will trigger. That's what i > feel is convenient but either way is good, at first i tried with > overriding the method but it did not work, maybe it was the way i had > the model at first. > > But i see your point, and i will have it in count too. What i'm > writing is an step by step guide to learn Merb/DataMapper/jQuery, > maybe the hook way is good to introduce it in that context. > > On Tue, Mar 10, 2009 at 11:20 AM, Yehuda Katz <[email protected]> wrote: > > Just FYI: Hooks are actually implemented identically to what I showed. I > am > > personally coming to prefer the super approach simply because it's more > > obvious what's going on, and if the internal implementation of hooks > > changes, I'm less likely to get bit in the ass. That said, I prefer > > before_filter in controllers, because there I *don't* want to know what's > > going on. I want the framework to hook in at an appropriate location. > > -- Yehuda > > > > On Tue, Mar 10, 2009 at 9:56 AM, Rafael Rosa <[email protected]> > wrote: > >> > >> As I commented before, from my point of view, using hooks is a cleaner > way > >> to do that: it's less intrusive in the sense that you're not changing > the > >> implementation of any methods, and more declarative, because the "before > >> :save, :add_interested" is read as a business rule, it's more explicit. > >> Another advantage is that you can add other rules without touching any > code > >> already written, which make it more stable, a kind of "open-closed > >> principle". > >> > >> But, in the end, taste is the tie breaker :) > >> > >> Cheers, > >> Rafael > >> www.rafaelrosafu.com > >> > >> > > > > > > > > -- > > Yehuda Katz > > Developer | Engine Yard > > (ph) 718.877.1325 > > > > > > > > > > > -- > Rafael George > > > > -- Yehuda Katz Developer | Engine Yard (ph) 718.877.1325 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "DataMapper" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/datamapper?hl=en -~----------~----~----~----~------~----~------~--~---
