بیشترلیست موضوعات • IndexWriting Mobile Code Essential Software Engineering for Building Mobile ApplicationsBy
Ivo Salmre Publisher: Addison Wesley ProfessionalPub Date: February 01, 2005ISBN: 0-321-26931-4Pages: 792
توضیحاتافزودن یادداشت جدید
Improving Performance by Offloading Work to Others
A great deal of thinking goes into how to build the fastest possible implementation of an algorithm. Often not enough thought goes into considering whether the work being done is appropriate at all on a mobile device. In many cases, work can either be done ahead of time before the data goes onto a mobile device or can be offloaded to a server and done on demand. Because of their higher memory capacities, more powerful processors, and larger storage capacities, servers can both do valuable preprocessing and on-demand work that can be of benefit to mobile applications.The right time to do server processing on XML data is before it ever comes onto a device. If a mobile application is going to benefit from having data presorted, presearched, or pretransformed, doing this work on the server before sending the data down to a device can pay real performance dividends. This is an area well worth spending creative energies on.
Avoid Doing Complex Data Transformations on the Device
It is often useful to turn XML data into some kind of user-viewable data. Populating a ListBox or ListView control with data from an XML document is a simple example. Generatin141 from XML data is a more complex example. In each case, some kind of transformation is performed on the XML to achieve a human-readable result. Transformations are often complex and processor intensive. Find a way to do as much of the required transformation work as possible on a server before sending the data down to a device. The more heavy lifting that can be done before data comes onto a device, the lighter the workload will be on the device.If you are reading data from a database that needs to be transformed in some way, consider having an intermediary Web service on the server that performs the transformations before sending the data down to a device.
Avoid Doing Complex Data Searches on the Device
Searching data for specific requested information is another fundamental pattern in applications. Most applications that work with data do some kind of searching, filtering, or sorting. This searching can range from very simple searches to complex data mining. As with XML transformations, any work that can be done to presearch, preorganize or prefilter the data into more easily accessible forms before bringing it down to the mobile device will aid in making your mobile application perform well. If you are downloading XML documents from a server that will need to be queried for information, consider doing the search ahead of time on the server and only downloading the results; this will save device processing time as well as reduce the amount of data that needs to be downloaded.
Consider Removing Unnecessary Information Before Data Is Sent to a Device
Unnecessary information sent to a device takes extra time both to transmit and to parse on the device. If you are dealing with XML documents that contain lots of information that will not be useful on the device, it is worth considering processing the document on a server to remove the extra information. In this way, a server can separate the wheat from the chaff and only send information down to the device that will be of use.
When Not to Offload Work onto a Server
As important as understanding when work can be offloaded to servers is understanding cases where it is not efficient to do so. There is much fanciful talk about using distributed computing to push all kinds work onto other devices waiting on a network. This is a nice idea in concept but very difficult to do in practice. It is usually not worthwhile to push a large amount of data up from a device and onto a server for immediate processing. Unless the data to be processed is very dense and the analysis required is intense, the time, inconvenience, connection reliability requirements, and potential bandwidth costs of moving the data back and forth across a network is not warranted. A case where pushing data from a device to a server for immediate processing may be useful is complex image analysis where data such as aerial photographs or medical images acquired by a high-resolution camera need computationally intensive algorithmic analysis. In these cases, the size of the data being round-tripped to the server is trivial compared to the processing needing to be performed; in these cases, the latency of sending the data is outweighed by the speed gains of processing the data on a more powerful machine. The time required to process the data on the device must be weighed against the latency of sending the data to a server, the time to process the data on a server, and the very real possibility that the server may not be available to the mobile device when needed. Pushing data from a mobile device to a server is usually not worthwhile for XML documents; the size to data ratio is not high, and the analysis that needs to be done is usually not complex enough. Additionally, the requirement to be online to have the analysis performed makes the model of round-tripping data to a server for processing unattractive for mobile device applications.
Why Are XSLT and XPath Not Supported in Version 1.1 of the .NET Compact Framework?
When designing the .NET Compact Framework, two main design constraints needed to be balanced. The need to minimize the size of the .NET Compact Framework (a less than 2MB device footprint was the goal) was balanced with the desire to give developers as much functionality as possible. In meeting this balance, the utility and appropriateness of features was carefully weighed against the additional size that the features would add to the .NET Compact Framework. This resulted in the decision not to support XPath and XSLT in the first release of the .NET Compact Framework.XPath is query language useful for searching XML documents. It is a powerful concept, but it is complex and requires significant computational power to use effectively. XSLT is technology for transforming a tree of XML into a new document based on specified rules; it is often used to turn XML data int149 user interface documents. It also requires significant computational power to work effectively.