Programming for Technology Students Using Visual Basic

Programming for Technology Students Using Visual Basic

Other Format(Older Edition)

$105.00

Product Details

ISBN-13: 9780136220442
Publisher: Simon & Schuster Adult Publishing Group
Publication date: 05/29/1998
Edition description: Older Edition
Pages: 665
Product dimensions: 8.26(w) x 10.84(h) x 1.28(d)

Table of Contents

1. Talking with Computers.
2. An Introduction to Problem Solving.
3. Language Elements.
4. Programming Blocks and Visual Programming.
5. Decision Logic.
6. Repetition (Arrays and Loops).
7. Algorithms.
8. File Handling.
9. Object and Data Structures.
10. Graphics, Animation, and Multimedia.
11. Active Visual Basic X: Object Linking and Embedding (OLE) and Automation.
12. Database Programming.
Appendix A. Conventions.
Appendix B. Language Summary.
Appendix C. Glossary.
Appendix D. Resources.
Index.

Preface

Several thousand years ago, Sappho saw some workers loading a ship at the dock. She asked one worker what he was doing. He replied, "I am carrying this crate to the boat." Sappho wasn't satisfied because she was looking for the answer. She asked another worker, and he replied, "We are preparing to undertake a voyage to discover new things:" Sappho asked no more because she had found the answer. A computer program is a set of instructions to control the operation of a computer. It is important to understand the instructions; however, the aim is to write instructions to do something useful.

This is a foundation resource for learning computer programming. It so happens that we use the Visual Basic® language to do this. The book covers the fundamentals: program analysis, design, language elements, documentation, control structures, testing, algorithms, input/output processing, file processing, data structures, multimedia, object components, databases, and some under-the-hood insights about what makes a computer program tick. Acquiring all of these skills is necessary before one can undertake software development of the industrial-strength programs for which Visual Basic is typically used.

WHY USE THIS BOOK?

If you are already an accomplished programmer, this is not the book for you; but if you have never programmed before or have only rudimentary programming experience, read on. We can help you master the fundamentals required to create programs from scratch. This book emphasizes the problem-solving and programming concepts that are fundamental to all programming. Case studies for a small, fictitiousmanufacturing company provide context for programming in the real world. We introduce new material when it is needed in terms of solving a problem, so you can immediately use the knowledge for both business and technical applications as related to that small company, Cougar Canoe Company.

Since Visual Basic is rich with features, beginners may find it difficult to learn vital concepts using off-the-shelf Visual Basic. We start with Visual Basic templates that contain little or no code. You will simply add code to a template; thus, we only introduce a few features about event-driven programming in the early chapters. By the end of Chapter 4, we discard templates so that you can create the complete program including the visual design part. By then you will be in a good position to learn the advanced programming techniques that take full advantage of Visual Basic and third-party add-on resources.

WHAT YOU NEED TO KNOW

To begin this book, you must have a basic proficiency in Windows. We recommend Windows 95 or later versions. For details about the requirements, see the section "Read Me Before Attempting the Hands-On Exercises" (p. 1). These exercises assume that you can perform operations common to typical Windows applications. Ironically, after learning Visual Basic, you will have a better understanding of Windows itself.

BRIEF NOTE ABOUT VISUAL BASIC

Visual Basic is a powerful language that is used to develop a wide range of applications. It is virtually an industry-standard language. Business and industry use it for developing stand-alone programs, front ends to large-scale database systems, Internet interactivity (VB Script), office automation enhancements (such as Microsoft Office), and other types of software.

Since the introduction of Visual Basic, Microsoft has released Versions 1, 2, 3, 4, 5, and 6. As this book neared completion, Microsoft released pre-production copies of VB.NET (version 7) for testing. VB.NET and subsequent versions will have new language features and new tool features. Because this book covers fundamentals, these changes won't affect the operation of most program examples. There may be some changes in recommended practice and how to use some of the tools within the Visual Basic Integrated Development Environment (IDE).

PROGRAMMING FUNDAMENTALS

The fundamentals of programming require one to understand elements such as statements, variables, data types, and expressions. Programmers also need to understand a bigger picture. They must analyze, design, document, and test the program under development. We cover each of these key activities in program development. Most programming examples use an application context. This emphasizes that software exists for solving problems and that the application and the software are intimately related (although some write software as a hobby). A case study approach with Cougar Canoe Company illustrates why certain program elements are used and explains why it is necessary to initially analyze the problem away from the computer prior to entering code at the computer. We provide sample problems with solutions, and then we pose additional problems. These become progressively more challenging as fewer hints are provided.

