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

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

Post on 02-Jan-2016

214 views

Category:

Documents

2 download

TRANSCRIPT

  • Computer Programs and Programming LanguagesWhat are low-level languages and high-level languages?High-level languageLow-level languageMachine-dependent runs only on one type of computerOften machine-independent can run on many different types of computersMachine and assembly languages are low-level

  • Generations of programming languages

  • The evolution of programming paradigmsImperative or ProceduralDeclarativeFunctionalObject Oriented

  • Low-Level LanguagesWhat is machine language?Only language computer directly recognizes

  • Low-Level LanguagesWhat is assembly language?Instructions made up of symbolic instruction codes, meaningful abbreviations and codesSource program contains code to be converted to machine language

  • Second-generation:Assembly languageA mnemonic system for representing programsMnemonic names for op-codesNames for all registersIdentifiers = descriptive names for memory locations, chosen by the programmer

  • Assembly language characteristicsOne-to-one correspondence between machine instructions and assembly instructionsProgrammer must think like the machineInherently machine-dependentConverted to machine language by a program called an assembler

  • Assembly language exampleMachine language 156C 166D 5056 30CE C000Assembly language LD R5, Price LD R6, ShippingCharge ADDI R0, R5 R6 ST R0, TotalCost HLT

  • Third generation languageUses high-level primitivesSimilar to our pseudocode in Chapter 5Machine independent (mostly)Examples: FORTRAN, COBOLEach primitive corresponds to a short sequence of machine language instructionsConverted to machine language by a program called a compiler

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

  • Procedural LanguagesWhat is a compiler?Program that converts entire source program into machine language before executing it

  • Procedural LanguagesWhat is an interpreter?Program that translates and executes one program code statement at a timeDoes not produce object program

  • Procedural LanguagesWhat is COBOL?Designed for business applicationsEnglish-like statements make code easy to read, write, and maintainCOmmon Business-Oriented Language

  • Procedural LanguagesWhat is C?Powerful language originally designed to write system softwareRequires professional programming skills

  • The composition of a typical imperative program or program unit

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

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

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

  • The flow of control involving a procedure

  • The procedure ProjectPopulation written in the programming language C

  • Executing the procedure Demo and passing parameters by value

  • Executing the procedure Demo and passing parameters by reference

  • The translation process

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

  • An object-oriented approach to the translation process

  • Object-Oriented Programming LanguagesWhat is an object-oriented programming (OOP) language?Used to implement object-oriented designMajor benefit is ability to reuse existing objectsEvent-drivenchecks for and responds to set of events

    C++ and Java are complete object-oriented languagesObject is item that contains data and procedures that act on dataEvent is action to which program responds

  • Object-Oriented Programming LanguagesWhat is C++?Includes all elements of C, plus additional features for working with object-oriented conceptsUsed to develop database and Web applications

  • Object-Oriented Programming LanguagesWhat is Java?Developed by Sun MicrosystemsSimilar to C++ but uses just-in-time (JIT) compiler to convert source code into machine code

  • Object-Oriented Programming LanguagesWhat is a visual programming language?Often used in RAD (rapid application development) environmentSometimes called fifth-generation languageProvides visual or graphical interface for creating source code

  • Object-Oriented Programming LanguagesWhat is Visual Studio .NET 2003?Suite of visual programming languages and RAD tools.NET is set of technologies that allows program to run on InternetVisual Basic .NET 2003 is used to build complex object-based programs

  • Objects and ClassesObject = active program unit containing both data and proceduresClass = a template for all objects of the same type

    An Object is often called an instance of the class.

  • Components of an objectInstance variable = variable within an objectMethod = function or procedure within an objectCan manipulate the objects instance variablesConstructor = special method to initialize a new object instance

  • The structure of a class describing a coinpublic 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); }}constructorInstance variableMethod

  • Nonprocedural Languages and Program Development ToolsWhat 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 databaseProgram Development Tools User-friendly programs designed to assist both programmers and users in creating programs

  • Nonprocedural Languages and Program Development ToolsWhat is RPG (Report Program Generator)?Nonprocedural language used for generating reports, performing computations, and updating files

  • Nonprocedural Languages and Program Development ToolsWhat is a fourth-generation language (4GL)?Nonprocedural language that allows access to data in databasePopular 4GL is SQL, query language that allows users to manage data in relational DBMS

  • Nonprocedural Languages and Program Development ToolsWhat is an application generator?Program that creates source code or machine code from specificationConsists of report writer, form, and menu generatorForm provides areas for entering data

  • Nonprocedural Languages and Program Development ToolsWhat is Visual Basic for Applications (VBA)?Macro programming languageMacroseries of statements used to automate tasks

Recommended

View more >