Writing Mobile Code Essential Software Engineering for Building Mobile Applications [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Writing Mobile Code Essential Software Engineering for Building Mobile Applications [Electronic resources] - نسخه متنی

Ivo Salmre

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید











Summary


As with performance, memory management, and user interface design, building a successful data access model for your mobile applications requires both discipline and experimentation. The good news is that much of your desktop data access knowledge can be applied when designing mobile application data access code. The bad news is that little of your preexisting desktop code will be of use and that specifics of devices must be kept in mind to build great mobile applications.

The most important data access consideration is determining how your data access strategy will deal with the offline needs of your users. The reality is that a mobile application will be frequently disconnected from database servers, sometimes "by design" and sometimes due to network failures. Dealing with intermittent connectivity will be a specific focus of the next chapter, but is a key thing to keep in mind when designing your data access strategy. If the user wants instant access to the data, it will need to be cached locally on the device.

Depending on how your mobile device application will be used, it may need to connect to data sources via a variety of different connectivity models. Some connectivity such as Wi-Fi is fast and inexpensive, and some slow and expensive. The need to support connections over public networks or via virtual private networks may also add requirements to your design. When designing your mobile application's data access model, it is important to map out what these connectivity scenarios will look like and how they will effect your data access and synchronization needs. It is important to think about what kind of data will be stored locally on the device, how this data will be stored and accessed, and how the data will be synchronized with servers.

Data access programming frameworks often offer layered approaches to working with data. As with working with XML frameworks, there are lower-level forward-only models that are stateless, and there are full-service models built on top of these that are highly stateful. ADO.NET offers such a selection of choices. As a developer, you can either work at a high level of abstraction using ADO.NET DataSets to manage your data in memory or you can work at a low level of abstraction directly using the data-reader and data-connection classes that communicate directly with databases. As with gas stations, full service is nice but costs more; in the case of data access, you will be paying for higher-level data access services with in-memory state and this ultimately means lower application performance. If you choose to work at a low level of abstraction, you can store the loaded data in the most efficient format for your mobile application's needs but take on the burden of managing that data efficiently.

For small amounts of data, data that requires lots of dynamic updates or data with complex relationships, the full-service ADO.NET DataSet model has a lot to offer. When using DataSets, be sure to use the most efficient ways of accessing the data. For working with DataRows inside DataTable objects, this means using cached DataColumn object indexes to access fields.

For the best possible performance when working with larger amounts of data, your application should consider a custom data model that is highly optimized to the task at hand. This can directly increase performance as well as reduce the overall memory load on your application. When choosing to use a custom lower-level approach, it is important to keep the model as simple and memory efficient as possible. Always instrument your code and test the performance of your design versus the existing higher-level data access models!

For storing longer-term data locally on devices, there are two recommended models, either storing the data in an XML file or storing it using a device-local database such as SQL CE. Both of these options are available whether you are using the higher-level ADO.NET DataSet model or using lower-level customized mechanisms for working with data. As long as the amount of data being worked with is relatively small (for example, on the order of 50KB of XML), an XML file is an excellent and flexible choice. For larger amounts of data, a real database engine becomes increasingly useful. Again, instrumenting your code and producing metrics you can compare is the only way to ensure you are making good design decisions.

As with user interface design, "write once, run anywhere" proves an elusive goal for mobile application data access design. For the best possible performance, you will want to tune your mobile application's data access and data storage models for the specific devices the application will run on. If you are building multiple versions of your application for different device classes, you may choose different data storage models for each device class depending on the capabilities of the device and the needs of your application.

Data access technologies are both relevant and extremely useful on today's rich mobile devices. The interesting design challenges are in choosing the right model for your application's needs and in keeping this model flexible enough to be tuned as real-world experiences dictate.


/ 159