With off-the-shelf Visual Basic, there are abstract concepts such as events, objects, properties, and project files to understand before one can even begin to program in a Windows environment. To get started in the early chapters, we reduce exposure to these concepts by employing templates. With a template, you can concentrate on the fundamentals without worrying about the Windows environment and visual design considerations. These templates are pre-built forms with required buttons and boxes. You will just need to write the code to interact with these buttons and boxes. At the end of Chapter 4 we fully expose the Visual Programming aspect of Visual Basic programming. This is when you will build your own forms—adding buttons, boxes, sliders, and other elements. At this point, you are fully exposed to objects, properties, events, and methods. Later, we include other features such as object classes, which include custom properties, methods, and events. Throughout the book we also cover Visual Basic's Help system and debugging tools so that you can actually create programs. Otherwise you could be stuck with only the ability to code by following paint-by-numbers-style instructions.

Note: The first edition used an Introduction Template for early chapters to implement a procedural programming methodology. We no longer use the Introduction Template, nor do we refer to procedural programming. Right from the beginning, we start with event-driven programming. What differs from most programming books is the immediate emphasis on coding by providing pre-built graphic interfaces for the early chapters. However, the CD-ROM includes the Introduction Template for anyone interested in using it.

Troubleshooting and Error Trapping. Early on we add exercises that use Visual Basic debugging tools such as single stepping, breakpoints, watch expressions, calls stack, and the immediate window. These tools are essential for industrial-strength software development. Just as important, these tools help you learn how programs operate by diving into the specifics of program operation. For example, you can see program branching in action, or the point where an error occurs. We reinforce the need and methods for detecting errors. Throughout the book, we highlight potential sources for error by category: syntax, logical, and runtime. The book covers techniques for detecting and handling errors. This includes errors resulting from a user making a mistake, also known as input validation. This is real-life programming, which is why troubleshooting exercises using the debugging tools are included. Commercial software is rarely 100 percent error-free.

BOOK ORGANIZATION

Each chapter has the following:

  • Objectives to explain what you will learn.
  • The scenario of an application requirement that illustrates why the content is covered.
  • Topics to explain the content.
  • Hands-on exercises to provide practice with the content.
  • Questions.
  • Additional problem solving to check your mastery.

The topics typically include these:

  • Examples.
  • Sample problems with solutions.
  • Documentation.
  • Troubleshooting: Debugging and testing.
  • Highlights to indicate key points.

The appendices provide useful reference to topics and language elements. Appendix D can be a starting point for going beyond this book. The CD-ROM included with this text contains the program files and supplemental information used in the exercises. It also contains answers to the questions and solutions to most problems. There is a simplified online help system that can be accessed using a web browser. The CD contains the Visual Basic 6 Working Model.

INSTRUCTOR RESOURCES

The Instructor's Manual includes some additional questions with solutions as well as the solutions to the Additional Problem Solving exercises in each chapter.

THE CHAPTERS

Chapter 1 describes the relationship between the computer and programming languages. It introduces the programming requirements for Cougar Canoe Company, the case study company. We cover language translation in relation to the operating environment and introduce our first program, the Hello World program. We progressively extend Hello while beginning discussions of syntax, documentation, and debugging.

Chapter 2 is a guide to solving problems without regard to the actual language, although some program templates are used for concrete examples. The Hands-On Exercises include some interactive examples to graphically illustrate problem solving.

Chapter 3 explains elements that are typical to all languages. It uses the Introduction Template to concentrate on fundamental elements. The Hands-On Exercises include the use of Help and Debug tools to monitor program execution.

Chapter 4 explains the concept of reusable modules (also known as program partitioning) and how they communicate with each other. The end of Chapter 4 introduces Visual programming and covers more Windows-style event-driven programming. The troubleshooting exercises provide in-depth analysis of procedure calls, parameters, and arguments.

Chapter 5 covers the fundamental decision-making structures used to change the flow of program execution. These are the variations of the If Then Else type statements, as well as the Select Case statement. The chapter includes the topics of input validation and error trapping, both of which are key components in a real-life program. It also covers program testing during software development.

Chapter 6 explains the fundamental loop structures used to cause repetition of some program statements. These are the For Next, Do While/Until, and WhileUntil Do statements. The chapter also introduces the array data type since many typical loop applications involve the use of arrays. The Hands-On Exercise includes a mock program maintenance session. Troubleshooting exercises cover typical looping problems and creation of test sets for programs under development.

