Programming A Beginners Guide
Richard Mansfield
Copyright 2009 by The McGraw-Hill Companies, Inc. All rights reserved. Except as permitted under the United States Copyright Act of 1976, no part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without the prior written permission of the publisher.
ISBN: 978-0-07-162472-5
MHID: 0-07-162473-2
The material in this eBook also appears in the print version of this title: ISBN: 978-0-07-162472-5, MHID: 0-07-162472-4.
All trademarks are trademarks of their respective owners. Rather than put a trademark symbol after every occurrence of a trademarked name, we use names in an editorial fashion only, and to the benefit of the trademark owner, with no intention of infringement of the trademark. Where such designations appear in this book, they have been printed with initial caps.
McGraw-Hill eBooks are available at special quantity discounts to use as premiums and sales promotions, or for use in corporate training programs. To contact a representative please e-mail us at bulksales@mcgraw-hill.com.
Information has been obtained by McGraw-Hill from sources believed to be reliable. However, because of the possibility of human or mechanical error by our sources, McGraw-Hill, or others, McGraw-Hill does not guarantee the accuracy, adequacy, or completeness of any information and is not responsible for any errors or omissions or the results obtained from the use of such information.
TERMS OF USE
This is a copyrighted work and The McGraw-Hill Companies, Inc. (McGraw-Hill) and its licensors reserve all rights in and to the work. Use of this work is subject to these terms. Except as permitted under the Copyright Act of 1976 and the right to store and retrieve one copy of the work, you may not decompile, disassemble, reverse engineer, reproduce, modify, create derivative works based upon, transmit, distribute, disseminate, sell, publish or sublicense the work or any part of it without McGraw-Hills prior consent. You may use the work for your own noncommercial and personal use; any other use of the work is strictly prohibited. Your right to use the work may be terminated if you fail to comply with these terms.
THE WORK IS PROVIDED AS IS. McGRAW-HILL AND ITS LICENSORS MAKE NO GUARANTEES OR WARRANTIES AS TO THE ACCURACY, ADEQUACY OR COMPLETENESS OF OR RESULTS TO BE OBTAINED FROM USING THE WORK, INCLUDING ANY INFORMATION THAT CAN BE ACCESSED THROUGH THE WORK VIA HYPERLINK OR OTHERWISE, AND EXPRESSLY DISCLAIM ANY WARRANTY, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. McGraw-Hill and its licensors do not warrant or guarantee that the functions contained in the work will meet your requirements or that its operation will be uninterrupted or error free. Neither McGraw-Hill nor its licensors shall be liable to you or anyone else for any inaccuracy, error or omission, regardless of cause, in the work or for any damages resulting therefrom. McGraw-Hill has no responsibility for the content of any information accessed through the work. Under no circumstances shall McGraw-Hill and/or its licensors be liable for any indirect, incidental, special, punitive, consequential or similar damages that result from the use of or inability to use the work, even if any of them has been advised of the possibility of such damages. This limitation of liability shall apply to any claim or cause whatsoever whether such claim or cause arises in contract, tort or otherwise.
This book is dedicated to my friends David and Cliff, for their many kindnesses.
About the Author
Richard Mansfield has written hundreds of magazine articles and two columns. He began writing books full time in 1991. This his 41st book. Overall, his books have sold more than 500,000 copies worldwide and have been translated into 12 languages. His recent titles include How to Do Everything with Second Life (McGraw-Hill), CSS Web Design For Dummies (Wiley), Office 2003 Application Development All-in-One Desk Reference For Dummies (Wiley), The Visual Basic .NET Power Toolkit (Sybex, with Evangelos Petroutsos), and The Savvy Guide to Digital Music (SAMS).
About the Technical Editors
Todd Meister has been developing using Microsoft technologies for more than ten years. He has been a technical editor on more than 50 titles ranging from SQL Server to the .NET Framework. In addition to technical editing titles he is an Assistant Director for Computing Services at Ball State University in Muncie, Indiana. He lives in central Indiana with his wife, Kimberly, and their four remarkable children.
John Paul Mueller has technically edited 63 books, written 82 books of his own, and written more than 300 articles for various publishers. He has more than 34 years of programming experience. When John isnt working at his computer, he enjoys making soap and working with wood, among other things.
Contents at a Glance
Contents
Acknowledgments
I want to thank editorial director Roger Stewart for his thoughtful guidance during the entire process of creating this book. Roger understands authors and knows how to get the best out of them.
I was also lucky to have five editors work with me on this book. Roger helped shape the book in a variety of ways and always kept the big picture in mind.
Janet Walden made a number of improvements to the book, and was both judicious and gracious in her suggestions and modifications to the text.
A close technical edit by Todd Meister contributed to the books accuracy. Todd was indefatigable: He verified each code listing, even the short snippets of code. And he offered a variety of interesting suggestions about both themes and content.
My sometime co-author on other books, John Mueller, provided a valuable edit of this book. He also helped me ensure that the books audiencebeginnerswere well-served by improving the books clarity and technical accuracy.
Special thanks go to project manager Smita Rajan who was highly effective in all her jobs: shepherding, diplomacy, scheduling, and offering intelligent suggestions about style and many other issues as the book moved through the production stages. Her acumen and her grace were much appreciated.
Copy editor Lisa Theobald proved thoroughgoing and systematic. She paid particular attention to the passive voice, split infinitives, and ending sentences with a preposition. Overall, her efforts were as exhaustive as they were painstaking.
Production supervisor Jean Bodeaux offered good suggestions about improving elements of the book, and also provided valuable technical assistance.
Joya Anthony diligently coordinated the editorial submission processes. And she gave me some helpful guidance in other areas as well.
To these, and all the other good people at McGraw-Hill who contributed to the book, my thanks for the time and care they took to ensure quality at each station along the way from initiation to publication.
Finally, I want to give special thanks to my agent, Matt Wagner of Waterside Productions, who has been offering me good advice for many years.