I think you're confusing 2 separate issues, Henry...

The way methods get incorporated into a design is based in part on 2  
thigns:
1) What the object itself needs to do to function
2) What other objects need the object to do in order to function

If BookmarkManager were a Singleton, then there's only one instance of  
it that's accessed by all the other objects in the system and these  
objects only need to interact with it, not with eachother... so  
Browser doesn't implement Bookmark related methods, but  
BookmarkManager might, and other objects will talk to _it_. Browser  
needn't implement those methods because nobody has any business  
getting to them thru the Browser in the first place.

Here's a good Java-based article that covers Singletons in detail:
http://www.javaworld.com/javaworld/jw-04-2003/jw-0425-designpatterns.html

Room.closeWindow() is a lot different than  
Browser.reorderBookmarks()... Room has every right to control it's  
Windows as they're part of the room (which is defined by walls, which  
contain doors and windows... the window definitively a physical part  
of the room) but Browser is all about downloading, rendering and  
displaying web pages. So while you would have Browser. Room IS a  
WindowManager if you will, or more appropriately an extension of  
PortalManager since a room is essentially defined by it's access  
points. It goes to the very definition of what a Room actually is.

Calling Having Browser tell the BookmarkManager to reorder the  
bookmarks is fine, especially since access to BookmarkManager should  
be thru a class method like BookmarkManager.getInstance() or  
application.BookmarkManager, not thru the Browser obect.

That's where this breaks down... Browser shouldn't be the access point  
for BookmarkManager.

J


On Feb 17, 2009, at 4:22 PM 2/17/09, Brian Kotek wrote:

> Yes, if you provide public methods in Browser for every method in  
> BookmarkManager, that is most likely going to be a bad design.
>
> First, if the client code needs to do all these things to bookmarks,  
> why can't it just interact with BookmarkManager directoy? Why does  
> it have to go through the Browser object?
>
> Another option is to create a BookmarkCommand object that you can  
> configure and pass into the Browser.
>
>
>
>
> On Tue, Feb 17, 2009 at 5:13 PM, Henry <[email protected]> wrote:
>
> Thank you everyone for your input!
>
> Let say I have a Browser, and it has a bookmark sub-system that manage
> a collection of bookmarks.
>
> Browser.gotoURL(url)
> Browser.openPage(filePath)
> Browser.addBookmark(name, url)...

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to