Chapter 7 covers the topic of algorithms with a mix of business and technical examples.

Chapter 8 outlines the basics of file handling. We start with a simple viewer program and then examine how to handle data storage using files for sequential, random, and binary access. The program examples are a simple text editor and a prototype customer information program for storing records. The examples include fully functional standard Windows file dialogs.

Chapter 9 introduces the topic of object and data structures with some examples. This chapter starts with using and defining object classes. Then it uses object classes to implement some rudimentary structures, which are the stack, queue, and linked list. The culmination of this chapter is a customer information program that stores customer records and permits insertion and deletion of records.

Chapter 10 covers the use of graphics, animation, and multimedia. It includes the use of graphics files and the multimedia (MCI) control. This chapter includes a program that combines media elements to be used as an elementary promotional marketing tool for a fictitious canoe company.

Chapter 11 covers the topic of ActiveX, OLE, and Automation. This topic covers the use of existing tools and applications in a Windows environment to add functionality to a Visual Basic program. The chapter includes a program that uses a word processor and spreadsheet program. Another program uses elements of an external application. Other programs control a web browser or replace it.

Chapter 12 is about database programming, probably the most common use for Visual Basic in the working world. Programs are front ends to access commercially available databases, such as Access, Paradox, and so on. We use the data control, Data Access Objects (DAO), and ActiveX Data Objects (ADO), as well as introduce remote data access, such as the use of Open Database Connectivity (ODBC).

HOW TO USE THIS BOOK

Generally, we present topics in a linear sequence. However, you can use the embedded cross-referencing and the index to utilize sections out of order. If this book is being used for a conventional one-semester course, we recommend the following times for three- or four-hour weekly sessions. Spend two weeks on Chapter 1. Although the material can be easily covered in one week, it may be wise to use an extra week to familiarize yourself with the course, and just basically ease into a new experience. There may be registration and facility logistics to work out. Generally, Chapters 2 to 4 require two weeks each since they provide thorough coverage of programming fundamentals. The remaining chapters can be covered in one week each because a thorough groundwork has already been provided.

An exception might be Chapter 7. In this case, you could omit certain exercises to suit a business or technology focus as suggested in the chapters. Depending on the institution, this may leave a few weeks for catching up. Chapter 9 can be omitted if you are not covering object classes and data structures. Depending on other considerations, some curricula may omit some of the later chapters. (Even if you have the opportunity to follow your own pace, we suggest that you try to maintain a schedule similar to that suggested here.) For an explanation of the typographic styles, refer to Appendix A. Also refer to the other appendices for additional references.

COMPUTER SCIENCE CURRICULUM

This book meets some of the curriculum requirements as specified by the ACM and the IEEE Computer Society. It covers PR: Introduction to a Programming Language, and it partially covers SE: Software Methodology and Engineering.

ACKNOWLEDGMENTS

The idea to write a book is sometimes the result of a perceived need. In 1997, Sir Sanford Fleming College began offering Visual Basic to students in technology. This experience showed me the need for a textbook covering programming fundamentals using Visual Basic. I want to acknowledge these former students, and also colleagues, who pioneered early versions of the courses. Prentice Hall deserves much praise for getting this project off the ground. Charles Stewart provided strong support and immediately obtained editorial approval for the project's first edition. I thank the reviewers who made valuable suggestions, many of which were incorporated into the second edition. Various production people did excellent work to put together the book and CD-ROM program disk. Delia Uherec of Prentice Hall guided and kept me on track for the writing and for the production of the CD-ROM. Tricia Rawnsley of Prentice Hall, Gina Sudzina Smith, and numerous individuals at Custom Editorial Productions provided excellent handling of the copyediting, proofreading, art rendering, and other production activities. They did much to keep the book production on track and on time. If there are any remaining flaws, the fault is mine.

Many thanks to the following reviewers for their thorough examination of the book and their helpful suggestions: Dr. David Todd, Mt. Hood Community College; David Lipp, Strayer University; and Anthony J. Nowakowski, Buffalo State College.

Of course, I thank my family, Renate, Emilie, Hannah, and Anika, for putting up with my focus on the book when we could have been enjoying family activities. It is with their patience, support, and understanding that I was able to complete this project. Thank you all.

Customer Reviews

Most Helpful Customer Reviews

See All Customer Reviews