On Tue, Feb 17, 2009 at 3:53 PM, Henry <[email protected]> wrote: > BookmarkManager cannot be Singleton because it has states (i.e. a > collection of links, more specifically it shall be a Tree).
The bookmark *manager* can certainly be a singleton. The logic exists just once with the browser-specific configuration. The collection of links is per-user I expect. So, really, user-has-bookmarkCollection, which is managed by that singleton. If you were really building a browser, it's really an aggregate of several things, including a bookmarks module that in turn has certain UI elements exposed to the user, which are wired to some sort of controller which in turn manipulates the model (the user's collection of bookmarks). When a browser is running, it is an instance of the class and has an associated user to whom the data belongs (and the browser may well defer to the OperatingSystem singleton to getUserPreferenceFolder() perhaps where it may store bookmarks and other preferences). That browser instance will have a bookmark manager but won't manipulate it directly. The bookmark module UI controls have that job (via the controller). That said, there are so many different ways to "correctly" implement a browser. Much depends on what your design constraints really are. So, it depends, as I'm famous for saying. -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ "If you're not annoying somebody, you're not really alive." -- Margaret Atwood --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CFCDev" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cfcdev?hl=en -~----------~----~----~----~------~----~------~--~---
