CS208 Software Programming - PowerPoint PPT Presentation

1 / 17
About This Presentation
Title:

CS208 Software Programming

Description:

Use English-like statements to instruct the computer what to do ... Each programming language has grammar rules that specify: How the statements are formed ... – PowerPoint PPT presentation

Number of Views:20
Avg rating:3.0/5.0
Slides: 18
Provided by: pamsma
Category:

less

Transcript and Presenter's Notes

Title: CS208 Software Programming


1
CS208 Software Programming

2
Introduction
  • Software
  • Instructions that tell the computer what to do
    (ie. a program)
  • Instructions are written in a programming
    language

3
Language Levels
  • Each type of CPU has its own specific machine
    language
  • Other language levels were created to make it
    easier for a human being to write programs
  • machine language
  • assembly language
  • high-level language

4
Languages
  • Machine Language
  • Zeros and Ones
  • Bit representations are specific to a particular
    hardware architecture
  • Assembly Languages
  • Use mnemonics for operations and sometimes also
    for memory locations
  • Each assembly language is specific to a
    particular hardware architecture
  • Translated by an Assembler

5
Languages
  • High Level Languages
  • Use English-like statements to instruct the
    computer what to do
  • Are more portable (will run on different kinds of
    hardware)
  • Are easier for humans to understand and program
    with
  • Translated by a Compiler

6
Programming Language Capability Requirements
  • Representation Storage (of both the Data and
    the program Instructions)
  • Data Processing (Interprets the program
    instructions and carries out the operations
    defined by these instructions on the Data)
  • Data Input and Data Output
  • Input Data - data that is provided (is not
    computed) to the program as it runs
  • Output Data - data that the program ultimately
    produces (output data solution of the
    computational problem)

7
Example Languages
  • High Level Languages
  • FORTRAN - scientific/engineering, math
  • COBOL - business
  • BASIC - education and PCs
  • Pascal - education
  • C/C - application development
  • Java - application development

8
Program Development
  • Program development consists of
  • Discovering the underlying algorithm
  • Representing that algorithm as a program using a
    programming language

9
Programs
  • What is a program?
  • A collection of statements
  • Written in a programming language
  • Specify the steps taken to solve a problem
  • Each programming language has grammar rules that
    specify
  • How the statements are formed
  • How the statements are combined

10
High-Level Language Programming
  • Programming requires
  • A programming language (e.g. C) to express your
    ideas
  • A set of tools to edit and debug your code
  • A compiler to translate your programs to machine
    code
  • A machine to run the executable code on

11
Types of Code
  • Source code (source file)
  • Typed into the editor by the programmer using a
    programming language
  • Object Code (object file)
  • Translated from the source code by the compiler
  • Executable Code
  • Created by the linker - links the object code and
    any necessary library object code files together

12
Program Development
High-Level Language Program Development
13
Creating Computer Programs
  • Analyze the problem
  • Plan an algorithm
  • Hand check the algorithm
  • Code the algorithm (or write program)
  • Hand check (trace through) the program
  • Evaluate and modify program as necessary

14
Structured Programming
  • Structured Programming is a technique used to
    create well-formed programs
  • Uses top-down design with stepwise refinement
  • Larger pieces of code are broken into shorter
    pieces of code that encompass a single task
  • Task are repeatedly broken down into smaller
    tasks, until they are small enough to be
    understood easily

15
Structured Programming Concepts
  • Final program is created via top-down design.
  • Main code starts with empty modules, and is
    slowly refined to lowest level
  • Program is subdivided into modules (one logical
    task, generally no more than one page long)
  • Keeps programmer from being overwhelmed by the
    size of the job
  • Allows easy division of work (modules assigned to
    different programmers)

16
Structured Programming Concepts (continued)
  • Each module is organized into recognizable
    paragraphs, using indentation to show nesting and
    subordinate clauses.
  • Code structures should have only one entry point
    and one point of exit (no GOTO).
  • Embedded comments describe the function of each
    data item and purpose of each module.
  • Straightforward, easily readable code is
    preferred over slightly more efficient, but
    obtuse, code.

17
Benefits of Structured Programming
  • More readable
  • Easier to maintain
  • More flexible
  • More likely to be correct on first run
  • Easier to "prove" by systematic program
    verification
Write a Comment
User Comments (0)
About PowerShow.com