Pages - Menu

Monday, November 26, 2012

programming languages

Introduction

What is a Computer?
Up until the late 1940’s, a Computer was a person who performed calculations
What about now?


•Programs
Programs are sequence of step by step instructions to the computer
Programs, and the data values processed by programs, are called software.

Programming languages

•Low-Level Programming Languages
Machine language
Assembly language


•High-Level Programming Languages
Instructions look more like English and Math
Generally result in multiple low level commands, for a single high level statement.


Machine Language

Used by early computers

Executable by machines, almost incomprehensible to humans

Programming in machine language is very tedious and prone to errors

Ex

11001010000100101000010101110100

11000101010001110010101000110010

Assembly Language
Mnemonics used for instruction codes
and memory locations

Not directly understandable by
machine. They must be translated

Easier for humans to use and still in
use today.
Ex:
ADD X, Y, Reg1
ADD Reg1, Z, Reg2
STORE Reg2 SUM

High Level Programming Language
Uses syntax resembling combination of mathematical notation and English

Easy for humans to understand.

Not understandable by machines, must be translated using a compiler or an interpreter.

Programming tools such as integrated programming environment with a debugger are available to aid in
 programming process.

High Level Programming Languages
Pascal  RESULT := X + Y+ Z;

FORTRAN  RESULT = X + Y + Z

COBOL  COMPUTE RESULT = X + Y + Z.

C  RESULT = X + Y + Z;

C++  RESULT = X + Y + Z;

Ada  RESULT := X + Y + Z;

PL/1  RESULT = X + Y + Z;


Programming Language Translation
Assemblers
Interpreters
Compilers


•Assemblers
–Translate statement from assembly language to machine language
–Generally use table look-up techniques

•Interpreters
–Translate and execute each high-level statement, one at a time




Translate the entire high level language program, called the source code, to machine language and store the
  result.

Machine language code produced by compilers is called object code


Programming Paradigms 
Object-Oriented Paradigm


System Software
Operating System
  –Memory and resource management
  –Job scheduling
  –Security

Command Line vs. Graphical User Interface
  –Note: the vi editor

Problem Solving and Software Development

Development and Design

Analyze the problem

Develop a solution

Code the solution

Test and debug


Documentation


–Internal documentation


•Comments – Notes to the reader of the program


•Identifiers – should represent the information they hold or the task they define.


–External documentation

•User’s manual

•Test plan

•Design document



•Maintenance

–Correcting new problems

–Adding new features

–Modifications due to change in requirements

Algorithms
An Algorithm is a step by step sequence of instructions.
It must be unambiguous
It must be doable
Each step must terminate, and the entire algorithm must terminate

Expressions of Algorithms are
Pseudocode
Flowcharts

Example of Algorithm 
Write an algorithm that will determine the largest value of four values.  

A flowchart solution
INPUT first value, STORE value in Largest.

Loop to determine if any other numbers are larger.
 DISPLAY Largest

A pseudocode solution
INPUT first value, STORE value in Largest

Repeat three times

INPUT next value, store in Number

IF Number >Largest,

STORE Number in Largest

DISPLAY largest

Control Structures
Sequence

Execute sequence of statements in order given.

This is the default control structure.

Selection

Select between alternative paths.

Iteration

Repeat a statement or collection of statements over and over again.

Invocation

Execute a complex task, which is written separately





































No comments:

Post a Comment