Runtime Revolution
 
Articles Other News

Learning Revolution for the First Time

by Wallace Wang

 

The first time I tried programming in Revolution, I didn't like it. The language seemed too unusual and wordy. Having studied BASIC, Pascal, and C, I initially dismissed Revolution as another proprietary programming language that would slowly fade from view.

But I was wrong. The more I played with Revolution, the more I came to appreciate the elegance of its language. Look at a C program and it looks like a mathematical formula. Look at a Revolution program and it looks almost as readable as a regular English sentence. You may not fully understand what a given Revolution command may do, but you can figure it out in a hurry.

So while languages like C forced you to use comments to describe what its cryptic symbols and commands are doing, Revolution code practically explains itself. You may not understand the overall purpose of a Revolution program, but you can decipher its individual commands without a problem at all.

Coming from a BASIC programming background, I was already familiar with BASIC's ability to create variables "on the fly" and use them in a command right away, such as:

X = 25

However, even BASIC proved a bit restrictive by forcing you to define one variable type for storing numbers (X) and a different variable type just for storing text strings such as:

X$ = "Mary Jones"

Of course in Revolution, you can create a variable "on the fly" and store any type of data. One second a variable might hold strings, another real numbers, and a third time it might hold integers. Revolution doesn't force variables to hold only one data type although you have to learn how to assign a value to a Revolution variable, such as:

put 25 into X
or
put "Mary Jones" into X

That's when I realized why so many programming languages force you to declare your variables and their data types ahead of time. This isn't for the protection of the programmer (like they teach you in computer programming classes); it's to make things easy for the compiler.

Declaring your variables and their data types means the compiler doesn't have to figure this out while the program is running. Any time you work to make things easier for the computer, you tend to make things harder for the user, and that's what most traditional programming languages do.

On the other hand, Revolution worries about what type of data you store in your variables so you can focus on solving a problem rather than doing work to make things easier for the compiler.

Taking the concept of variables even further, most programming languages let you create arrays, which act like "super" variables that can hold multiple items inside a single variable. Unfortunately, arrays are restrictive and clumsy.

In most languages, you must define the size of your array ahead of time and then define what data type that array can hold. So it's possible to create an array that can store only numbers or only strings, but never both. Even worse, what if you wanted to expand or shrink your array while the program runs?

In some languages, you have to experiment with different array sizes until you find the size that works best for your program, which isn't exactly the best use for your time. To deal with this problem, most programming languages now let you resize an array so you can expand it (if you need more room) or shrink it (if you need to conserve the computer's memory).

To get around the problem of storing different data types, programming languages such as Visual Basic have introduced a new data structure called a "collection." Basically a collection acts like a "super" array by letting you store different data types and resize (shrink or expand) the collection at any time.

Of course, Revolution's approach to creating arrays is simple. Just assign a value to an array variable name and that's it, such as:

put 98 into arrayname[key]

Arrays in Revolution already act like collections in other languages. In Revolution, you can create an array and store data in that array at any time. While most arrays identify data by an index number, Revolution lets you identify data by a descriptive "key."

To find data stored in an array, you have to know which index number you assigned to that data. To find data in a Revolution array, you have to know the descriptive "key" you assigned to that data. Since descriptive "keys" are much easier to remember than an abstract number, Revolution once again lets you focus on writing your program rather than remember which number corresponds to which data.

By the time I finished rewriting my book "Beginning Programming for Dummies, 4th edition," which includes brief coverage of Revolution, I found myself adapting to Revolution's way of programming easily. Every time I had a problem programming in Revolution, it usually stemmed from my insistence to use traditional programming commands, such as typing:

X – 98

Instead of the equivalent Revolution command:

Put 98 into X

Once I got familiar enough with the Revolution language, I found it harder and harder to go back to using traditional programming languages like BASIC or C++. When I write a program, I just want to make it work and I don't want trivial details to get in my way, like defining every variable and data type ahead of time.

Revolution may not be the best language in the world, but it's much faster than using most every other programming language available. If given a choice to go back in time and learn either BASIC and C, or just Revolution, I would choose Revolution.


You can buy Wallace Wang's book "Beginning Programming For Dummies" here. Or you can get more infomration about it at www.dummies.com.

 
©2005 Runtime Revolution Ltd, 15-19 York Place, Edinburgh, Scotland, UK, EH1 3EB.
Questions? Email info@runrev.com for answers.