Developing Quality Applications

Developing Quality Applications

Data Recovery and App Restart

Applications developed under Windows Vista® can be written so that users do not lose their work or documents because of a software problem beyond their control. Preserving a user's experience despite an unrecoverable application error is supported in Windows Vista by Windows Feedback through two complementary mechanisms:

  • An application state persistence mechanism to save the state of the terminated application

  • An automatic restart technology to pick up the running of the terminated application

Windows Feedback Services

Windows Vista allows application developers to control and customize error reporting through Windows Feedback and C-callable libraries.

Known Folders

Using the appropriate Windows Vista and application-specific locations to determine where to store files and registry information keeps an application from conflicting with other applications, and makes it easier to migrate your application or make it accessible to roaming users.

Known Folders abstracts the actual physical location of a file on a specific system, allowing an application to query for the system's actual configuration.

Known Folders succeeds the fixed list of predefined "special folders" identified by CSIDL constants. For more information on CSIDL, see the CSIDL section of the Windows SDK.

I/O Cancellation

To prevent application failure, or the appearance of application failure due to an unresponsive I/O operation, Windows Vista provides an updated API for I/O cancellation. Support for I/O cancellation requires either the use of asynchronous (non-blocking) I/O functions, such as CreateFile, or multithreaded applications, so that the synchronous I/O operation and I/O cancellation can be located in separate threads.

A good general rule is that operations requiring more than 2 seconds to complete should provide feedback to the user in the form of progress or other status indicators, and implement I/O cancellation. This is particularly true for an application's user interface (UI). No UI threads should be blocked by any I/O, wait, or other operations (even lengthy compute operations) for a perceptible amount of time. Multi-threading is recommended.

Diagnostics and Performance Tuning

Performance Counters

The new Performance Counter Library (PERFLIB version 2.0) offers a number of advantages to the developer, including:

  • Performance counters can be exposed and consumed in a much simplified manner

  • Finer granularity queries

  • A standard inter-process communication (IPC) mechanism, based on Event Tracing for Windows (ETW) notification, between a provider and consumer

  • More reliable and secure operation

  • 64-bit support

  • Language-neutral universal identifiers

  • The new Counter Preprocessor (CTRPP) tool, which generates skeleton code for performance counter providers

Event Reporting and Tracing

Windows Vista contains two facilities for event reporting and tracing:

  • Event Tracing for Windows (ETW)

    First introduced in Windows 2000, this high-performance technology enables the instrumentation and monitoring of applications, typically during optimization, debugging, and performance tuning. Because of its high performance design, it has limited querying, subscription, and forwarding capabilities.

  • Windows Event Log

    New with Windows Vista, it is used to create, publish, receive, and store system and application events for the primary purposes of diagnostics and auditing. The Windows Event Log service has an associated API that, in conjunction with the ETW API, unifies much of this functionality for the developer, hiding the differences in the technology used. This API is targeted at the C/C++ programmer.