COMPUTER PROGRAMS. DEBUGGING OF A COMPUTER PROGRAM.
A computer program (often simply called a program) is an example of computer software that prescribes the actions that are to be carried out by a computer. Most programs consist of a loadable set of instructions which determines how the computer will react to user input when that program is running, i.e. when the instructions are 'loaded'.
Colloquially, the term program is often used interchangeably with software and software application.
Running a program
To run a program, the computer is initialized to a starting state by loading the program and perhaps the data and then some mechanism to begin is invoked. At the lowest level this is begun with a boot sequence.
In most computers, an operating system, such as Linux, loads and executes programs. In this context, a computer program refers to the individual executable image rather than all the programming currently running on the computer.
The Von Neumann architecture
In a computer with the most common Von Neumann architecture or Harvard architecture the program is loaded from a peripheral device of some kind, often a hard drive. In a machine following the Von Neumann architecture, the program is loaded into main memory. The instruction sequence is then executed in order until a jump or branch instruction is executed or an interrupt occurs. These instructions change the program counter.
A computer program consists of a set of instructions that the computer understands. A computer of this architecture without a program does absolutely nothing.
The instructions in a computer program are in machine code; they are usually originally written in a computer programming language, and translated to machine code using a computer program called a compiler or an interpreter. Sometimes the programming language is simply a set of abbreviations for the machine code instructions, called assembly language – in this case, a program called an assembler is used to make the translation.
Neural networks
In neural network computers, many computing units with many connections between these units work in concert to solve problems. While there are many types of architecture following this general model, the programming of these computers often consists of weights on each connection and thresholds within the nodes. As the machine "learns", these weights and thresholds change. In most neural networks, the learned state can be saved and later restored, making it a computer program.
Virtual machines
Many programs today run in a virtual machine. An idealized instruction set is created on top of the actual instruction set of the machines that run the program inside of the virtual machine. Many non Von Neumann machines exist only as simulations implemented as virtual machines and have not been constructed using hardware.
Programs and data
Some speakers distinguish between data that describes a computer program and data that does not describe a computer program; the former is called a "program", and the latter "data". However, this distinction between "program" and "data" is difficult to describe precisely, since all data can be regarded as implementing a program, depending on how it is processed.
Algorithms
An abstract program is sometimes called an algorithm, and these are the subject of various areas of mathematics – for example, algorithmic information theory studies the behaviour of idealized computers executing randomly generated computer programs.
Development
The iterative process of creating a computer program, and testing, analysing, and refining it is one definition of computer program "development". You are "developing" an appropriate solution that performs some task at hand, as you may not have produced the best solution (or even a good one) in your first attempt. Those who practice these iterative processes are called computer programmers; "developers", for short.
Another definition of "development", in the context of computer programming, is the process of fleshing out the work requirement(s) of a task that you want a computer to perform, creating an approach to accomplishing the task, deciding upon an implementation of that approach, expressing that approach in a way that a computer can understand, testing the suitability of the solution in either a simulated or real-world environment, and analysing the tests' results. Once again, iterations of the above are often required.
Computer programmers are not always required to perform all of the steps laid out above, but the more experience a programmer has the more involved in the initial steps of this procedure they typically become, and the more critical their skills become during the requirements-gathering and solution-design phases.
Debugging is a methodical process of finding and reducing the number of bugs, or defects, in a computer program or a piece of electronic hardware, thus making it behave as expected. Debugging tends to be harder when various subsystems are tightly coupled, as changes in one may cause bugs to emerge in another. Many books have been written about debugging, as it involves numerous aspects, including interactive debugging, control flow, integration testing, log files, monitoring (application, system), memory dumps, profiling, Statistical Process Control, and special design tactics to improve detection while simplifying changes.
Techniques
· Print debugging (or tracing) is the act of watching (live or recorded) trace statements, or print statements, that indicate the flow of execution of a process. This is sometimes called printf debugging, due to the use of the printf statement in C.
· Remote debugging is the process of debugging a program running on a system different than the debugger. To start remote debugging, a debugger connects to a remote system over a network. The debugger can then control the execution of the program on the remote system and retrieve information about its state.
· Post-mortem debugging is debugging of the program after it has already crashed. Related techniques often include various tracing techniques and/or analysis of memory dump (or core dump) of the crashed process. The dump of the process could be obtained automatically by the system, or by a programmer-inserted instruction, or manually by the interactive user.
· Delta Debugging - technique of automating test case simplification.
· Saff Squeeze - technique of isolating failure within the test using progressive in lining of parts of the failing test.