[Seaside] Re: Re: Smalltalk design advice - how
tim at rowledge.org
Thu Dec 27 05:21:29 UTC 2007
On 26-Dec-07, at 8:04 PM, itsme213 wrote:
> "tim Rowledge" <tim at rowledge.org> wrote
>> companyProjects select:[:proj| proj teamIncludes:
> Thanks, I think I have got the query-don't-store idea. My question
> here is,
> assuming I want to know projects from a given employee (self):
> what is #companyProjects? An instance variable every employee?
> accessed through an instance variable of every employee (e.g. self
> Or something accessed through a global of some sort e.g.
> Company singleton companyProjects?
> Project allInstances?
> Something else?
All of the above :-)
I'd guess you might have a class for the Company - which could be as
simple as a collection of employees and project or as complex as ....
well a really complex thing with all sorts of legal and financial and
administrative and organisational stuff. As long as you have at least
the employees and projects for your current questions we're alright.
In this case I'd suggest the the instance variable 'companyProjects'
might be an OrderedCollection of (surprise!) the company's projects.
Similarly the 'companyEmployees' would likely be an OrderedCollection
of all the employees of the company.
'Company singleton' seems an unlikely thing to be useful; why would
you write code that limited you to a single company? Have you no
As a counterpoint to the advice you've been getting to avoid
bidirectional pointers, I should point out that there are of course
case where that is exactly what you do need. For example in Sophie the
content (the text and anchors and paragraphs and stuff) are kept in a
tree structure and we need to be able to scan up the tree from a leaf
to the root and to run down from any node to any leaf. We have to pay
the price for that in complexity when editing the tree to keep all the
pointing in the right direction. You would not believe how much pain
has been caused by 'simple text editing'. I wrote a lot of it and I
still don't believe it.
tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
The problem with the gene pool is that there is no lifeguard.
More information about the seaside