On Tue, 2010-04-13 at 09:06 -0700, Luke Kanies wrote:
> On Apr 13, 2010, at 12:22 AM, Brice Figureau wrote:
> 
> > On Mon, 2010-04-12 at 21:58 -0700, Luke Kanies wrote:
> >> +1
> >>
> >> The construct that includes a blank module vs. the compression module
> >> is a bit weird.  You don't necessarily need to change it, but might  
> >> it
> >> be simpler if you just had a hook that allowed you to conditionally
> >> include it or not?
> >
> > Yes, I suck at metaprogramming, but the good news is that I started
> > reading the book :-)
> >
> > So you're proposing something like this:
> >
> > module Puppet::Network::HTTP::Compression
> >
> >   def include_compression
> >       include Puppet.features.zlib? ? Active : None
> >   end
> >   ...
> > end
> >
> > And then use include_compression in the other classes.
> 
> I meant more something like this:
> 
> module Puppet::Network::HTTP::Compression
>       def supported?
>               include Puppet.features.zlib?
>       end
> end
> 
> class ...
>       include Puppet::Network::HTTP::Compression if  
> Puppet::Network::HTTP::Compression.supported?
> end
> 
> I'm not sure this is a lot better, because the caller is now exposed  
> to that logic, but the whole stub module thing is at least weird  
> enough that it stuck out to me.

But then I have to make sure everywhere the compression methods are used
that compression is supported before calling them.
I prefer to call stubs, this way compression is transparent to the
client code, and the inner workings are not exposed.
-- 
Brice Figureau
Follow the latest Puppet Community evolutions on www.planetpuppet.org!

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" 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/puppet-dev?hl=en.

Reply via email to