From: Dave Thomas Date: 2003-05-02T04:38:06+09:00 Subject: Re: [OO interface design] Pass-by reference VS encapsulation ? Simon Vandemoortele wrote: > Wouldn't I still need an object that keeps track of all the instantiated > contacts. How else am I going to generate a sorted list of contact names > for the UI ? Surely all the Contacts that you search are the persisted ones: you don't want folks looking at possibly inconsistent reified ones. > Who is going to answer sophisticated search queries (give > me all contacts born between 1977 and 1987.) I could achieve this using > the ObjectsSpace in my client but is that really good design ? > Especially since many clients are probably going to want that query > functionality ... Why not Contact itself? For example, in my web application, class User has class methods User.user_with_name(name) -> aUser User.user_with_email(email) -> aUser User.list_matching(criteria) -> Array[user...] where 'criteria' is an object representing search criteria, tied indirectly in to my persistence layer. Anyway, a suggestion. Code your application. Code it many different ways. And see what you think of each. In some versions make a point of relaxing what you believe to be good design practices in favor of doing what seems natural. In others, design the snot out of it. And in the end, see which application feels 'right.' And please let us know. Cheers Dave