Mat Schaffer on 7 Mar 2008 21:41:29 -0800


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Mixin's vs inheritance (was Re: [PhillyOnRails] refactoring controllers)

  • From: Mat Schaffer <schapht@gmail.com>
  • To: talk@phillyonrails.org
  • Subject: Re: Mixin's vs inheritance (was Re: [PhillyOnRails] refactoring controllers)
  • Date: Sat, 8 Mar 2008 00:41:19 -0500
  • Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:from:to:in-reply-to:content-type:content-transfer-encoding:mime-version:subject:date:references:x-mailer; bh=xe152W4wXm4jC/so3Moj2RPmsHuCiKNYWthEHJcivYg=; b=asRDMYEbW/X+gmAZKTILVlLl0sotSM6FKJO4rYPZ25R7CXJoJyB9dCv0DL9je9kIXUoIt3Zs0kaILN2jJTjdY8fcWfX4Bmk5zXvME7s8r4B0AaB9tFkGMZ0T3w+6N0EzunH+karOTNx9tAFQnJPkfh2azHRJwewCauOeTjbBzLg=
  • List-archive: <http://lists.phillyonrails.org/pipermail/talk>
  • Reply-to: talk@phillyonrails.org
  • Sender: talk-bounces@phillyonrails.org

On Mar 6, 2008, at 11:49 PM, Aaron Blohowiak wrote:
Now, if class A pushed most of its behavior into a module, you could just import that module into B and define initialize as you please. But, it didnt, so you are stuck with this stuff. I call it clonepatching. The downside to this approach is if you are attempting to discover where B's methods are defined using reflection.. it cannot really express its relationship to A (AFAIK, please correct me if you have a solution to this dilemma.)

Well played, my friend. I don't see any clear solution around that. I wonder if you could inherit from X and do some craziness to include A's functions as a module, but that'd probably be way uglier than the module approach. Score one for mixins. Although despite this I still feel like make_resourceful's syntax is a DSL in search of a domain.
-Mat
_______________________________________________
To unsubscribe or change your settings, visit:
http://lists.phillyonrails.org/mailman/listinfo/talk