Presentation on theme: "Agenda Definitions Evolution of Programming Languages and Personal Computers The C Language."— Presentation transcript:
Agenda Definitions Evolution of Programming Languages and Personal Computers The C Language
Definitions Programming Language Computer Program Machine Language Compiler Interpreter Source code Object code The C language Programming Paradigm Procedural Programming Object-Oriented Programming Algorithm
Programming Language A vocabulary and set of grammatical rules for instructing a computer to perform specific tasks. The term programming language usually refers to high-level languages, such as BASIC, C, C++, COBOL, FORTRAN, Ada, and Pascal. Each language has a unique set of keywords (words that it understands) and a special syntax for organizing program instructions. Lying above high-level languages are languages called fourth-generation languages (usually abbreviated 4GL). 4GLs represent the class of computer languages closest to human languages.
Computer Program An organized list of instructions that, when executed, causes the computer to behave/operate in a predetermined manner. Without programs, computers are useless. A program is like a recipe. It contains a list of ingredients (called variables) and a list of directions (called statements) that tell the computer what to do with the variables. The variables can represent numeric data, text, or graphical images. Eventually, every program must be translated into a machine language that the computer can understand. This translation is performed by compilers, interpreters, and assemblers. When you buy software, you normally buy an executable version of a program. This means that the program is already in machine language -- it has already been compiled and assembled and is ready to execute.
Machine Language The lowest-level programming language (except for computers that utilize programmable microcode). Machine languages are the only languages understood by computers. While easily understood by computers, machine languages are almost impossible for humans to use because they consist entirely of numbers. An assembly language contains the same instructions as a machine language, but the instructions and variables have names instead of being just numbers. Assembly language programs are translated into machine language by a program called an assembler. Every CPU has its own unique machine language. Programs must be rewritten or recompiled, therefore, to run on different types of computers.
Compiler A program that translates source code into object code. The compiler derives its name from the way it works, looking at the entire piece of source code and collecting and reorganizing the instructions. Compilers require some time before an executable program emerges. However, programs produced by compilers run much faster than the same programs executed by an interpreter. Every high-level programming language (except strictly interpretive languages) comes with a compiler. In effect, the compiler is the language, because it defines which instructions are acceptable. Because compilers translate source code into object code, which is unique for each type of computer, many compilers are available for the same language.
Interpreter A program that executes instructions written in a high- level language. An interpreter translates high-level instructions into an intermediate form, which it then executes. In contrast, a compiler translates high- level instructions directly into machine language. Compiled programs generally run faster than interpreted programs. The advantage of an interpreter, however, is that it does not need to go through the compilation stage during which machine instructions are generated. This process can be time-consuming if the program is long. The interpreter, on the other hand, can immediately execute high-level programs. Both interpreters and compilers are available for most high-level languages. However, BASIC and LISP are especially designed to be executed by an interpreter. In addition, page description languages, such as PostScript, use an interpreter. Every PostScript printer, for example, has a built-in interpreter that executes PostScript instructions.
Source Code Program instructions in their original form. The word source differentiates code from various other forms that it can have (for example, object code and executable code). Initially, a programmer writes a program in a particular programming language. This form of the program is called the source program, or more generically, source code. Source code is the only format that is readable by humans. When you purchase programs, you usually receive them in their machine- language format. This means that you can execute them directly, but you cannot read or modify them. Some software manufacturers provide source code, but this is useful only if you are an experienced programmer.
Object Code The code produced by a compiler. To get from source code to machine language, the programs must be transformed by a compiler. The compiler produces an intermediary form called object code. Object code is often the same as or similar to a computer's machine language. The final step in producing an executable program is to transform the object code into machine language, if it is not already in this form. This can be done by a number of different types of programs, called assemblers, binders, linkers, and loaders.
The C Language A high-level programming language developed by Dennis Ritchie at Bell Labs in the mid 1970s. Although originally designed as a systems programming language, C has proved to be a powerful and flexible language that can be used for a variety of applications, from business programs to engineering. The first major program written in C was the UNIX operating system, and for many years C was considered to be inextricably linked with UNIX. Now, however, C is an important language independent of UNIX. Although it is a high-level language, C is much closer to assembly language than are most other high-level languages. This closeness to the underlying machine language allows C programmers to write very efficient code. The low-level nature of C, however, can make the language difficult to use for some types of applications.
Programming Paradigm A programming paradigm is a paradigmatic style of programming. The programming paradigm involved provides (and determines) the view that the programmer has of the execution of the program: in the case of object-oriented programming, for instance, the programmer sees the execution of the program as a collection of dialoguing objects, while under procedural programming the execution is seen as a structured sequence of procedure calls.
Procedural Programming A programming paradigm based upon the concept of the modularity and scope of program code (i.e., the data viewing range of an executable code statement). A main procedural program is composed of one or more modules, either coded by the same programmer or pre-coded by someone else and provided in a code library. Each module is composed of one or more subprograms (which may consist of procedures, functions, subroutines or methods, depending on programming language). It is possible for a procedural program to have multiple levels or scopes, with subprograms defined inside other subprograms. Each scope can contain names which cannot be seen in outer scopes. Procedural programming offers many benefits over simple sequential programming since procedural code: –is easier to read and more maintainable –is more flexible –facilitates the practice of good program design
Object-Oriented Programming A computer programming paradigm that emphasizes the following aspects: –Objects - packaging data and functionality together into units within a running computer program. –Abstraction - The ability for a program to ignore some aspects of the information it's manipulating. –Encapsulation - Also called information hiding: Ensures that objects cannot change the internal state of other objects in unexpected ways; only the object's own internal methods are allowed to access its state. Each type of object exposes an interface to other objects that specifies how other objects may interact with it. –Polymorphism - References to and collections of objects may refer to objects of different types, and invoking an operation on a reference will produce a different result depending on the actual type of the referent. –Inheritance - Permitting objects to be defined and created as specialized types of already-existing objects - these can share (and extend) their features without having to reimplement them.
Algorithm A precise set of rules or sequence of instructions specifying how to solve a given problem. A procedure that transforms a given input into a determined output.