Computer program
Adapted from Wikipedia · Adventurer experience
A computer program is a sequence or set of instructions in a programming language for a computer to follow. It is one part of software, which also includes documentation and other non-physical pieces.
A computer program in its human-readable form is called source code. Computers can only run special machine instructions, so source code needs another program to change it into these instructions. This can be done using a compiler, which creates a file called an executable. Another way is to use an interpreter, which runs the source code directly but more slowly.
When you ask to run a program, the operating system puts it into memory and starts it. The computer's brain, called the central processing unit, then follows each instruction one by one. If you run source code instead, the interpreter handles the job of changing and running each statement as needed.
Example computer program
The "Hello, World!" program shows the basic rules of a programming language. The language BASIC, created in 1964, was made simple to learn. In BASIC, you don't need to set up variables before using them.
Here’s a simple program in BASIC that finds the average of a list of numbers:
10 INPUT "How many numbers to average?", A 20 FOR I = 1 TO A 30 INPUT "Enter number:", B 40 LET C = C + B 50 NEXT I 60 LET D = C/A 70 PRINT "The average is", D 80 END
After learning these basics, you can use more advanced languages to create bigger computer systems.
History
See also: Computer programming § History, Programmer § History, History of computing, History of programming languages, and History of software
Improvements in software development come from better computer hardware. As hardware has changed, the way people write programs has changed a lot.
Analytical Engine
In 1837, Charles Babbage tried to build a machine called the Analytical Engine. This machine used parts named after tools used in weaving. It had a place to store numbers and a place to work with them. People used special cards to tell the machine what to do, but it never worked perfectly.
Ada Lovelace helped Babbage describe how the Analytical Engine could work. She showed how it could calculate special numbers.
Universal Turing machine
In 1936, Alan Turing described a special machine called the Universal Turing machine. This machine could pretend to be any other machine by moving a tape back and forth. All modern computers can do what this machine could do.
ENIAC
The Electronic Numerical Integrator And Computer (ENIAC) was built between 1943 and 1945. It was a very early computer made with tiny parts called vacuum tubes. It was huge and could do many calculations very fast. People had to carefully set up ENIAC to tell it what to do.
Stored-program computers
Instead of using wires and switches, a stored-program computer keeps its instructions in its memory. This made programming faster and easier. Engineers Presper Eckert and John Mauchly came up with this idea. Later, John von Neumann helped explain how computers could work like the human brain. This idea became very important for future computers.
Very Large Scale Integration
A big step in software came with the invention of the Very Large Scale Integration (VLSI) circuit in 1964. This let engineers build tiny parts called transistors onto small pieces of material. These parts could be programmed to do different jobs. In 1969, engineer Ted Hoff came up with a smart way to build one chip that could run many different programs. This chip was the Intel 4004 microprocessor.
x86 series
In 1978, Intel made a new chip called the Intel 8086. When IBM used this chip in their first personal computer in 1981, computers became popular. The x86 series of chips made it so that programs written for older computers would still work on new ones.
Changing programming environment
As chips got better, the way people wrote programs changed too. Before the 1990s, programmers worked on special machines. Later, computers got screens and windows, making it easier to write and change programs. People still needed to write programs using special languages.
Programming paradigms and languages
Programming languages give us tools to create and share ideas in code. A good programming language should let us:
- Share ideas clearly in the code.
- Keep different ideas separate.
- Show how ideas are connected.
- Combine ideas easily.
- Write simple ideas in a simple way.
These tools can be grouped into different styles called programming paradigms. For example, we have:
- Procedural languages
- Functional languages
- Logical languages
Each style helps us create different kinds of programming languages.
A programming language is a set of special words, symbols, and rules that let programmers tell a computer what to do. These include:
- Keywords: Special words that give commands, like starting a new task or showing a result.
- Symbols: Characters that show actions, like adding numbers together.
- Identifiers: Names that programmers create for things like variables or actions the computer can do.
- Syntax Rules: The rules that tell us how to put these pieces together correctly.
Programming languages started with simple ways to talk to computers, like using numbers for commands. Over time, they became more advanced, letting programmers use words that are easier to remember. Today, there are many types of languages, each good for different kinds of tasks.
Generations of programming language
The way we write computer programs has changed a lot over time. The first programs were written using numbers to represent commands. Later, we learned to use words that were easier to remember. Now, we have languages that focus on what we want the computer to do, rather than how to do it step by step.
Imperative languages
Some languages tell the computer exactly what steps to take, one after another. These are called imperative languages. For example, we might tell the computer to create a name for a number, do some math, and then show the result.
Fortran
One of the earliest languages, Fortran, was made for scientific work. It let programmers work with lists of numbers and repeat actions many times.
COBOL
COBOL was made for business tasks. It used words that looked more like English, making it easier for people who weren’t computer experts to read.
Algol
Algol helped shape how we design languages today. It introduced clear rules and structures that made programs easier to understand.
Basic
Basic was created so that everyone, even those new to computers, could learn programming. It included simple commands that could create, show, and run programs right away.
C
C is a powerful language used to build operating systems and other important programs. It gives programmers control over where and how data is stored in the computer’s memory.
C++
C++ builds on C by adding ways to organize code into reusable pieces. This makes it easier to build large programs and share parts of them with others.
Declarative programming
Some languages focus on what we want the computer to do, rather than how to do it. These are called declarative languages. They are useful for tasks like working with databases or solving logic problems.
Lisp
Lisp is good for working with lists and is often used in areas like artificial intelligence.
ML
ML checks that data types match when they are used together, making programs more reliable.
Prolog
Prolog is used for solving logic problems. It lets programmers describe facts and rules, and then ask questions based on them.
Object-oriented programming
This way of programming groups things and actions together into containers called objects. It helps organize code, especially in large programs.
Syntax and semantics
Programming languages have rules for how to write code correctly (syntax) and what that code means (semantics). These rules help programmers write clear and working programs.
Software engineering and computer programming
Software engineering is a set of methods used to create quality computer programs. Computer programming is the act of writing or changing source code. In a planned setting, a systems analyst gathers details from managers about the organization's processes to automate them. This professional then makes a detailed plan for the new or changed system, similar to an architect's design.
The systems analyst aims to give the right information to the right person at the right time. Key points include making sure the information is useful for decisions, accurate, easy to understand, and delivered quickly when needed.
Balancing these goals with costs is important. Costs include development, making a system unique, hardware, and ongoing operating expenses. Using a systems development process helps avoid expensive mistakes found late in the project.
The waterfall model is one way to manage the development process. Its steps are: understanding the problem, exploring solutions, planning the best solution, building the solution, and ongoing maintenance to fix issues or make improvements.
A computer programmer writes or changes the source code based on the detailed plan. Large systems often need teams of programmers. While adding more programmers doesn’t always speed up the work, it can help if the work is split into clear parts that team members can share and discuss effectively.
Modular programming is a way to organize programs. It involves breaking a program into smaller parts called modules, each with its own task. This can make programs smaller, clearer, and easier to update. Each module has a name, a purpose, and a way it works. Good modules do one thing well and work well with others.
Functional categories
Computer programs can be grouped by what they do. The two main groups are application software and system software. System software includes the operating system, which connects the computer hardware with application software. The operating system makes it easier for application software to run. Both types of software use utility programs. At the hardware level, a microcode program manages the parts inside the central processing unit.
Application software
Main article: Application software
Application software helps people use computers for different tasks. Enterprise application software includes tools for accounting, managing people, and handling customers and suppliers. Examples are enterprise resource planning, customer relationship management, and supply chain management software.
Companies can build their own software or buy ready-made software. Building software allows exact features, but it takes time and resources. Ready-made software is cheaper and has been tested.
Operating system
See also: Operating system
An operating system is the basic software that helps a computer do its jobs, like running programs and controlling devices.
In the past, programmers wrote and ran programs one at a time. Now, operating systems manage many programs at once.
The operating system includes a part called the kernel that handles important tasks.
Utility program
A utility is a program that helps manage the computer and run software. Operating systems include utilities to check hardware. Utilities can make storage faster, watch for problems, shrink files, and organize data.
Microcode program
Main article: Microcode
A microcode program is the most basic set of instructions that tells the computer’s hardware what to do.
Microcode uses simple steps to move data and perform calculations inside the central processing unit.
Images
Related articles
This article is a child-friendly adaptation of the Wikipedia article on Computer program, available under CC BY-SA 4.0.
Images from Wikimedia Commons. Tap any image to view credits and license.
Safekipedia