Design Question: Which is Better practice? (part 2)

dykm

New Member
I've got a web interface from which I will gather user data (username,pass,email,etc..) and the backend has to provision these data into 3 other systems (SystemA, SystemB, SystemC). The provisioning is being done by 3 different APIs one for each system (A,B and C).My current design in the backend looks something like this: \[code\]interface ProvisionData{ public function createUser(); public function deleteUser(); public function changePassword();
}\[/code\]\[code\]class SystemA_API_wrapper implements ProvisionData{ public function createUser(){ ... } public function deleteUser(){ ... } public function changePassword(){ ... }}class SystemB_API_wrapper implements ProvisionData{ public function createUser(){ ... } public function deleteUser(){ ... } public function changePassword(){ ... }}class SystemC_API_wrapper implements ProvisionData{ public function createUser(){ ... } public function deleteUser(){ ... } public function changePassword(){ ... }}\[/code\]Each of the System*_API_wrapper has different implementation of createUser() (and the rest) functions. In the frontend I've created a kind of proxy class which I feed with the data gathered from the web interface.. It looks like:\[code\]class provisionProxy{ public $sA = null; public $sB = null; public $sC = null;\[code\]//constructor instantiates all System*_API_wrapper objectspublic function __construct() { $sA = new SystemA_API_wrapper(); $sB = new SystemB_API_wrapper(); $sC = new SystemC_API_wrapper();}// proxy function deleteUser calls deleteUser() of each of // our APIs public function deleteUser($username, $password) { $this->sA->deleteUser($username, $password); $this->sB->deleteUser($username, $password); $this->sC->deleteUser($username, $password);}\[/code\]}\[/code\]Does anyone have any suggestion or a better practice?(I've already posted the same question but due to technical problems I can't login to my old account, so the question is revised and posted again under my new account. Original question can be found here: http://stackoverflow.com/questions/2035325/design-question-which-is-better-practice - thanks)
 
Back
Top