The Basics: How Programming Works

Before you jump in and start learning the Visual Basic programming language, it may help you to understand what a programming language is and how it works. This includes some programming terminology. The best place to start is with the basics.

How Programming Works

On its own, a computer isn't very smart.

A computer is essentially just a big bunch of small electronic switches that are either on or off. By setting different combinations of these switches, you can make the computer do something, for example, display something on the screen or make a sound. That's what programming is at its most basic—telling a computer what to do.

Of course, understanding which combination of switches will make the computer do what you want would be a difficult task—that's where programming languages come in.

What Is a Programming Language?

People express themselves using a language that has many words. Computers use a simple language that consists of only 1s and 0s, with a 1 meaning "on" and a 0 meaning "off." Trying to talk to a computer in its own language would be like trying to talk to your friends by using Morse code—it can be done, but why would you?

A programming language acts as a translator between you and the computer. Rather than learning the computer's native language (known as machine language), you can use a programming language to instruct the computer in a way that is easier to learn and understand.

A specialized program known as a compiler takes the instructions written in the programming language and converts them to machine language. This means that as a Visual Basic programmer, you don't have to understand what the computer is doing or how it does it. You just have to understand how the Visual Basic programming language works.

Inside the Visual Basic Language

The language you write and speak has structure: for example, a book has chapters with paragraphs that contain sentences consisting of words. Programs written in Visual Basic also have a structure: modules are like chapters, procedures are like paragraphs, and lines of code are like sentences.

When you speak or write, you use different categories of words, such as nouns or verbs. Each category is used according to a defined set of rules. In many ways, Visual Basic is much like the language that you use every day. Visual Basic also has rules that define how categories of words, known as programming elements, are used to write programs.

Programming elements in Visual Basic include statements, declarations, methods, operators, and keywords. As you complete the following lessons, you will learn more about these elements and how to use them.

Written and spoken language also has rules, or syntax, that defines the order of words in a sentence. Visual Basic also has syntax—at first it may look strange, but it is actually very simple. For example, to state "The maximum speed of my car is 55", you would write:

Car.Speed.Maximum = 55

You will learn more about syntax later, and tools in Visual Basic such as IntelliSense provide you with guidance in using the correct syntax when you write programs.

Next Steps

In this lesson, you learned what a programming language is and how it works. In the next lesson, you will start learning how to use the Visual Basic programming language. Don't worry—you'll be speaking Visual Basic in no time at all!

Next Lesson: Representing Words, Numbers, and Values with Variables

See Also

Tasks

Representing Words, Numbers, and Values with Variables

Concepts

Closer Look: Understanding Properties, Methods, and Events

Introduction to the Visual Basic Programming Language

Other Resources

Creating Your First Visual Basic Program

Visual Basic Programming Guide