Computer programming
The composition of instructions for computers to follow.
Computer programming, often called coding, is the act of putting together ordered sets of commands—referred to as programs—that a computer can execute to get work done. This work includes designing and putting into practice algorithms, which are step-by-step recipes for procedures, by writing code in one or more programming languages. Programmers usually work with high-level programming languages, which are easier for people to understand compared to machine code, the kind of instructions that a computer's central processing unit runs directly. Being good at programming typically calls for know-how in several areas: understanding the field the program will be used in, the details of programming languages and common code libraries, specialized algorithms, and formal logic.
Alongside the core writing of code, there are other tasks that go with programming. These include figuring out what a program needs to do, testing it, debugging (which means finding and fixing errors), setting up build systems, and handling the things that come out of the process, like the final machine code. While some people lump all these activities under "programming," the term "software development" is often used for the bigger picture—with "programming," "implementation," and "coding" kept for the actual writing and editing of code. Sometimes software development is called software engineering, especially when it uses formal methods or follows a structured engineering design process.
**History**
Devices that could be programmed have been around for hundreds of years. In the 9th century, the Persian Banu Musa brothers described a programmable music player that worked automatically, a flute-like device, in their book *Book of Ingenious Devices*. Later, in 1206, the Arab engineer Al-Jazari came up with a programmable drum machine, a musical automaton that could play different rhythms and patterns using pegs and cams. By 1801, the Jacquard loom could create completely different fabric patterns just by changing its "program"—a set of pasteboard cards with holes punched in them.
Code-breaking methods also go back centuries. In the 9th century, the Arab mathematician Al-Kindi wrote about a cryptographic algorithm for decoding encrypted messages in his work *A Manuscript on Deciphering Cryptographic Messages*. He gave the earliest known description of cryptanalysis using frequency analysis, which is the first recorded code-breaking algorithm.
The first computer program is usually dated to 1843, when mathematician Ada Lovelace published an algorithm to calculate a sequence of Bernoulli numbers. This algorithm was meant to run on Charles Babbage's Analytical Engine. It appeared in notes she wrote for a translation of Luigi Federico Menabrea's paper on the engine, and her correspondence with Babbage shows she was the main thinker behind it. However, Babbage himself had written a program for the Analytical Engine back in 1837. Lovelace was also the first person to see that the Analytical Engine could be used for more than just math.
In the 1880s, Herman Hollerith came up with the idea of storing data in a form that machines could read. Later, a control panel (or plug board) added to his 1906 Type I Tabulator let it be programmed for different jobs. By the late 1940s, machines like the IBM 602 and IBM 604 were programmed with control panels in the same way, as were the earliest electronic computers. But with the stored-program computer concept introduced in 1949, both programs and data were kept and handled the same way in computer memory. Hands-on programming courses that mix hardware and software have been shown to help first-year engineering students stay engaged and remember what they learn.
**Machine Language**
Early programs were written in machine code, using the instruction set of a specific machine, often in binary notation. Soon after, assembly languages came along, letting programmers write instructions in a text format (for example, ADD X, TOTAL) using abbreviations for operation codes and meaningful names for memory addresses. But because an assembly language is basically just another way to write a machine language, two machines with different instruction sets also have different assembly languages.
**Compiler Languages**
High-level languages made programming simpler and easier to understand, and less tied to the specific hardware. The first tool related to compilers was the A-0 System, created in 1952 by Grace Hopper, who also came up with the term "compiler." FORTRAN, the first widely used high-level language with a working implementation, appeared in 1957. Many other languages soon followed—notably COBOL for business data processing and Lisp for computer research. These compiled languages let programmers write code in terms that are richer in syntax and better at abstracting away details, making it easier to target different machine instruction sets through compilation rules and heuristics. Compilers used the power of computers to make programming easier by letting programmers specify calculations by entering a formula using infix notation.
**Source Code Entry**
Programs were mostly entered using punched cards or paper tape. By the late 1960s, data storage devices and computer terminals became cheap enough that programs could be created by typing directly into the computers. Text editors were also developed, making changes and corrections much easier than with punched cards.
**Modern Programming**
**Quality Requirements**
No matter what approach is used to develop a program, the final product must meet some basic properties. Among the most important are:
- **Reliability:** how often the program's results are correct. This depends on whether the algorithms are conceptually right and on minimizing programming mistakes, such as errors in managing resources (like buffer overflows and race conditions) and logic errors (like dividing by zero or off-by-one mistakes). - **Robustness:** how well a program handles unexpected or incorrect inputs without crashing or producing nonsense.
- field
- Computer science
- known_for
- Creation of programs that direct computers to perform tasks
Lore & Background
Programmable devices have existed for centuries. As early as the 9th century, a programmable music sequencer was invented by the Persian Banu Musa brothers, who described an automated mechanical flute player. Code-breaking algorithms also date to the 9th century, when Al-Kindi described cryptanalysis by frequency analysis. In the 1880s, Herman Hollerith invented machine-readable data storage, and later control panels allowed programming of tabulators. The stored-program computer concept introduced in 1949 allowed programs and data to be stored in the same memory. Machine code was the language of early programs, soon supplemented by assembly languages. The first compiler-related tool, the A-0 System, was developed in 1952 by Grace Hopper, who coined the term 'compiler'. FORTRAN, the first widely used high-level language with a functional implementation, appeared in 1957, followed by COBOL and Lisp. Programs were mostly entered via punched cards or paper tape until the late 1960s, when terminals and text editors became common.
Reader's Guide
Computer programming is significant as the fundamental activity that enables computers to perform tasks across all domains. Its history spans centuries of programmable devices, from mechanical automata to modern software. The development of high-level languages and compilers made programming more accessible and less tied to specific hardware, allowing for greater abstraction and portability. Key quality requirements for programs include reliability, robustness, usability, portability, maintainability, and efficiency. Readability of source code is crucial because programmers spend most of their time reading and modifying existing code rather than writing new code. The field continues to evolve, with automated tests and fitness functions helping to maintain quality attributes. Programming's legacy includes enabling everything from simple calculations to complex systems that underpin modern society, with its methods and tools constantly adapting to new challenges and technologies.
Did You Know?
- The first compiler-related tool, the A-0 System, was developed in 1952 by Grace Hopper, who also coined the term 'compiler'.
- In the 9th century, the Persian Banu Musa brothers described an automated mechanical flute player, an early programmable device.
- Readability of source code is important because programmers spend the majority of their time reading and modifying existing code, not writing new code.
More in Computing & Digital 1-24
Spotted an error? Know more?
This is a living reference — every entry is fact-audited, and reader corrections feed straight into our audit queue. Suggest an edit · See this site's audit record
