Visual Basic 2005 Design and Development - Chapter 1 potx

38 297 0
Visual Basic 2005 Design and Development - Chapter 1 potx

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Expert One-on-One ™ Visual Basic ® 2005 Design and Development 01_053416 ffirs.qxd 1/2/07 6:25 PM Page i 01_053416 ffirs.qxd 1/2/07 6:25 PM Page ii Expert One-on-One ™ Visual Basic ® 2005 Design and Development Rod Stephens 01_053416 ffirs.qxd 1/2/07 6:25 PM Page iii Expert One-on-One ™ Visual Basic ® 2005 Design and Development Published by Wiley Publishing, Inc. 10475 Crosspoint Boulevard Indianapolis, IN 46256 www.wiley.com Copyright © 2007 by Wiley Publishing, Inc., Indianapolis, Indiana Published by Wiley Publishing, Inc., Indianapolis, Indiana Published simultaneously in Canada ISBN: 978-0-470-05341-6 Manufactured in the United States of America 10 9 8 7 6 5 4 3 2 1 Library of Congress Cataloging-in-Publication Data: Stephens, Rod, 1961- Expert one-on-one Visual Basic 2005 design and development / Rod Stephens. p. cm. Includes index. ISBN-13: 978-0-470-05341-6 (paper/website) ISBN-10: 0-470-05341-0 (paper/website) 1. Microsoft Visual BASIC. 2. BASIC (Computer program language) I. Title. QA76.73.B3S8335 2007 005.2'768 dc22 2006036646 No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appro- priate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be addressed to the Legal Department, Wiley Publishing, Inc., 10475 Crosspoint Blvd., Indianapolis, IN 46256, (317) 572-3447, fax (317) 572-4355, or online at http://www.wiley.com/go/permissions. LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY: THE PUBLISHER AND THE AUTHOR MAKE NO REPRESENTATIONS OR WARRANTIES WITH RESPECT TO THE ACCURACY OR COMPLETENESS OF THE CONTENTS OF THIS WORK AND SPECIFICALLY DISCLAIM ALL WARRANTIES, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PAR- TICULAR PURPOSE. NO WARRANTY MAY BE CREATED OR EXTENDED BY SALES OR PROMOTIONAL MATERIALS. THE ADVICE AND STRATEGIES CONTAINED HEREIN MAY NOT BE SUITABLE FOR EVERY SITUATION. THIS WORK IS SOLD WITH THE UNDERSTANDING THAT THE PUBLISHER IS NOT ENGAGED IN RENDERING LEGAL, ACCOUNTING, OR OTHER PROFESSIONAL SERVICES. IF PROFESSIONALASSISTANCE IS REQUIRED, THE SERVICES OF A COMPETENT PRO- FESSIONAL PERSON SHOULD BE SOUGHT. NEITHER THE PUBLISHER NOR THE AUTHOR SHALL BE LIABLE FOR DAM- AGES ARISING HEREFROM. THE FACT THAT AN ORGANIZATION OR WEBSITE IS REFERRED TO IN THIS WORK AS A CITATION AND/OR A POTENTIAL SOURCE OF FURTHER INFORMATION DOES NOT MEAN THAT THE AUTHOR OR THE PUBLISHER ENDORSES THE INFORMATION THE ORGANIZATION OR WEBSITE MAY PROVIDE OR RECOMMENDATIONS IT MAY MAKE. FURTHER, READERS SHOULD BE AWARE THAT INTERNET WEBSITES LISTED IN THIS WORK MAY HAVE CHANGED OR DISAPPEARED BETWEEN WHEN THIS WORK WAS WRITTEN AND WHEN IT IS READ. For general information on our other products and services please contact our Customer Care Department within the United States at (800) 762-2974, outside the United States at (317) 572-3993 or fax (317) 572-4002. Trademarks: Wiley, the Wiley logo, Wrox, the Wrox logo, Programmer to Programmer, Expert One-on-One, and related trade dress are trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affiliates, in the United States and other coun- tries, and may not be used without written permission. Visual Basic is a registered trademark of Microsoft Corporation in the United States and/or other countries. All other trademarks are the property of their respective owners. Wiley Publishing, Inc., is not associated with any product or vendor mentioned in this book. Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available in elec- tronic books. 01_053416 ffirs.qxd 1/2/07 6:25 PM Page iv Credits Executive Editor Robert Elliott Development Editor Kevin Shafer Technical Editor John Mueller Production Editor Eric Charbonneau Copy Editor Kim Cofer Editorial Manager Mary Beth Wakefield Production Manager Tim Tate Vice President and Executive Group Publisher Richard Swadley Vice President and Executive Publisher Joseph B. Wikert Graphics and Production Specialists Carrie A. Foster Denny Hager Stephanie D. Jumper Quality Control Technician Laura Albert Proofreading and Indexing ConText Techbooks 01_053416 ffirs.qxd 1/2/07 6:25 PM Page v About the Author Rod Stephens started out as a mathematician but, while studying at MIT, discovered the joys of pro- gramming, and has been programming professionally ever since. During his career, he has worked on an eclectic assortment of applications in such fields as telephone switching, billing, repair dispatching, tax processing, wastewater treatment, and training for professional football players. Stephens has written 15 books that have been translated into half a dozen different languages, and more than 200 magazine articles covering Visual Basic, Visual Basic for Applications, Delphi, and Java. He writes three weekly newsletters ( www.vb-helper.com/newsletter.html) that contain quick tips, tricks, and examples for Visual Basic developers. His popular VB Helper Web site ( www.vb-helper.com) receives several million hits per month, and con- tains thousands of pages of tips, tricks, and example code for Visual Basic programmers, as well as example code for this book. Currently, Stephens is an author, consultant, and instructor at ITT Technical Institute. Other Books by Rod Stephens Visual Basic 2005 Programmer’s Reference ISBN: 0-7645-7198-2 Visual Basic .NET and XML ISBN: 0-471-12060-X Visual Basic Graphics Programming, Second Edition ISBN: 0-471-35599-2 Bug Proofing Visual Basic Graphics ISBN: 0-471-32351-9 Custom Controls Library ISBN: 0-471-24267-5 Ready-to-Run Visual Basic Algorithms, Second Edition ISBN: 0-471-24268-3 Ready-to-Run Visual Basic Code Library ISBN: 0-471-33345-X 01_053416 ffirs.qxd 1/2/07 6:25 PM Page vii Acknowledgments Thanks to Bob Elliott, Kevin Shafer, and all of the others who make producing any book possible. Thanks also to technical editor John Mueller for making sure I wasn’t putting my foot too deeply in my mouth and for helping to add extra depth to the book. Visit http://www.mwt.net/~jmueller to learn about John’s books and to sign up for his free newsletter .NET Tips, Trends & Technology eXTRA. 01_053416 ffirs.qxd 1/2/07 6:25 PM Page ix Contents Acknowledgments ix Introduction xxi Why Visual Basic? xxi Who Should Read This Book xxii How This Book Is Organized xxiii How to Use This Book xxvi What You Need to Use This Book xxvi p2p.wrox.com xxvii The Book’s Web Site xxviii Part I: Design 1 Chapter 1: Language Selection 3 Language Addiction 3 Disadvantages 4 Interpreted, Not Compiled 4 Language Features 6 Multiple Inheritance 7 Platform Dependencies 8 Upgrading from Visual Basic 6 8 GUI Building 8 Verbosity 9 Power and Flexibility 9 Advantages 9 Self-Documenting 10 Prototyping and Simple Applications 10 IDE 11 Language Relatives 11 Garbage Collection 11 Large Talent Pool 12 Summary 12 02_053416 ftoc.qxd 1/2/07 6:26 PM Page xi xii Contents Chapter 2: Lifecycle Methodologies 15 Lifecycle Stages 15 Idea Formulation and Refinement 16 Team Building 17 Requirements Gathering 19 Feasibility Analysis 21 High-Level Design 23 Lower-Level Design 24 Implementation 25 Testing 26 Deployment 30 Support 31 Lifecycle Models 33 Throwaway 34 Waterfall 34 Prototyping 40 Mix and Match 46 Summary 47 Chapter 3: Agile Methodologies 49 Agile Programming 49 Crystal Clear 51 Extreme Programming (XP) 52 Agile Versus Traditional Lifecycles 60 Agile Strengths and Weaknesses 61 Design by Contract 62 Microsoft Tools for Agile Development 67 Summary 68 Chapter 4: Object-Oriented Design 69 The Bug Hunter Example 69 Building an Object Model 70 Picking Candidate Classes 70 Converting Candidates into Classes 71 Adding Internal Classes 74 Adding Database Classes 75 Studying Different Design Views 75 Improving the Classes 76 UML 79 Use Case Diagrams 80 Class Diagrams 83 02_053416 ftoc.qxd 1/2/07 6:26 PM Page xii xiii Contents Sequence Diagrams 85 Activity Diagrams 86 State Chart Diagrams 87 Component Diagrams 89 Deployment Diagrams 90 UML Summary 91 UML Tools 92 Summary 95 Chapter 5: User-Interface Design 97 UI Design Philosophy 98 Give the User Control 98 Focus on Tasks 98 Advise, Don’t Act 99 Help Users Do the Right Thing 100 Users 101 Understand the User’s Job 101 Respect the User 101 Understand the User’s Environment 102 Understand User Types 102 Forms 104 MDI versus SDI 104 Resizing Forms 105 Editors 107 Property Sheets 108 Design Principles 109 Prototype in Stages 110 Promote Form Flow 110 Group Related Items 113 Support Resizing 114 Support Different Font Sizes 115 Optimize Menus 119 Use Space Wisely 121 Design Good Headers 122 Preserve State 122 Undo and Redo 123 Accommodate Different Skills Levels 127 Provide Appropriate Feedback 129 Consistency 131 Summary 131 02_053416 ftoc.qxd 1/2/07 6:26 PM Page xiii [...]... Responsibility Chain of Events Command Delegation Model, View, Controller Property Procedure Snapshot Strategy For More Information Summary Part II: Meta -Development Chapter 8: Snippets, Macros, and Add-ins Snippets Using Snippets Making Snippets xiv 16 3 16 4 16 4 16 8 17 0 17 1 17 1 17 2 17 2 17 3 17 6 17 8 18 1 18 3 18 5 19 3 19 5 19 9 2 01 2 01 203 205 205 206 208 02_053 416 ftoc.qxd 1/ 2/07 6:26 PM Page xv Contents Installing... 4 01 403 404 405 406 409 410 410 411 413 413 414 415 415 416 416 417 417 418 419 422 426 427 429 430 4 31 432 432 xvii 02_053 416 ftoc.qxd 1/ 2/07 6:26 PM Page xviii Contents Chapter 16 : Bug Proofing Catching Bugs Waiting for Bugs Global Error Handling Hunting for Bugs Try Catch Blocks Responding to Bugs Summary 435 435 436 438 4 41 445 447 4 51 Chapter 17 : Testing 453 Testing Philosophy 453 Test Early and. .. Macros Customizing Visual Studio Sharing Macros Add-ins Making an Add-in Adding Add-in Code Making a Better Add-in Learning About Other Objects Summary Chapter 9: Scripting Scripting Safely Executing SQL Statements Running Queries Generating Queries Running Commands 211 211 212 213 214 214 218 218 2 21 222 222 227 230 2 31 236 237 237 2 41 2 41 244 247 Executing Visual Basic Code 2 51 Running Code Exposing... Methodologies Chapter 4 Object-Oriented Design Chapter 5 User-Interface Design Chapter 6 Data Storage Design Chapter 7 Design Patterns 04_053 416 pt 01. qxd 1/ 2/07 6:27 PM Page 2 05_053 416 ch 01. qxd 1/ 2/07 6:28 PM Page 3 Language Selection The chapters in this part of the book cover activities that occur before programming begins They describe development and design approaches, and some useful design techniques Many... applications Expert One-on-One Visual Basic 2005 Design and Development fills the gaps that these books leave surrounding Visual Basic development It explains the design activities that are necessary before Visual Basic development can begin It covers processes that occur after development (such as deployment, update management, and testing) that are essential to a successful Visual Basic project, but...02_053 416 ftoc.qxd 1/ 2/07 6:26 PM Page xiv Contents Chapter 6: Data Storage Design 13 3 Relational Databases Relational Database Products Compiled-In Data Resource Files Satellite Assemblies System Registry INI Files XML Other Text File Formats Object Databases Summary 13 3 13 9 14 0 14 5 14 8 14 9 15 4 15 7 15 9 16 0 16 2 Chapter 7: Design Patterns Creation Patterns Clone Factory... with a pre-.NET version of Visual Basic such as Visual Basic 6 The changes between Visual Basic 6 and Visual Basic NET are huge, and many Visual Basic NET concepts don’t translate well into Visual Basic 6 With some experience in C#, it would be much easier to translate programs into that language p2p.wrox.com For author and peer discussion, join the P2P forums at p2p.wrox.com The forums are a Web-based... what design patterns and anti-patterns are, describes some of the most useful, and refers the reader to other books such as Visual Basic Design Patterns by Mark Grand and Brad Merrill (Indianapolis: Wiley, 2005) for additional details Part II: Meta -Development The chapters in this part of the book discuss writing tools that are used by application developers These include add-ins that give design- time... developers, custom controls and components that can be placed on forms, and techniques that let the user execute scripts at run-time A good library of metadevelopment tools makes later development easier and less error-prone Chapter 8, “Snippets, Macros, and Add-ins,” explains how to write add-ins for the Visual Basic 2005 development environment It briefly describes code snippets and explains when it is... syntactic differences The fact that many pre-.NET Visual Basic developers were self-taught and that many came to Visual Basic via Visual Basic for Applications (VBA) makes Visual Basic seem more ordinary to many managers, and lends an extra mystique to Java, C++, and C# Salaries for Java, C++, and C# programmers also tend to be higher than those of Visual Basic developers This is probably partly because . 0-4 7 1- 3 559 9-2 Bug Proofing Visual Basic Graphics ISBN: 0-4 7 1- 3 235 1- 9 Custom Controls Library ISBN: 0-4 7 1- 2 426 7-5 Ready-to-Run Visual Basic Algorithms, Second Edition ISBN: 0-4 7 1- 2 426 8-3 Ready-to-Run. One-on-One ™ Visual Basic ® 2005 Design and Development 01_ 053 416 ffirs.qxd 1/ 2/07 6:25 PM Page i 01_ 053 416 ffirs.qxd 1/ 2/07 6:25 PM Page ii Expert One-on-One ™ Visual Basic ® 2005 Design and. 2005 design and development / Rod Stephens. p. cm. Includes index. ISBN -1 3 : 97 8-0 -4 7 0-0 534 1- 6 (paper/website) ISBN -1 0 : 0-4 7 0-0 534 1- 0 (paper/website) 1. Microsoft Visual BASIC. 2. BASIC (Computer

Ngày đăng: 14/08/2014, 11:20

Từ khóa liên quan

Tài liệu cùng người dùng

Tài liệu liên quan