Wikijunior:Programming for Kids/What is Programming?

From Wikibooks, open books for an open world
Jump to navigation Jump to search
Wikijunior:Programming for Kids
What is Programming? Knowing Your Problem

How do computers work?[edit | edit source]

A computer is a machine that receives some data which it then processes and outputs. You have your own computer called a brain. When a teacher asks you to calculate 4 x 4 this is known as data. At some stage you will have been taught to process this data by adding 4 + 4 + 4 + 4 together. The answer you give is the output of your calculation.

In order to process data, a computer must receive instructions or commands. However, it would be unfeasible to make the user input commands for everything. Even something as simple as saving a document or opening a browser takes thousands or even millions of lines of code. In response to this problem, stored programs have been invented.

Ada Lovelace

A stored program is a series of instructions stored in a computer's memory. When the program is used, the computer will then fetch each instruction from the stored program and execute it. This process was imagined by mathematician Charles Babbage and later implemented by Ada Lovelace, who was Lord Byron's daughter.

High-level programming languages compile to low-level programming languages.

What are high-level and low-level programming languages?[edit | edit source]

A low-level programming language is one that is made to be easily understood by the computer. They include machine code and assembly language, both of which instruct computer hardware components to carry out instructions directly. However, low-level programming languages are difficult to learn and time-consuming to code.

A high-level programming language is made to help human programmers communicate easily to the computer. These languages can have gentler learning curves and be very powerful. Good examples of high-level programming languages include C, Java, LISP, Smalltalk, PASCAL, LOGO, Visual Basic and Python. These languages are usually compiled, or converted into low-level programming languages so that they can be executed directly. The person who invented the concept of a compiler was Grace Hopper, sometimes called "Amazing Grace".

However, some programming languages are designed to be interpreted by another computer application, such as JavaScript, which is interpreted by web browsers, and PHP, which is interpreted by web servers.

In principle, it's also possible to build a computer to directly understand a high-level programming language, so that in a sense that language is the "assembly language" of the computer. In practice, though, this is more difficult for the computer, so it's still considered a high-level language — the language is made for the human programmer and the computer has to try to catch up.

Some high-level programming languages are designed for a specific purpose. JavaScript is for creating dynamic web pages, while ActionScript is responsible for Flash applications. Others are designed for general purpose. For example, Java can create a large number of programs ranging from games to physics simulations, from simple console programs to large-scale commercial software.

What is programming really like?[edit | edit source]

Programming is a form of problem-solving. It involves locating your problem, analysing it, designing a framework for the solution, writing the actual code for it, testing your algorithm, and, finally, writing a documentation for it. In this book, we will go through the process one by one. Let's start!