|
-
June 10th, 2008, 12:49 PM
#1
help with design
I have an application which contains an UI. The UI displays data which is obtained from a server using web services. Since responses are delayed, i need a mechanism to update the UI whenever my data is available after my request. I am unsure if i am moving in the right direction with my design. I would appreciate any help i would receive related to the same.
Our application is a windows based application. It will communicate with the server using web services. Following is a high level design of how i intend to proceed. (I have used a different object in the example, since it would be easier to explain my problem)
I have more than one question related to the design, and hence I would like to ask them in a systematic way. I hope this is of no inconvenience to anyone.
Basic Idea related to my design is as follows,
We have a user interface class (displays employee(s) details..), an employee manager class (manages - create\delete\update...), an employee class (gets a particular employee detail like name, id...) & and an WebServiceGateway class (talks to the web service using the methods that are exposed by the web service at the server - uses xml for request and response).
User requests data for a particular employee. On this event, we request EmployeeManager class to get details for an employee. Employee manager class communicates with the web service using the WebServiceGateway class (async communication - hence he requests and returns immediately). When data is available the WebServiceGateway class can inform through (lets say a callback function) that data is available.
Now when the data is available, i need to inform\update the UI, through the EmployeeManager class - using the WebServiceGateway (of course). How do i accomplish this??
Following is the design that i have come up with so far.
Code:
class UserInterface
{
public:
GetEmployeeDetailEvent();
UpdateUIWithData(someDataFormat);
};
class Employee;
typedef std::list<Employee> EmployeeList;
class EmployeeManager
{
public:
void CreateEmployee (Employee& hiredForNow);
void DeleteEmployee (Employee& firedForever);
void UpdateEmployee (Employee& heGotHike);
void ListEmployees (EmployeeList& weHavePower);
void GetEmployeeDetail(Employee& underScrutiny);
};
struct Employee
{
std::string m_Name;
int m_ID;
};
class WebServiceGateway
{
void createObject(string request); //Used to create employee
void deleteObject(string request); //delete employee
void getObjects(string request); //get employee(s) details
//...
};
Last edited by ChessMaster; June 10th, 2008 at 01:01 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|