Design Question: Which is Better practice?

Satyrlus

New Member
I have 3 different web servers which handle user data (username/passwd/email/etc.). I have 3 different web service calls respectively, so I've created 3 different classes which calls for the same information (\[code\]getUsername\[/code\], \[code\]setUsername\[/code\], \[code\]getEmail\[/code\], \[code\]setEmail\[/code\], etc.). From the main class I instantiate each webservice-call objects and when I have a request for a new username, password I call the \[code\]createUsername()\[/code\] method of each class (provisioning the data).Do you have any suggestions on how to apply a design pattern for this problem? I thought of making a class which will have a method \[code\]createUsername() {}\[/code\] and in this I would call each of the webservice-classes and store each result in a predefined array. Does anyone have any suggestion or a better practice?currently i have:\[code\]class webservice1calls {function createUser($username, $password) {}function deleteUser($username, $password) {}function createGroup($groupname) {}function deleteGroup($groupname) {}}class webService2calls {function createUser($username, $password) {} //different implementationfunction deleteUser($username, $password) {} //different implementationfunction createGroup($groupname) {} //different implementationfunction deleteGroup($groupname) {} //different implementation} class webService3calls {function createUser($username, $password) {} //different implementationfunction deleteUser($username, $password) {} //different implementationfunction createGroup($groupname) {} //different implementationfunction deleteGroup($groupname) {} //different implementation} //My "like a proxy" class:class webServiceCalls {function createUser($username, $password) { $ws1 = new webService1calls(); $ws2 = new webService2calls(); $ws3 = new webService3calls();\[code\]$res1 = $ws1->createUser($username, $password);$res2 = $ws2->createUser($username, $password);$res3 = $ws3->createUser($username, $password);// return result depending $res1,$res2 and $res3 values\[/code\]}//and the call is done from another class somewhat like this:class doThings { function run() { $ws = new webServiceCalls(); $ws_res = $ws->createUser(); }}\[/code\]I thought that the above representation would help you understand the current design (and maybe a better understanding of the problem.thanks!
 
Back
Top