Tech Trends - Industry Articles

Using Visual Basic to Prepare Learners for C++

Author Todd Knowlton

By Todd Knowlton

Microsoft Visual Basic is a popular development tool in industry and in education. I am often asked whether Visual Basic should be taught instead of C++ or in addition to C++. I am also asked whether Visual Basic should be taught before or after C++. The short answer is that there is not one right way or any perfect language. However, most teachers agree that while C++ is an important and useful language, it is challenging for students. Many teachers are discovering that Microsoft Visual Basic is a language that provides a friendly environment while teaching important concepts, making it a good language to use to prepare students for C++.

Visual Basic is a language that allows you to create Windows programs. The language is easy, fun, and teaches many important programming and operating system concepts. Visual Basic is motivating. Students like writing programs that look like the programs they use. Visual Basic programs use all the elements of other programs written to run under Microsoft Windows, such as buttons, windows, and menus. It is even easy to create simple games using Visual Basic.

A wide variety of students can be successful programming Visual Basic. Students can create their programs using a graphical environment. Visual Basic allows students to be successful when they know how to write only a few lines of code. Students can then build on that success as they learn more features of the language.

Visual Basic introduces and reinforces many important concepts. Students use forms, controls, and properties when creating Visual Basic programs. In the Visual Basic environment, the use of these elements comes very naturally. As a result, students gain an understanding of event-driven programming and how Windows programs are built. More important to the preparation for C++, students learn concepts of object-oriented programming.

Visual Basic can prepare students for C++ in more specific ways as well. Let's look at some specific examples of how learning to program in Visual Basic will lay a foundation for programming in C++.

Mathematical operators. The basic mathematical operators in Visual Basic are the same as in C++. Visual Basic even supports integer division and modulus. Another advantage to teaching Visual Basic before C++ is that you can teach mathematical operators before teaching data types and variables. In Visual Basic, the values used in mathematical operations can come straight from the text boxes on the user interface. Because of this, useful programs can be written that do not require the use of variables.

Data types and variables. When you do teach data types and variables in Visual Basic, they are similar to those used in C++. Like C++, Visual Basic has separate data types for integers and decimal numbers. Visual Basic also supports Boolean variables for logical operations and string variables for text. C++ has a Boolean type as well, and supports strings through object-oriented programming. Therefore, the data types and variables used in Visual Basic will help prepare students for those found in C++.

Decision structures. Visual Basic includes the common decision structures found in C++. For example, both languages have the If and If/Else structure for controlling the flow of logic. Both languages allow these structures to be nested. Finally, both languages have a multi-way selection structure. There are differences in the way these structures are used in each language. However, students will adapt to the C++ way more easily if they already have an understanding of the way the decision structures are constructed.

Loops. Visual Basic and C++ also have the same basic looping structures. Both languages have "Do" loops that allow the loop conditions to be tested at the top or bottom of the loop. In addition, both languages support a version of the "For" loop.

The similarities between the languages make the transition to C++ easier. C++ can be very particular about syntax and structure. The "nit-picking" for which C++ is famous can be frustrating to a student who has never worked with concepts like data types and loops. Visual Basic allows students to master these concepts in a more forgiving and easy-to-use environment.

Visual Basic does have some features that should be handled with care. For example, Visual Basic allows you to use a variable that has not been declared. This can cause debugging problems and allow students to develop habits that are not good to develop when preparing for C++. The Option Explicit command, however, can be used to require variables to be declared. Also, Visual Basic is not case sensitive. In fact, the window into which code is keyed will make the capitalization of key words uniform. C++ will not make these corrections for you and is very particular about case. Therefore, a student making the switch from Visual Basic to C++ will have to be disciplined or may have to unlearn some habits.

You may be asking whether a student who learns in the very-forgiving Visual Basic environment can successfully transition to the less-forgiving C++. Not every student will be able to successfully move from Visual Basic to C++. However, I think you will find that more students can master C++ after learning Visual Basic than by beginning with C++. I believe that the gentle introduction to important concepts and the appeal of Visual Basic far outweigh the potential for students to become spoiled by the Visual Basic features. Students who have mastered Visual Basic will be well-prepared with an understanding of important concepts and encouraged to find that they can be successful programmers.

About the author

Todd Knowlton is President of Smooth Fusion Digital Media Group and author of more than a dozen books on computer programming, operating systems, and computer concepts, including C++ Basics. He is also co-author of Microsoft Visual Basic BASICS.
 



STUDENTS
Student Downloads Student Downloads

INSTRUCTORS
Instructor Downloads Instructor Downloads
Login Login to Your Account
Request a Desk Copy Request a Desk Copy
Teach with Technology Teach With Technology
Events Events
Catalog Articles Catalog Articles

RESOURCES
South-Western Computer Education

AP Avenue