Presentation is loading. Please wait.

Presentation is loading. Please wait.

Copyright ©2005  Department of Computer & Information Science Introducing Programming.

Similar presentations


Presentation on theme: "Copyright ©2005  Department of Computer & Information Science Introducing Programming."— Presentation transcript:

1 Copyright ©2005  Department of Computer & Information Science Introducing Programming

2 Copyright ©2005  Department of Computer & Information Science Goals By the end of this lecture you should … Understand what a program is.Understand what a program is. Understand the differences among machine, assembly and high-level languagesUnderstand the differences among machine, assembly and high-level languages Understand how programming languages evolved.Understand how programming languages evolved.

3 Copyright ©2005  Department of Computer & Information Science What is a Program? Sets of instructions that get the computer to do somethingSets of instructions that get the computer to do something Programs may be a few lines or millions of lines of codePrograms may be a few lines or millions of lines of code All instructions are translated, eventually, to machine language.All instructions are translated, eventually, to machine language.

4 Copyright ©2005  Department of Computer & Information Science Programming Tasks Each program has three distinct purposes:Each program has three distinct purposes: 1.To gather input data. 2.To manipulate that data. 3.To give meaningful information back to the user (output).

5 Copyright ©2005  Department of Computer & Information Science Families of Languages 1.Machine Languages 2.Assembly Languages 3.High Level Languages: Procedural LanguagesProcedural Languages Object Oriented LanguagesObject Oriented Languages

6 Copyright ©2005  Department of Computer & Information Science 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.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“Native” language of computers

7 Copyright ©2005  Department of Computer & Information Science 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 "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.Assembly language commands are hard-coded into a specific processor.

8 Copyright ©2005  Department of Computer & Information Science High Level Languages High level language commands are very close, in syntax, to English, thus resulting in comparatively low error rate.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 …High level commands need to be translated to machine language using an interpreter or compiler …

9 Copyright ©2005  Department of Computer & Information Science Translation Using an Interpreter Interpreters translate code into machine language on a line-by-line basis.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.Typically, the translation speed is comparatively quicker than a compiler, but the execution speed is slower.

10 Copyright ©2005  Department of Computer & Information Science Translation Using a Compiler Compiler translate code into machine language by translating the entire program at once.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.Typically, the translation speed is comparatively slower than an interpreter, but the execution speed is much quicker.

11 Copyright ©2005  Department of Computer & Information Science Common Operations All types of high level languages share three families of operations:All types of high level languages share three families of operations: 1.Sequential Operations 2.Conditional Operations 3.Looping Operations

12 Copyright ©2005  Department of Computer & Information Science Sequential Operations Sequential operations are lines of code that execute in order.Sequential operations are lines of code that execute in order. Sequential operations are the default operations in programming.Sequential operations are the default operations in programming.

13 Copyright ©2005  Department of Computer & Information Science Conditional Operations Conditional operations (sometimes called decision structures) alter the course of a program based on the result of a TRUE/FALSE test.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.Programmers construct those tests using relational operators.

14 Copyright ©2005  Department of Computer & Information Science Looping Operations Looping operations are those structures in which code repeats until a given condition is met.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.Similar to conditional operations, programmers construct looping operations using relational operators.

15 Copyright ©2005  Department of Computer & Information Science Procedural Languages Early high-level languages were procedural in nature.Early high-level languages were procedural in nature. The focus of procedural languages was on structure.The focus of procedural languages was on structure. Examples include QuickBasic, Fortran, Pascal, and early versions of Visual Basic.Examples include QuickBasic, Fortran, Pascal, and early versions of Visual Basic.

16 Copyright ©2005  Department of Computer & Information Science Object-Oriented Languages Object-oriented languages are a more recent development, where the focus is on data (the “Primacy of Data”).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.In OOP, programmers include data and the ways to manipulate that data into one entity – the object. Examples include Java, C# and VB.NET.

17 Copyright ©2005  Department of Computer & Information Science Summary A program is a set of instructions to get your computer to do something.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.All programs have three basic types of instructions: (1) input instructions; (2) processing instructions and (3) output instructions.

18 Copyright ©2005  Department of Computer & Information Science Summary Machine languages are comprised of 1s and 0s and are the native languages of computers.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.Assembly language commands are tied to specific processors and represent shortcuts to machine language.

19 Copyright ©2005  Department of Computer & Information Science Summary High level languages are close, in syntax, to English. To translate high- level languages, we must use compilers or interpreters.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.All high-level languages share three basic groups of operations: sequential, conditional & looping.


Download ppt "Copyright ©2005  Department of Computer & Information Science Introducing Programming."

Similar presentations


Ads by Google