Most of my books include source code. The source code is made available on the publisher’s Web site and you download it from there. I always recommend downloading the source code to reduce the potential for errors. Typos are the number one source of problems for readers who work with the source code in my books. A single mistyped word will cause the application to fail in some way. If the reader is lucky, the compiler will catch the error and provide a clear message saying what’s wrong (such as the fact that the .ResX file is missing), but often that isn’t the case and then the reader becomes frustrated with the unworkable code. Sometimes the error isn’t even the reader’s fault—errors do creep into books (see my Errors in Writing post for details). The point is to use the fully tested downloadable source code whenever possible to save yourself time and effort.
There is another good incentive to download the source code. The reason to work through the source code in your debugger is to discover how it works through actual tracing. To help accomplish this task, the source code examples are carefully crafted to provide an optimal learning experience and they include features such as additional comments to help enhance the learning experience (see my Handling Source Code in Books post for details).
However, what happens when the downloaded source doesn’t appear to work either? Some readers have complained that the downloaded example won’t compile. Normally, the problem is one of a missing file. Firewalls and other network security features can strip out files and some organizations are proactive about stripping out anything that even looks binary. Consequently, the downloaded ZIP containing the source code is missing solution (.SLN), project (.CSProj or .VBProj), resource (.ResX), or other files. The project won’t compile with missing files. The best course of action is to try to download the source code from another system—one that isn’t inhibited by the network security features that stripped out the files.
Missing .DLL files aren’t normally an indication of a failed download. In most cases, missing .DLL files are part of a library or third party product you must install. The book will always include instructions on where to obtain these required add-ons and how to install them. Make sure you install any required additions as part of your system setup.
Sometimes a reader doesn’t have another way to download the file. Asking me to send the source code to you won’t help because the same features that strip out the files from the publisher site will also strip them out of the e-mail I send containing the files. In most cases, the firewall still downloads the actual source code. Create the project using the instructions from the book, and then copy and paste the source from the downloaded files into this new project. It’s not a perfect solution, but it should still work better (and faster) than typing all of the source code by hand.
A few readers have asked that I create a disk containing the source code and mail it to them. I’m not set up to perform this kind of support and the costs would be prohibitive. Unfortunately, if all else fails, you may have to try typing the source in by hand, but it should be your last option because typos really can ruin the learning experience. I’m always open to suggestions for making your reading experience better. If someone has a magic bullet solution that will help others get the downloaded source code in one piece, please let me know at John@JohnMuellerBooks.com.