chapter 1: introduction to programming language

17
CSC425 - Introduction To Computer Programming 1

Upload: clarke-miranda

Post on 04-Jan-2016

105 views

Category:

Documents


0 download

DESCRIPTION

Chapter 1: Introduction to Programming Language. Generation Of Programming Languages. Programming Languages.  A set of rules that telling a computer what to do.  There are over 200 programming languages in the world.  Helps we understanding computer. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Chapter 1: Introduction to  Programming Language

CSC425 - Introduction To Computer Programming 1

Page 2: Chapter 1: Introduction to  Programming Language

CSC425 - Introduction To Computer Programming 2

Generation Of Generation Of Programming LanguagesProgramming Languages

A set of rules that telling a computer what to do. There are over 200 programming languages in the

world. Helps we understanding computer. We need programming languages

as an alternative to a manual system diadvantages of manual system:

slow repetitive incorrect data/information

Programming LanguagesProgramming Languages

Page 3: Chapter 1: Introduction to  Programming Language

CSC425 - Introduction To Computer Programming 3

2 types : Structured and object - oriented.

Programming ApproachProgramming Approach

1.1. Structured Programming Structured Programming

A methodology in which all program logic is constructed from a combination of three control structures : sequence, selection and repetition (loop)

Program logic is description of the step-by step procedures for a module.

Page 4: Chapter 1: Introduction to  Programming Language

CSC425 - Introduction To Computer Programming 4

2.2. Object-oriented programming Object-oriented programming

Packaged the data and procedure into a single

unit called an object which can be reused and

modified.

Object have classes and subclasses.

Each class contains the characteristics that are

unique to objects of that class.

data - called attributes or variablesprocedure - the instructions that tell the data what to do

- called operations or method.

Page 5: Chapter 1: Introduction to  Programming Language

CSC425 - Introduction To Computer Programming 5

Evaluation OfEvaluation Of

3GL

4GL

5GL

PProgramming Languagesrogramming Languages

Machine LanguageMachine Language

Assembly LanguageAssembly Language

High-Level LanguageHigh-Level Language

Page 6: Chapter 1: Introduction to  Programming Language

CSC425 - Introduction To Computer Programming 6

Lowest level of language

Represent data and program instructions as

1s and 0s

The only language that computer directly

understand.

(Do not require translator)

Not convenient to read and use.

First generation language

Machine - dependent

Machine Language (1940s – 1950s)Machine Language (1940s – 1950s)

Page 7: Chapter 1: Introduction to  Programming Language

CSC425 - Introduction To Computer Programming 7

Second generation language Developed to replace 1s and 0s use in machine

language. Use mnemonic codes : abbreviations that easy

to rememberA for AddA for AddC for CompareC for CompareMP for MultiplyMP for Multiply

Requires a translator to translate the assembly program into machine language ( assembler).

Difficult to learn Machine-dependent

Assembly Language (1950s – 1960s)Assembly Language (1950s – 1960s)

Page 8: Chapter 1: Introduction to  Programming Language

CSC425 - Introduction To Computer Programming 8

Made easy for programmer to develop and

maintain program

Machine- independent

(can run on may different types of computers)

Have 3 categories : third, fourth and fifth

generation

Written in series of English-like words

Must be translated to machine code first.

(Use translator)

High Level LanguageHigh Level Language

Page 9: Chapter 1: Introduction to  Programming Language

CSC425 - Introduction To Computer Programming 9

3rd Generation Language (1960 – 1970)3rd Generation Language (1960 – 1970)

Instruction is written as a series of English-like words.

Often are called procedural languages Translation is performed using compiler or

translator Example of 3GL programming language:

FORTRAN, COBOL and BASIC

Page 10: Chapter 1: Introduction to  Programming Language

CSC425 - Introduction To Computer Programming 10

Stands for FORmula TRANslator Develop in the late 1950s by team of IBM Designed for scientific applications Used most often by scientist, engineers and

mathematicians.

Example coding in FORTRAN

FORTRANFORTRAN

FFOORRTTRRAANN

Page 11: Chapter 1: Introduction to  Programming Language

CSC425 - Introduction To Computer Programming 11

COBOLCOBOL

Common Business Oriented Language was developed in the early 1960s more widely used used for business applications easy to read, write and maintain

BASICBASIC

Was develop in the mid - 1960s by John Kemeny and Thomas Kurtz

Easy to learn and used Widely used for education and business

application.

Page 12: Chapter 1: Introduction to  Programming Language

CSC425 - Introduction To Computer Programming 12

Also uses English-like statements Non- procedural languages - only to specify what is to be accomplished

without explaining how Coding programs requires less time and effort Example of programming language :

PROLOG, FOCUS, LISP and FORTH

4th Generation Language (1970s – 1980s)4th Generation Language (1970s – 1980s)

Page 13: Chapter 1: Introduction to  Programming Language

CSC425 - Introduction To Computer Programming 13

Also called natural language. A type of query language that allows the user to

enter requests that resemble human speech. Translate human instructions into code the

computer understands. Sometimes referred to as knowledge-based

language.

5th Generation Language (1990s)5th Generation Language (1990s)

Page 14: Chapter 1: Introduction to  Programming Language

CSC425 - Introduction To Computer Programming 14

Example of Natural language

Welcome to Inquiry

What would you like to know?

Do we have hammer #37645?

One moment please..Yes, we have 14 hammer #37645.Do we have 1 box nails #3601?

One moment, please.No nails #3601 in stock.

Page 15: Chapter 1: Introduction to  Programming Language

CSC425 - Introduction To Computer Programming 15

LanguageLanguage

Program need to translate because computer only understand machine language.

Three kind of translator : - Assembler

- Compiler - Translator

Used in assembly language for translate the language to machine language

TranslatorTranslator

AssemblerAssembler

Page 16: Chapter 1: Introduction to  Programming Language

CSC425 - Introduction To Computer Programming 16

Translates one program code statement at a time. Immediately displays feedback when it finds error. Use for Basic

Sourceprogram

Data

INTERPRETER RESULTS

InterpreterInterpreter

Page 17: Chapter 1: Introduction to  Programming Language

CSC425 - Introduction To Computer Programming 17

Translating the source code from its original language into machine code.

Converts the entire source program into machine language at one time

Use for C and Cobol

Sourceprogram

Data

COMPILER RESULTSOBJECT

PROGRAM

ProgramListing

CompilerCompiler