Learning Computer Programming with Celestia

Who Says Learning the Basics of Programming Has to Be Dull?

Wayne McDonald
In previous postings I have suggested several free downloadable resources that you and/or your children can use to gain a working knowledge of computer programming. Beginning with today's post, I'll guide you through the process of writing your first programs using two freely available resources: Notepad++ and Celestia. But before we begin, let us agree on the definition of a few terms.

Computer Programming

As one of my former programming instructors (Joe P.) says, "Computer programming is the process of making a computer do what you want it to do rather than letting the computer do what it wants to do, which is to sit there and do nothing." The way you tell your computer to do something requires the use of either a programming language such as Java, C++, or Smalltalk or a scripting language such as Perl, PHP, or JavaScript.

A Word About "Programming/Compiled" versus "Scripting/Interpreted" Languages

For our purposes, we can think of the terms "programming" and "scripting" as being essentially synonymous. However, in reality, there are several important differences

As a general rule, programming languages are more "versatile" than scripting languages. By this I mean that a programming language is just what its name implies: it is a language that is used to write computer programs that accomplish a specific task or tasks. As an example, your web browser (such as Firefox, Internet Explorer, or Chrome) is probably written using the C or C++ language or possibly a combination of several languages. Regardless of the underlying languages, the code that you as a programmer would write must first be complied ("translated") from something that you can understand into something the computer can understand. A compiler is the special device that takes in your code and returns this "machine code."

On the other hand, Interpreted Languages are (surprise!) interpreted "on the fly" (as the computer encounters the code written in a particular language and its instructions to the computer) rather than executing a previously-compiled program. In this and subsequent postings you will be using a very user friendly language known as Lua to learn the basics of programming. Although some "purists" (a polite way of saying "nitpickers") will condemn scripting languages as being inferior to "real" programming languages, you will find that scripting languages (particularly JavaScript) are the "heart and brains" of many web applications and services such as those provided by Google's Web Toolkit and Yahoo's User Interface library. As you will soon learn, scripts can easily control the actions of some compiled programs.

With the preliminaries now pushed aside, let's take a look at the tools we will be using later on.

Notepad++

Although you can use any "plain text" editor to write your Lua scripts, I recommend using Notepad++, which is free ("... as in 'free speech' and 'free beer'...") and can be download from the Notepad++ web site. Once you have downloaded the setup program (for Windows, it's Notepad++ v5.8.7.Installer.exe or the appropriate version for your computer's operating system), all you need do is click on the file, accept the defaults, and you're set.

Celestia v. 1.6.0, or better

I first mentioned Celestia in my More Free Software for Christmas posting. Since that time, I have used this same program to demonstrate the fundamentals of programming to a fifth grade class science class and was pleasantly surprised to find that all seemed to grasp the subject fairly quickly. Since I'm not noted for my eloquence or didactic skills, I attribute those individual results to one simple fact: kids learn faster in a visual environment.

As you will see, Celestia is a visually-intensive environment. By this I mean that once you write your program (technically, a script) and load it into Celestia, you get to see the results immediately without having to go through a lot of intermediate steps. On top of that, it's kind of neat to go cruising around the Solar System when you're in the driver's seat!

Go to the Celestia download page and select the version of Celestia that is appropriate for your computer's operating system (for 32-bit Windows systems, this file will be named "Celestia-win32-bin/1.6.0/celestia-win32-1.6.0.exe," or something similar). Click on the downloaded install file and accept all the defaults, especially the "associate Celestia with file extensions '.cel' and '.celx'" option. Since your program scripts for Celestia will use these file types, and no other program that you may have on your computer will know what a ".cel" extension means, you shouldn't have any problems with making Celestia the default application for those files.

In my next posting I'll guide you through the process of changing the existing Celestia "start' script so that it gives you or your child a personalized greeting. In the meantime, download the Celestia User's Guide (PDF or MS Word version) and play with Celestia so you can get to know its features. I'm sure you won't be disappointed.

Published by Wayne McDonald

I'm a retired Physician's Assistant with special qualifications in adult & pediatric echocardiography (heart ultrasound) and cardiovascular testing. I'm also working on my master's degree in history.  View profile

Who needs those fancy, overpriced, things like Adobe's Flash and Microsoft's Silverlight? As you will soon learn, you can create some rather remarkable computer graphics using free programs!

To comment, please sign in to your Yahoo! account, or sign up for a new account.