Visual Basic

Windows CE Application Design Philosophy

Because of the nature of the Windows CE operating system, a new design philosophy is required in order to develop Visual Basic applications for the HPC. The foremost concern is that of memory. With such a potentially small amount of RAM you stand a good chance that your application might run out of memory or be terminated when another application requires memory resources being used by your application. Unlike Windows NT/9x, there is no virtual memory management, so if memory runs out-tough! Once the machine starts running low on memory it will look to see if there are any other applications running. If another application is found, it will be terminated; this will continue until the memory requirement has been satisfied. In effect, any program in memory is in danger of being shut down by the operating system to satisfy memory requirements. A Windows CE application must be designed with this in mind. User transactions must be well designed so that in the event of an application being closed, user data is not left in an unpredictable state. The operating system's transaction mechanism will protect you against data integrity problems at a record level, but you can build certain scenarios into your code that increase the risk of data getting out of sync. For example, if you are writing a series of related records from various sources, it might be a good idea to collect all the data and then apply the changes in a batch, rather than as each individual item becomes available.

Another consideration is that of the power supply. The nature and size of HPC devices means that at some point the battery will run out. HPC devices usually contain backup batteries that are designed to preserve the memory while the main batteries are being changed. However, the backup batteries can be removed as well. An application must allow for the possibility of power loss. In this instance, batch operations will not be of any use. When power is lost, the entire content of the RAM is lost. The only safeguard against losing data is to back up to a PC. Do not confuse loss of power with the user switching off the device. In the latter case, RAM is not destroyed-the HPC merely enters a sleep state. When the HPC is turned on again, the device's previous state will be restored. As a Visual Basic developer, you will very likely be writing high level applications and as such, if there is a loss of power, the application will no longer be in memory. Unless the user's data has been synchronized (saved to a desktop), the data will also be lost.

In terms of visual appearance, the potentially small screen display might mean cutting back on some of the more aesthetic user interface elements-a good practice would be to make sure the elements are functional rather than cosmetic. In most cases I would advise against using unnecessary controls in your application because each control you include in your project will need to be installed on the device. This will leave less working memory. You should also give consideration to the ergonomics of the interface; for example, if you are not using default color schemes, you should make sure that the contrast is sufficient for both gray-scale and color displays.