[Seaside] List views style question

Steven Baker steven at stevenrbaker.com
Sat May 1 08:50:53 UTC 2010


Heya folks,

I have a small style question. At least, I think it's a style question.

Consider a ProposalListView which has a single instance variable proposalView, which is an instance of ProposalView. ProposalView has a proposal: accessor. I currently have a small number of proposals (less than 5 at a time) so I do the following:

ProposalListView renderContentOn: html
	html heading: 'Proposals'.
	Proposal proposals do: [ :each | html render: (proposalView with: each) ].

This works to display all of my proposals, but I can't help but feel that I should be pre-populating an array of ProposalViews ahead of time for rendering. I have a gut feeling that tells me I should instead have a proposalViews instance variable containing an array of the views, like so:

PoposalListView initialize
	super initialize.
	proposalViews := Array new.
	Proposal proposals do: [ :each | proposalViews add: ProposalView new proposal: each ]

(I've written the code above to simplify the idea; please forgive any errors.)

Is there a technical reason why my code should be written in one way or the other? Perhaps I'm missing the point entirely, and I should be writing this completely differently?

Thanks,

-Steven



More information about the seaside mailing list