Programming, or scripting, is the act of creating instructions that someone or something will carry out. You can program robots, computers, media players, consumer devices, factory machinery, etc.
A programming language is a language for writing programs in. An interpreter for a programming language runs programs written in that language. Some languages don't have interpreters, so you have to use a compiler to translate programs written in that language into another language that does have an interpreter.
An algorithm is the (abstract) set of instructions for solving a problem. Technically each instruction has to take (in principle) a finite time to carry out and the entire instruction set must always terminate. An algorithm doesn't get carried out on a machine, but a program does.
There's a tradition that the first program you write when you are learning a new language is one that displays the message
hello, world
on some output device. Obviously you can't necessarily to this on a language for programming VCRs or the brakes or suspension in your car, but you can do this for languages that let you write programs on a desktop or laptop computer.
Here is the hello, world program in some popular computer languages:
Python
print "hello, world"
Ruby
puts "hello, world"
Perl
print "hello, world\n"
JavaScript
In a pop-up window:
alert("hello, world");
In the browser page:
document.write("hello, world");
Standard ML
print("hello, world\n");
C
#include <stdio.h>
int main() {
printf("hello, world");
return 0;
}
C++
#include <iostream>
int main() {
std::cout << "hello, world";
return 0;
}
C#
using System;
class Greeter
{
public static void Main()
{
Console.WriteLine("hello, world");
}
}
Java
public class Greeter {
public static void main(String[] args) {
System.out.println("hello, world");
}
}
ActionScript
To the Flash console:
trace("hello, world");
As a Flash Movie:
class Test {
static function main(mc) {
mc.createTextField("message", 1, 0, 0, 100, 100);
mc.message.text = "Hello World";
}
}
HTML
hello, world
XHTML
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>A Greeting</title>
</head>
<body>
<p>hello, world</p>
</body>
</html>
Ada
with Ada.Text_IO;
use Ada.Text_IO;
procedure Hello is
begin
Put_Line ("hello, world");
end Hello;
Lisp
(print "hello, world")
Scheme
(display "hello, world")
Smalltalk
Transcript show: 'hello, world'.
PHP
echo("hello, world\n")
HQ9+
H
You might also be interested in Wikipedia's Hello World Program article as well as some on-line collections of Hello World programs, including:
Here are some collections that include Hello World programs
How do you write, and run, programs? That depends on a lot of things...
David Eck's first chapter in his book on programming describes the "mental landscape" for learning to program as consisting of:
Skim (or read) the chapter (but don't try to memorize all facts), and do the exercises.
Here are four kinds of computer programs (there are others — it all depends on what you mean by a kind of program):
| Type | Description | Examples |
|---|---|---|
| Local Application | A standalone program designed for user interaction. Runs directly on the user's computer. | iTunes, Firefox, TextEdit, notepad, Adium, Terminal, cmd, iChat, Pidgin, OpenOffice, Word, Google Earth, javac, java, Photoshop, etc. |
| Daemon | A program providing, usually, a system service, that is always running in the background. | Device drivers, web servers, database servers, printer spoolers, updaters, etc. |
| Web Application (Webapp) |
A full-fledged program designed that interacts with a user through a variety of web pages, within a browser. | GMail, Yahoo Finance, Your bank's online access, PROWL. |
| Applet | A small program running inside of another (usually a web browser). | There is a Java applet on this page (as well as many of the pages of the course textbook), and a Flash movie on this page, and all over youtube, too. |
On virtually every computer system in the planet, data, and programs, are stored in files. A computer's file system is its mechanism for storing and accessing these files. You can't be an effective programmer without understanding the basics of a file system.
So.... Here's where we spend one or two whole classes taking a tour of the file system. There are no online notes for this tour; we will wing it in class. We will cover at least these topics, plus whatever else comes up: