![]() |
Welcome to Beginner Programming
|
| Course content | Enter chat room | Send email
to mailing list |
Check calendar |
JUST A REMINDER: for those of you who
have not yet received your confirmation that you have been
subscribed to the mailing list please contact
us by email immediately.
Hint:Once the programming tools have been downloaded these lessons are designed to be worked on offline. For those of you with dialup Internet access you might find it helpful to print off the page for each lesson and work from the printout. |
In this lesson you are going to learn how to download and setup the
programming tools that we will be using throughout this course.
| There are lots of different ways to program a computer. Computers are essentially very stupid. Even the fastest desktop computers can only understand a 100 or so commands in their microprocessor "brains". These commands in and of themselves are very simple things like "add these two numbers", "compare these two values" or "fetch this value from memory". How then could computers possibly appear to be so "smart"? | ![]() |
| The simple answer is that they are able to do lots of simple things extremely quickly. So quickly that the desktop computer that you are reading this on can easily do several million such commands every second. |
| While some people still occasionally program computers by setting up these millions of microprocessor commands directly by hand you can appreciate that writing something like a computer game or wordprocessing program in this manner would be extremely laborious and tedious. You see humans and computers don't speak the same language. | ![]() |
| To help with this immense problem associated with programming a computer people began to invent tools called "programming languages" and other tools to translate these "human programming languages" into the language that the microprocessor understands. There are many programming languages used to program modern computers. The one we have chosen to use for this course goes by the name Tcl/Tk which stands for "Tool Control Language with a Tool Kit". It is affectionately known by the 500000 or so users world wide by the name "tickle tee kay". |
Tcl/Tk is a very good language to start to learn about computer programming because:
The first step: downloading all our programming tools |
![]() |
Our first requirement in this lesson is going to be to download the
Tcl/Tk programming language and tools appropriate for the computer type
we are using. Tcl/Tk was originally written by
a gentleman named John Ousterhout while he was working at Sun Microsystems.
Today Tcl/Tk is maintained by a worldwide group of volunteers connected
via the Internet.
There are a couple of places that Tcl/Tk tools can be downloaded from the Internet. For those of you familiar with downloading and installing software from the Internet you can simply click on one of the links below: For all the others we suggest you read this installation section. |
Once you have downloaded and installed the software on your computer you might want to take a moment to create some aliases or shortcuts to the various tools we are going to be using and put those shortcut icons on your main computer desktop so that they are easily reached. The shortcuts we will be wanting are for the following items in the Tcl/Tk tool chest: Tcl Tk Help; Wish and Tclsh.
We will also be needing to create a shortcut to a text editor (for Windows
users it will be Wordpad) which we will be using in future lessons in this
course. For hints on how to create shortcuts
click
here.
The second step: writing our very first program |
The instructions below will show a screen print off an IBM PC (the screens on other systems will look very similar).
3) It is at this prompt we are going to key in our very first computer
program
| puts stdout "hi Harry" |
if you end the line by hitting the <enter> key you should see the string inside the "" appear on the line below
![]() |
Congratulations! You have just written your very first Tcl/Tk
program!
Feel free to experiment with the words inside the "" ... perhaps by inserting your name. Notice that you can use the "up arrow" key to recall the previous line and make changes by using the "left or right arrow" to edit the line. |
Explanation of the first program |
| command arg1 arg2 arg3 ... |
where arg stands for "argument". Why these parameters are called arguments is beyond me ... just think of them as those things that come after the command.
In our little programming example the command was: puts. This command is used to "put things" or "display things".
The first argument in our example was: stdout. This is short for "standard output". For us stdout will always mean the console screen. One thing you will find is that programmers in general are a lazy lot. The laziest programmers of the bunch are those who write operating systems or programming languages. That is why we end up often with cryptic commands like "puts" and clipped arguments like "stdout" ... it saves typing.
The second argument in our example was: "hi Harry".
The "" were used to group these words into a single argument ... otherwise
the wish program would have taken "hi" as the second argument and "Harry"
as the third. The puts command would only be expecting 2 arguments
and our little program would not have worked very well.
This concept of grouping is in almost every computer language ... they
don't always use "" as the group markers, however. The
series of words inside the "" are often referred to as a "string" ... which
is short for "string of characters".
Summary |
End of Lesson 1.