What Is Computer Programming
What Is Computer Programming
INTRODUCTION
Today, most people don't need to know how a computer works. Most people can simply turn on a
computer or a mobile phone and point at some little graphical object on the display, click a button or
swipe a finger or two, and the computer does something. An example would be to get weather
information from the net and display it. How to interact with a computer program is all the average
person needs to know.
But, since you are going to learn how to write computer programs, you need to know a little bit about
how a computer works. Your job will be to instruct the computer to do things.
proc-ess / Noun:
A series of actions or steps taken to achieve an end.
pro-ce-dure / Noun:
A series of actions conducted in a certain order.
al-go-rithm / Noun:
An ordered set of steps to solve a problem.
you said.
(James P. Hogan in "Mind Matters")
But, most of all, it can be lots of fun! An associate once said to me "I can't believe I'm paid so well
for something I love to do."
Just what do instructions a computer understands look like? And, what kinds of objects do the
instructions manipulate? By the end of this lesson you will be able to answer these questions. But
first let's try to write a program in the English language.
Before we see what a computer programming language looks like, let's use the English language to
describe how to do something as a series of steps. A common exercise that really gets you thinking
about what computer programming can be like is to describe a process you are familiar with.
Describe how to make a peanut butter and jelly sandwich.
Rather than write my own version of this exercise, I searched the Internet for the words "computer
programming sandwich" using Google. One of the hits returned
was http://teachers.net/lessons/posts/2166.html. At the link, Deb Sweeney (Tamaqua Area
Middle School, Tamaqua, PA) described the problem as:
When this exercise is directed by an experienced teacher or mentor it is excellent for demonstrating
how careful you need to be, how detailed you need to be, when writing a computer program. A
demonstration of this exercise is available on YouTube.
Programming in a natural language, say the full scope of the English language, seems like a very
difficult task. But, before moving on to languages we can write programs in today, I want to leave on
a high note. Click here to read about how Stephen Wolfram sees programming in a natural
language happening.
the power of Logo in his Computer Science Logo Style series of books. Volume 3: Beyond
Programming covers six college-level computer science topics with Logo.
Both Logo and Java have the same sort of stuff needed to write computer programs. Each has the
ability to manipulate objects (for example, arithmetic functions for working with numbers). Each lets
you compare objects and do a variety of things depending on the outcome of the comparison. Most
importantly, they let you define named procedures. Named procedures are lists of built-in
instructions and other named procedures. The abstraction of naming stuff lets you write programs in
a language you yourself define. This is the stuff that programming is really all about, as you will see.
Just to give you a feel for what programming is like in a high-level language, here's a program that
greets us, pretending to know English.
This is one of the simplest programs that can be written in most high-level languages. PRINT is
a command in Logo When it is performed, it takes whatever follows it and displays it. The "Hello
world" program is famous; checkout its description on Wikipedia by clicking here.
In addition to commands, Logo has operators that output some sort of result. Although it's a bit
contrived, here is a program that displays the product of a constant number (ten) and a random
number in the range of zero through fourteen.