[Seaside] refactoring large renderContentOn: methods...

Philippe Marschall philippe.marschall at gmail.com
Thu Jul 20 06:26:30 UTC 2006


2006/7/20, Rick Flower <rickf at ca-flower.com>:
> I've got one renderContentOn: method for one of my web-app classes (and
> believe that I'll probably have this sort of issue with some of my other
> rendering classes as well) and would like to break-apart some of the
> content into smaller pieces that can then be directly rendered by the
> aforementioned renderContentOn: method.  I tried using perform: but am
> not really sure how it works (and I didn't get it to work), but it
> looked similar to what I'm looking for (I saw it in some of the Seaside
> example test code).  Anyway, just wondering if this is do-able or not
> and if so, what's the best method?

Break it up into several renderXXXOn: methods and send them from
renderContentOn:. If you can live with pretty printing you can use
extract method refactoring (hope it works).

ex

renderContentOn: html
    self renderHeaderOn: html.
    self renderFormOn: html.
    self renderFooterOn: html

if you want it to do with a perform

renderContentOn: html
    #(renderHeaderOn: renderFormOn: renderFooterOn:) do: [ :each |
        self perform: each with: html ]

Philippe


More information about the Seaside mailing list