Home     About           Free Videos           FAQ     Contact  
Copyright 1999



This paper will explore issues for choosing a language for an introductory computer-programming course. Some of the major considerations for selecting a programming language should include (1) introduces the major concepts, (2) exposes students to the increasingly popular object-oriented development environments, (3) allows integration with other common applications, (4) minimizes software costs, and (5) supports an easy transition to developing Web applications. As each of these considerations is examined, the language Visual Basic will be evaluated as a possible implementation language for an introductory computer- programming course.


In a rapidly changing field such as computer science or management information sciences, there is a danger that a student's knowledge will quickly become out of date. It is therefore imperative that an introductory computer-programming course teaches principles that will endure, rather than technical details that will quickly become obsolete. Consequently, any implementation techniques should form the basis of techniques that are likely to be useful for a long period of time. Below are some of the major constructs that an introductory computer-programming course should cover.

Selection Structures

Selection structures (also known as conditional statements) allow a program to decide on a course of action based on the result of a condition. These structures are commonly divided into two general classifications. In the first class, the course of action is typically limited to one or two paths (i.e., without nesting statements). The first path is executed when the condition evaluates to true. The second path, also known as the alternate or else part, is executed when the condition evaluates to false. For example, the following Visual Basic statement prints "Pass" when the variable average is greater than or equal to 60, otherwise, it prints "Fail".

    if average >= 60 then
      print "Pass"
      print "Fail"
    end if
In the second class, multiple courses of action may be specified. These structures allow a problem to be divided into several cases that are handled differently. Visual Basic supports a labeled case-statement that is more flexible than an un-labeled case-statement. In particular, the labeled case-statement allows values other than integers to be used to determine between the cases. For example, the code below displays a message based on a student's grade.
    select case grade
      case "A" 
        print "Excellent"
      case "B"
        print "Above Average"
      case "C"
        print "Average"
      case "D", "F"
        print "Below Average"
    end select

Repetition Structures

Repetition structures can be divided into definite iteration and indefinite iteration. Definite iteration - iterates a predictable number of times. In Visual Basic, the For…Next statement supports definite iteration. For example, the following code prints out the numbers between 1 and 10.

    For index = 1 to 10
      print index
    Next index
Indefinite iteration is a repetition structure where the exact number of iterations is not known in advance. When using indefinite iteration, a condition is tested during each iteration to determine whether or not the loop has completed. Visual Basic supports both a leading-decision iterator (i.e., the Do…While loop) and a trailing-decision iterator (i.e., the Do…Until loop). In the example below, the file "movies.txt" will be sequentially read until the end-of-file (eof) marker has been encountered.
    open "c:\temp\movies.txt" for input as #1
    do while not eof (1)
      input #1, temp
Other Structures

Other constructs that should be examined in an introductory computer course and which are supported in Visual Basic include:

File Access – how to create, open, and close files, as well as how to write and read data from both sequential and random access files.

Subroutines (procedures/functions) – blocks of code that perform specific tasks. Passing information to and from subroutines should also be studied in an introductory programming course.

Arrays – an ordered arrangement of data elements. Many common business applications use one-dimensional and two-dimensional arrays for storing data. Visual Basic supports arrays containing up to 60 dimensions (Zak 1999).


In addition to introducing the major programming concepts, an introductory programming course should expose students to the increasingly popular object-oriented development environments. Object technology can deliver faster development, increased quality, and easier to maintain code (IBM 1999). In object-oriented languages, the emphasis of the program is on objects (such as scroll bars, radio buttons, text boxes, and command buttons) and events (such as clicking, double clicking, and dragging) that occur to those objects. By using object-oriented technology, programmers do not have to start from scratch when developing new applications, but instead can use pre-constructed objects.

