190 likes | 195 Views
In this lecture, you will learn what a program is, the differences between machine, assembly, and high-level languages, and how programming languages have evolved over time.
E N D
Goals By the end of this lecture you should … • Understand what a program is. • Understand the differences among machine, assembly and high-level languages • Understand how programming languages evolved.
What is a Program? • Sets of instructions that get the computer to do something • Programs may be a few lines or millions of lines of code • All instructions are translated, eventually, to machine language.
Programming Tasks • Each program has three distinct purposes: • To gather input data. • To manipulate that data. • To give meaningful information back to the user (output).
Families of Languages • Machine Languages • Assembly Languages • High Level Languages: • Procedural Languages • Object Oriented Languages
Machine Languages • Machine language commands are comprised of binary digits (bits – 1s and 0s) which are translated to electrical impulses that get the computer to do something. • “Native” language of computers
Assembly Languages • Assembly language commands are "shortcuts" for machine code that represent some basic commands. These commands still need to be translated to machine language. • Assembly language commands are hard-coded into a specific processor.
High Level Languages • High level language commands are very close, in syntax, to English, thus resulting in comparatively low error rate. • High level commands need to be translated to machine language using an interpreter or compiler …
Translation Using an Interpreter • Interpreters translate code into machine language on a line-by-line basis. • Typically, the translation speed is comparatively quicker than a compiler, but the execution speed is slower.
Translation Using a Compiler • Compiler translate code into machine language by translating the entire program at once. • Typically, the translation speed is comparatively slower than an interpreter, but the execution speed is much quicker.
Common Operations • All types of high level languages share three families of operations: • Sequential Operations • Conditional Operations • Looping Operations
Sequential Operations • Sequential operations are lines of code that execute in order. • Sequential operations are the default operations in programming.
Conditional Operations • Conditional operations (sometimes called decision structures) alter the course of a program based on the result of a TRUE/FALSE test. • Programmers construct those tests using relational operators.
Looping Operations • Looping operations are those structures in which code repeats until a given condition is met. • Similar to conditional operations, programmers construct looping operations using relational operators.
Procedural Languages • Early high-level languages were procedural in nature. • The focus of procedural languages was on structure. • Examples include QuickBasic, Fortran, Pascal, and early versions of Visual Basic.
Object-Oriented Languages • Object-oriented languages are a more recent development, where the focus is on data (the “Primacy of Data”). • In OOP, programmers include data and the ways to manipulate that data into one entity – the object. Examples include Java, C# and VB.NET.
Summary • A program is a set of instructions to get your computer to do something. • All programs have three basic types of instructions: (1) input instructions; (2) processing instructions and (3) output instructions.
Summary • Machine languages are comprised of 1s and 0s and are the native languages of computers. • Assembly language commands are tied to specific processors and represent shortcuts to machine language.
Summary • High level languages are close, in syntax, to English. To translate high-level languages, we must use compilers or interpreters. • All high-level languages share three basic groups of operations: sequential, conditional & looping.