views:

58

answers:

1

Im looking for some advice/suggestions on how I should setup the work flow of a small application Im building. When the application is launched the datagrid will be populated via the XML file. Once running the application will receive a datastream that I hope to update the file and datagrid.

So Im curious what you would suggest on how I setup the workflow (ie, split the data from the data stream and simultaneously populate the file and grid or would you suggest populating the XML file first and setting up a timer to have the grid read the file?) Im really looking for optimal performance.

+2  A: 

Firstly, the datagrid is UI element, so it's job should only be UI centric - it shouldn't control the process / workflow of your app. I don't think you were suggesting you were going to do that - so I'm just trying to ensure you don't :)

How to do it? Split the application into parts, where each does one job and does it well:

  • within the logic tier, have a component (interface/service) that handles the data stream. Abstract this out if you can, for future flexibility. WCF might be an option (?)
  • "Manage" the data within the logic tier - use this as the primary (data) source of truth.
  • use an event driven model to keep the primary data source in syunc with user and service initiated changes.
  • Have (sub) components that handle specific updating tasks (file / UI & DataGrid).
  • Finally, the logic tier will also contain a central place where you orchstrate everything.

See image below.

There will be some design patterns you can use - but I'm not sure which ones are appropriate yet based on the info given - but hopefully this will be helpful in the mean-time.

As far as performance goes - in which areas do you perceive performance to be an issue?

  • Transfering data?
  • rendering to the user?
  • reflecting changes (if so - between which bits excatly)?
  • How much data are you moving around, how often is it changing?
  • Web based or thick client?

alt text

The boxes show the main components, these might comprise of various classes. The lines show the main information flows.

The "Central Controller" runs the show. The "Primary Data" is it's private copy of the data. The DataGrid (or any other kind of "client") can send updated to the central controller via events. Data is passed into the controller (who decides what to do with it) via teh same bucket of event handlers (same in that they exist in the same logical area). You'd probably want to have these defined behind an interface so you can swap out implementations as required. One of the could be a local data provider that went and requested data (as opposed to having it pushed to the controller / event handlers.

Adrian K