Seems to me that this issue is the responsibility of the People class. So if the phones implement <=> then you can use uniq on the collection, in People.
It should probably be the responsibility of the People class to create Phones, and it would be at this point that you would do the duplicate check. > On Oct 19, 2015, at 12:17 PM, Peter Fitzgibbons <[email protected]> > wrote: > > So, I've been on a couple of projects now that I've used complex-objects (nee > hash/array trees) on Nosql dbs, and have been coding as-FP-as-I-can-get with > the processing of the tree, for instance when calculating aggregations > against many docs or verifying input. In general my tactic has been to put > a new ruby-Class around each "level" of the object tree. So, for instance, > in a People object, the :phone field may be a sub-tree and contained in the > ruby Phone class. > > "Get around to the question already!" -- indeed. > I find myself when coding the sub-tree objects, that I often end up > referencing "up-tree", especially around any position-order indexing or > field-unique constraints. > > Question : Is there a way to avoid feeding the "up-tree" into the sub-tree > object/ruby-Class when manipulating the object in question? To be salient to > the example above... if for some reason phone numbers are supposed to be > unique across People... how does the Phone class go about that? Is the > separation of concerns wrong here? > > I appreciate any thougths and suggestions. > Regards, Guyren G Howe Relevant Logic LLC guyren-at-relevantlogic.com ~ http://relevantlogic.com ~ +1 512 784 3178 Ruby/Rails, Xojo, PHP programming PostgreSQL, MySQL database design and consulting Technical writing and training Read my book, Real OOP with REALbasic: <http://relevantlogic.com/oop-book/about-the-oop-book.php> -- -- SD Ruby mailing list [email protected] http://groups.google.com/group/sdruby --- You received this message because you are subscribed to the Google Groups "SD Ruby" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
