|
|
Invisible wrote:
> OTOH, unless you're psychic, you will never know what the future holds,
Yeah. The first time I ran into this was early Java socket libraries, where
they tried to make it possible to talk to different kinds of sockets.
Granted, it was the first time I ran into the factory pattern (since
Smalltalk doesn't need factories, since "new" is a method that returns a
value), so it was a little confusing. I don't remember how you specified
what protocol you wanted, but it wasn't something simple like passing some
enum for the protocol to the factory method and getting back the right
subclass of socket.
There are complexities you can hide, like "here's a URL, give me back an
appropriate object to manipulate a URL with that scheme." There are some you
shouldn't hide, tho.
--
Darren New, San Diego CA, USA (PST)
Why is there a chainsaw in DOOM?
There aren't any trees on Mars.
Post a reply to this message
|
|