Saturday, November 7, 2009

Examples









Examples


The examples are designed for the following tasks:


  • Illustrate common, representative, and useful applications of the Windows functions.

  • Correspond to real programming situations encountered in program development, consulting, and teaching. Some of my clients and course participants have used the code examples as the bases for their own systems. During my consulting activities, I frequently encounter code that is similar to that used in the examples, and on several occasions I have seen code taken directly from the first or second edition of this book. (Feel free to do so yourself; an acknowledgment in your documentation would be greatly appreciated.) Frequently, this code occurs as part of COM or C++ objects. The examples, subject to time and space constraints, are "real-world" examples and solve "real-world" problems.

  • Emphasize how the functions actually behave and interact, which is not always as you might first expect after reading the documentation. Throughout this book, the text and the examples concentrate on interactions between functions rather than the functions themselves.

  • Grow and expand, adding new capability to a previous solution in an easy and natural manner and exploring alternative implementation techniques.

  • In the earlier chapters, many examples implement UNIX commands, such as ls, touch, chmod, and sort, showing the Windows functions in a familiar context while creating a useful set of utilities.[2] Different implementations of the same command will also give us an easy way to compare performance benefits available with advanced Windows features. Appendix C contains the results of these performance tests.

    [2] Several commercial and open source products provide complete sets of UNIX utilities; there is no intent to supplement them. These examples, although useful, are primarily intended to illustrate the use of Windows features. A reader who is not familiar with UNIX should not, however, have any difficulty understanding the programs or their functionality.


Examples in the early chapters are usually short, but the later chapters present longer examples when appropriate.


Exercises at the end of each chapter suggest alternative designs, subjects for investigation, and additional functionality that is important but beyond the book's scope. Some exercises are easy, and a few are very challenging. Frequently, clearly labeled defective solutions are provided, because fixing the bugs is an excellent way to sharpen skills.


All examples have been debugged and tested under Windows XP, 2000, and 2003. Where appropriate, they have been tested under Windows 9x and NT. Although the bulk of the development was performed on single-processor, Intel-based systems, most programs were also tested on multiprocessor systems. The client/server applications have been tested using multiple clients simultaneously interacting with a server. Nonetheless, there is no guarantee or assurance of program correctness, completeness, or fitness for any purpose. Undoubtedly, even the simplest examples contain defects or will fail under some conditions; such is the fate of nearly all software. I will, however, gratefully appreciate any messages regarding program defectsand, better still, fixes.









    No comments:

    Post a Comment