Visual Basic is an object-oriented programming language. This is in contrast to procedure-oriented languages such as COBOL, BASIC, Pascal, and C. In procedure-oriented languages, the programmer controls the order in which the instructions are executed. The programmer must write the necessary code from the start of the application until the task is completed. In these languages the code (computer instructions) often called procedures and functions is separate from the data (information) that is usually stored in some type of structure. However in object- oriented languages, the code and the data are stored together in objects. The programmer communicates with objects by sending messages to them. The programmer does not change the code contained within the objects. This process of hiding the code and not allowing the user to modify it is called "information hiding" or encapsulation.


Learning how to interface and integrate various technologies is a very important skill. In particular, being able to integrate office applications (such as word processing, spreadsheets, and databases) with a programming language is a skill many employers are looking for in graduates today (VBA 1999). By learning Visual Basic, students will be taught the skills necessary to write Visual Basic for Applications (VBA) since it is a subset of Visual Basic as shown in Figure 1. VBA is a part of Microsoft Office, which can be found on thousands of computers. VBA allows proficient users of Word, Excel, Access, and PowerPoint to more fully utilize this software. It allows repetitive tasks to be easily automated saving time and reducing errors. It also increases the functionally of the software. VBA directly uses applications such as Excel. Hence, writing VBA consists mainly of using it to interface with the objects of the underlying application.

While applications like Excel include a comprehensive listing of built-in functions, inevitably there will arise a need to customize or write functions for a particular task. For example, Excel includes a built-in function called max that returns the maximum value for a specified range. However, Excel does not support a function that returns the two largest values from a range. To find the two largest values in a range requires a VBA to be developed similar to the one shown below. This example finds the two largest values in cells A1 through A100 and stores this information in cells B1 and B2.

    Dim largest, second_largest As Integer
    Dim temp, temp2, index As Integer

    temp = Cells(1, 1).Value
    temp2 = Cells(2, 1).Value
    If (temp > temp2) Then
      largest = temp
      second_largest = temp2
      largest = temp2
      second_largest = temp
    End If
    For index = 3 To 100
      temp = Cells(index, 1).Value
      If (temp > largest) Then
        second_largest = largest
        largest = temp
        If (temp > second_largest) Then
          second_largest = temp
        End If
      End If
    Next index
    Cells(1, 2).Value = largest
    Cells(2, 2).Value = second_largest


As the use of technology increases in the classroom maintaining current software, upgrading computers, providing training and user support can be challenging to most institutions. According to the Campus Computing Project (Campus 1995), "The useful life of the desktop computers and accompanying software is roughly 15 months for many core software applications and maybe 30 or 36 months for hardware." Selecting a programming language that minimizes software costs can significantly help an institution meet these financial challenges. Through academic discounts, Visual Basic (which is part of Visual Studio) can now be outfitted for educational labs with the full suite of Microsoft development tools for less than $5.20 (US) per seat. With prices like this, it is possible for educational institutions to maintain current software in their computer labs.


Every day more and more applications are being developed for the Web. These applications are being used to access databases and order products. They are proving that the Web is much more than a server protocol for transferring static documents. Instead, we are seeing the Web being used to perform sophisticated information retrieval and run external applications. When selecting a programming language, the ability to create applications for the Web should be a considered. By learning Visual Basic, students are gaining the knowledge to create fully interactive, dynamic pages. This is because Visual Basic is a superset of Visual Basic Script (VBScript) as shown in Figure 1. VBScript is a scripting language designed to run inside web browsers and makes it easy to turn a static HTML page into a dynamic, interactive client side application. One of the main differences between Visual Basic and VBScript is that since the code runs within a web page, functions that can be used to edit files and in any way tamper with the system are not present in VBScript.


Due to its combination of power and ease of use, Visual Basic (and its corresponding subsets VBA and VBScripts) is becoming the programming language for use on the Internet and in the business world and should also be considered for adoption in your classroom. As examined in this paper, Visual Basic (1) introduces the major programming concepts, (2) exposes students to the increasingly popular object-oriented development environments, (3) supports integration with many desktop applications, (4) minimizes software costs, and (5) supports an easy transition to developing Web applications. By integrating Visual Basic into the classroom, you will be providing students with knowledge for immediate application in the workplace, as well as a broader body of learning, which will provide a solid foundation for future scholastic achievement.