[LRUG] Conditional Style (was: To debug the impossible bug)

Tom Stuart tom at therye.org
Wed Aug 3 06:43:48 PDT 2011


On 3 Aug 2011, at 14:29, Simon Coffey wrote:

> On 3 August 2011 13:55, Tom Stuart <tom at therye.org> wrote:
>> 
>> Since we're all bamboozled by the bug and would rather discuss code style... ;)
> 
> Nice to have company, at least. :-)
> 
>> My preference is to favour polymorphism and have all the objects which a page can be about, implement a method providing that description, something like:
>> 
>> class Question
>>  def description_for_page
>>    self.background
>>  end
>> end
> 
> I agree, eliminating the conditional with polymorphism would be hugely
> preferable, but it feels a bit wrong putting view stuff in the
> business logic.

Yes, I agree. There's still this code smell after my suggested refactoring-sketch; I try to think about things one step at a time where possible.

Draper looks interesting - thanks for the link!

Cheers,

Tom




More information about the Chat mailing list