Andrea Dallera <andrea / andreadallera.com> wrote:

> what i don't like is that if you want to make _your_ viewmodel do stuff
> on initialize, which is usual, you have to write your initialize method
> as such:
> 
> def initialize
>   super
>   #your stuff here
> end

I suppose you could change a bit the design and use a hook method
instead of initialize in the subclass. I mean, in the superclass you do
all your automagical initalization, then you call a (blank) hook method,
and later you redefine it when you build the new class. Something like
this:

class Parent
  def initalize
    # do automagic stuff
    configure
  end

  def configure
    # just a blank hook method
  end
end

class Child < Parent
  def configure
    # do some specific stuff
  end
end

-- 
MySQL and PHP are popular not because of their quality, but despite it.