From: Josh Cheek Date: 2012-04-20T08:53:13+09:00 Subject: Re: Why must I know whether I extend a class or a module? --0016e6de01135a0e6d04be10da6b Content-Type: text/plain; charset=ISO-8859-1 On Wed, Apr 18, 2012 at 3:22 PM, Eric C. wrote: > I can't pretend to know everything about Ruby, but I've read a bit about > metaprogramming, and I've never been sold on it being a good way to > write code. There may be uses that I don't know about, but I haven't > found them. Also, I see huge disadvantages to metaprogramming because > it hides you logic in a puzzle. > > Just because you can do something tricky, doesn't mean its advisable. > > -- > Posted via http://www.ruby-forum.com/. > > I think they make sense for gems, where you don't know who or how it is going to need this code. But for my own code, I rarely use metaprogramming. As an aside, the names seem backwards. Using "class XXX" and "def xxx" is more metaprogramming than "const_set XXX, Class.new" and "define_method xxx" --0016e6de01135a0e6d04be10da6b Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Wed, Apr 18, 2012 at 3:22 PM, Eric C. <lists@ruby-forum.com> wrote:
<= div class=3D"gmail_quote">
I can't pretend to know everything about Ruby, but I've read a bit = about
metaprogramming, and I've never been sold on it being a good way to
write code. =A0There may be uses that I don't know about, but I haven&#= 39;t
found them. =A0Also, I see huge disadvantages to metaprogramming because it hides you logic in a puzzle.

Just because you can do something tricky, doesn't mean its advisable.

I think they make sense for gems, w= here you don't know who or how it is going to need this code. But for m= y own code, I rarely use metaprogramming.

As an as= ide, the names seem backwards. Using "class XXX" and "def xx= x" is more metaprogramming than "const_set XXX, Class.new" a= nd "define_method xxx"
--0016e6de01135a0e6d04be10da6b--