Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer Programs and Programming Languages What are low-level languages and high-level languages? High-level language Low-level language Machine-dependent.

Similar presentations


Presentation on theme: "Computer Programs and Programming Languages What are low-level languages and high-level languages? High-level language Low-level language Machine-dependent."— Presentation transcript:

1 Computer Programs and Programming Languages What are low-level languages and high-level languages? High-level language Low-level language Machine-dependent runs only on one type of computer Often machine-independent can run on many different types of computers Machine and assembly languages are low-level

2 Generations of programming languages

3 The evolution of programming paradigms Imperative or Procedural Declarative Functional Object Oriented

4 Low-Level Languages What is machine language?  Only language computer directly recognizes

5 Low-Level Languages What is assembly language?  Instructions made up of symbolic instruction codes, meaningful abbreviations and codes  Source program contains code to be converted to machine language

6 Second-generation: Assembly language A mnemonic system for representing programs  Mnemonic names for op-codes  Names for all registers  Identifiers = descriptive names for memory locations, chosen by the programmer

7 Assembly language characteristics One-to-one correspondence between machine instructions and assembly instructions  Programmer must think like the machine Inherently machine-dependent Converted to machine language by a program called an assembler

8 Assembly language example Machine language 156C 166D 5056 30CE C000 Assembly language LD R5, Price LD R6, ShippingCharge ADDI R0, R5 R6 ST R0, TotalCost HLT

9 Third generation language Uses high-level primitives  Similar to our pseudocode in Chapter 5 Machine independent (mostly) Examples: FORTRAN, COBOL Each primitive corresponds to a short sequence of machine language instructions Converted to machine language by a program called a compiler

10 Procedural Languages What is a procedural language? Most widely used are BASIC, COBOL, and C Uses series of English-like words to write instructions third-generation language (3GL) Often called third-generation language (3GL) Programmer writes instructions that tell computer what to accomplish and how to do it

11 Procedural Languages What is a compiler?  Program that converts entire source program into machine language before executing it

12 Procedural Languages What is an interpreter?  Program that translates and executes one program code statement at a time  Does not produce object program

13 Procedural Languages What is COBOL?  Designed for business applications  English-like statements make code easy to read, write, and maintain  COmmon Business-Oriented Language

14 Procedural Languages What is C?  Powerful language originally designed to write system software  Requires professional programming skills

15 The composition of a typical imperative program or program unit

16 Variable declarations in C, C++, C#, and Java

17 Control structures and their representations in C, C++, C#, and Java

18 The for loop structure and its representation in C++, C#, and Java

19 The flow of control involving a procedure

20 The procedure ProjectPopulation written in the programming language C

21 Executing the procedure Demo and passing parameters by value

22 Executing the procedure Demo and passing parameters by reference

23 The translation process

24 A syntax diagram of our if-then-else pseudocode statement

25 An object-oriented approach to the translation process

26 Object-Oriented Programming Languages What is an object-oriented programming (OOP) language? Used to implement object-oriented design Major benefit is ability to reuse existing objects Event-driven— checks for and responds to set of events C++ and Java are complete object-oriented languages Object is item that contains data and procedures that act on data Event is action to which program responds

27 Object-Oriented Programming Languages What is C++?  Includes all elements of C, plus additional features for working with object-oriented concepts  Used to develop database and Web applications

28 Object-Oriented Programming Languages What is Java?  Developed by Sun Microsystems  Similar to C++ but uses just-in-time (JIT) compiler to convert source code into machine code

29 Object-Oriented Programming Languages What is a visual programming language? Programmer writes and implements program in segments Visual programming environment (VPE) allows developers to drag and drop objects to build programs Often used in RAD (rapid application development) environment Sometimes called fifth-generation language Provides visual or graphical interface for creating source code

30 Object-Oriented Programming Languages What is Visual Studio.NET 2003?  Suite of visual programming languages and RAD tools .NET is set of technologies that allows program to run on Internet  Visual Basic.NET 2003 is used to build complex object-based programs Step 1. The programmer designs the user interface. Step 2. The programmer assigns properties to each object on the form. Step 4. The programmer tests the application. Step 3. The programmer writes code to define the action of each command button.

31 Objects and Classes Object = active program unit containing both data and procedures Class = a template for all objects of the same type An Object is often called an instance of the class.

32 Components of an object Instance variable = variable within an object Method = function or procedure within an object  Can manipulate the object’s instance variables Constructor = special method to initialize a new object instance

33 The structure of a class describing a coin public class Coin { private final int HEADS = 0; private final int TAILS = 1; private int face; // Sets up the coin by flipping it initially. public Coin () { flip(); } // Flips the coin by randomly choosing a face value. public void flip () { face = (int) (Math.random() * 2); } constructor Instance variable Method

34 Nonprocedural Languages and Program Development Tools  What are nonprocedural languages and program development tools? Nonprocedural Language The programmer writes English- like instructions or interacts with a visual environment to retrieve data from files or a database Program Development Tools User-friendly programs designed to assist both programmers and users in creating programs

35 Nonprocedural Languages and Program Development Tools What is RPG (Report Program Generator)?  Nonprocedural language used for generating reports, performing computations, and updating files

36 Nonprocedural Languages and Program Development Tools What is a fourth-generation language (4GL)?  Nonprocedural language that allows access to data in database  Popular 4GL is SQL, query language that allows users to manage data in relational DBMS

37 Nonprocedural Languages and Program Development Tools What is an application generator?  Program that creates source code or machine code from specification  Consists of report writer, form, and menu generator  Form provides areas for entering data

38 Nonprocedural Languages and Program Development Tools What is Visual Basic for Applications (VBA)?  Macro programming language  Macro—series of statements used to automate tasks


Download ppt "Computer Programs and Programming Languages What are low-level languages and high-level languages? High-level language Low-level language Machine-dependent."

Similar presentations


Ads by Google