Re: Re: Package proposal: Payment_Exchange

From: Date: Thu, 28 Aug 2003 01:48:24 +0000
Subject: Re: Re: Package proposal: Payment_Exchange
References: 1 2 3 4  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-20704@lists.php.net to get a copy of this message
Marshall Roch wrote:
Alan Knowles wrote:
I'd turn the thing into a factory patern - defaulting to euro central bank.
I've never even heard of "factory patterns" before. I just looked quickly on Google and found something[1] describing "abstract factory patterns" using PEAR DB as an example, talking about how you call DB::connect('mysql') and it creates a DB_mysql object. Is that what you're referring to?
have a look at Image_Transform, DB etc. class base { function factory($driver) { $class = 'base_'.$driver; include_once 'base/'.$driver.'.php' return new $class; } .. standard methods.... } class base_adriver extends base { .. override driver specific methods. }
How would more drivers be installed? I see this as a good use of subpackages. since drivers are not loaded unless needed.. - and are relatively small, moving to subpackages is not usually necessary.
If someone wanted to write a driver for 'mybank,' but
'mybank' was an Access database (I found some of those),
It would be nice to see someone write bindings to mdbtools for that :) then you'd
probably want to add a dependency on DB.
Imagine in Asia or the US - it's going to be alot better to query a local source... (which may provide the data in a different format)
I'm in the US and the speeds aren't bad across my host's dual-OC12s, but I agree and will work on that. :)
Someone may want to write a driver to do factory('mybank') and get real rates....
What do you mean by "real rates"? The code mentions that you should not rely on the rates for shopping carts etc...
-- Marshall Roch [1] http://www.horde.org/papers/kongress2002-design_patterns/8_abstractfactory.xml.html
-- Can you help out? Need Consulting Services or Know of a Job? http://www.akbkhome.com

« previous php.pear.dev (#20704) next »