An Introduction to Computer Programming
Programming is the act of writing commands that make the computer do something meaningful. It is an intensely innovative activity, involving factors of art, engineering, and technological know-how. Excellent applications are written to be executed correctly by computers, but also to be examine and understood by people. The quality applications are pleasant in ways much like the great architecture, elegant in both form and feature.
For programming computers, we need easy, unambiguous, ordinary, and reasonable languages with effective method of abstraction. A programming language is a language that is designed to be read and written by human beings to create programming applications that can be carried out by using computers.
A compiler is a computer software that generates other software. It translates an input program written in a high-level language that is less complicated for people to create right into a software in a machine-level language that can be run by using the computer. Grace Hopper developed the first compilers in the 1952.
An alternative to a compiler is an interpreter. An interpreter is a tool that interprets between a higher-level language and a lower-level language, however wherein a compiler translates a whole program at once and produces a machine language software that can be run immediately, an interpreter translates the program a small piece at a time whilst it is running. This has the benefit that we do no longer need to run a separate tool to compile a software before running it; we can definitely enter our program into the interpreter and run it proper away. This makes it easy to make small adjustments to a program and try it once more, and to study the state of our program as it is running. One drawback of the usage of an interpreter rather than a compiler is that due to the fact the translation is occurring at the same time as the program is running, the program executes slower than a compiled program.
In practice, a programming language defines the grammar and evaluation policies so that it will be used to interpret your program.
- Expression. An expression is a syntactic element that has a value. The act of figuring out the value related to an expression is known as evaluation. Expressions can be primitives.
- Primitives. As with natural languages, primitives are the smallest units of meaning. Consequently, the value of a primitive is its pre-defined meaning (like Numbers, Booleans, etc).
- Procedures. Procedures are just like mathematical functions in that they offer a mapping among inputs and outputs, however they differ from mathematical functions in some ways.
- Decisions. To make more useful procedures, we need the operations taken to rely on the input values. As an example, we may need a procedure that takes two numbers as inputs and evaluates to the greater of the 2 inputs. To define this kind of procedure we need a way of making a decision.
We simply need to combine those constructs in more complex ways to carry out extra interesting computations.
The strength of computers comes from their programmability. General computer systems can be programmed to execute any algorithm. The Turing machine model offers an basic, abstract model of a computing device. Every algorithm can be implemented as a Turing machine, and a Turing machine can simulate every other reasonable computer.