CSCI 125 - PowerPoint PPT Presentation

About This Presentation
Title:

CSCI 125

Description:

... E-mail HLL to Machine Language Enter HLL program into file using editor program.cpp - source file Translate source code ... pseudo-code or flowchart ... – PowerPoint PPT presentation

Number of Views:70
Avg rating:3.0/5.0
Slides: 18
Provided by: Martin939
Category:
Tags: csci | code | flowchart | pseudo

less

Transcript and Presenter's Notes

Title: CSCI 125


1
CSCI 125 161 / ENGR 144 Lecture 3
  • Martin van Bommel

2
Operating System
  • Program that acts as interface to other software
    and the underlying hardware
  • Operating System Utilities
  • Compilers Utility Programs
    Assemblers Editors Hardware E-mail

3
HLL to Machine Language
  • Enter HLL program into file using editor
  • program.cpp - source file
  • Translate source code to machine code - compiler
  • program.obj - object file
  • Combine object code with libraries - linker
  • program.exe - executable file
  • Move program to memory - loader

4
(No Transcript)
5
IDE
  • Integrated Development Environment
  • combines editor, compiler, linker, loader
  • usually includes tools to assist in debugging
  • Note
  • IDEs do not always write to disk automatically
  • must remember to save work to disk often,
    especially before executing a program

6
Programming Errors
  • Vocabulary and grammar - syntax
  • Rules determine if statement legally constructed
    - syntax rules
  • Compiler checks rules - gives syntax errors
  • Programs also contain errors in logic - bugs
  • Debugging - finding fixing logic errors
  • e.g. 1962 Mariner I Venus probe crashed due to
    missing hyphen (-)

7
Initial Program
  • include ltiostreamgt
  • using namespace std
  • int main()
  • cout ltlt Hello world!
  • return 0
  • - library inclusion
  • symbol namespace
  • function main
  • call function cout to display string
  • - expected value to OS

8
Program Development
  • Software Engineering
  • study and use of techniques for programming and
    problem solving
  • Software Life Cycle
  • software development goes through cycles, where
    begins again when software outdated

9
Software Life Cycle
  • 1. Specify the problem requirements.
  • 2. Analyze the problem.
  • 3. Design the algorithm to solve the problem.
  • 4. Implement the program.
  • 5. Test and verify the completed program.
  • 6. Maintain and update the program.

10
Problem Analysis and Spec.
  • Determine its input
  • what information is given
  • what items are important to solving problem
  • Determine its output
  • what information must be produced to solve the
    problem
  • Determine scope of the problem
  • questions, questions, and more questions

11
Algorithm Design
  • Procedure to convert inputs to outputs
  • Uses step-by-step process
  • Top-down step-wise refinement
  • Produce pseudo-code or flowchart

12
Algorithm
  • Three basic forms of control
  • 1. Sequential - one step after another
  • 2. Selection - choose one of many alternatives
  • 3. Repetition - one or more steps repeatedly

13
START
GET NUMBER
ADD NUMBER
10 NUMBERS?
NO
YES
DIVIDE BY 10
PRINT RESULT
END
14
Program Coding
  • Program should be correct, readable, and
    understandable
  • Simple and clear - no tricks
  • Modular - program and test subtasks of overall
    problem separately
  • Conforms to syntax of language

15
Program Formatting
  • Spaces between items in statements
  • between variables and operators
  • Blank lines between major sections
  • each subpart separated from others
  • Good indentation
  • indent statements in loops
  • Meaningful variable names
  • Distance and Time instead of d and t

16
Execution and Testing
  • Test each unit separately before combining
  • Use expected data with known result
  • Use unexpected data to check for problems
  • Validation - tested with several sets of test
    data, but never can tell if absolutely valid.

17
Program Maintenance
  • Programs survive for many years
  • New features must be added
  • Laws, rules, and procedures change
  • Hardware changes
  • e.g. Year 2000 problem
Write a Comment
User Comments (0)
About PowerShow.com