Algorithmic Thinking and the Software Life Cycle - PowerPoint PPT Presentation

1 / 12
About This Presentation
Title:

Algorithmic Thinking and the Software Life Cycle

Description:

Algorithmic Thinking and the Software Life Cycle. What is the job ... With people we rely on that ... A patriot missile failed to intercept a scud fired at ... – PowerPoint PPT presentation

Number of Views:64
Avg rating:3.0/5.0
Slides: 13
Provided by: sciBrook
Category:

less

Transcript and Presenter's Notes

Title: Algorithmic Thinking and the Software Life Cycle


1
Algorithmic Thinking and the Software Life Cycle
  • What is the job of a programmer?

2
Computers Are Just Machines
  • With people we rely on that person's experience.
  • With a computer we cannot take anything for
    grantedNo
  • assumptions,
  • inconsistencies
  • omissions

3
Example of an Omission
  • The following instruction would be enough for
    someone with experience
  • Buy a loaf of bread from the store.
  • Without experience they would become frustrated
    by the following omissions What are the
    directions? How much does it cost? Etc...

4
Fewer Omissions
  • Expanded instruction
  • Tell the person how much bread costs
  • Make sure that they have the money.
  • Give them the store address
  • Send them to purchase the bread

5
Even More Detail
  • Step 3 above can be expanded as follows
  • Make a right turn at the first corner
  • Make a left after 2 lights.
  • More detail might be necessary.

6
Bugs - mistakes
  • When something goes wrong because the
    instructions were not accurate enough it is
    referred to as a bug.
  • Example of a bug
  • When making a purchase Canadian currency was used
    and not accepted at the store. We did not specify
    which currency to use.

7
Software Life-Cycle
  • Design an Algorithm
  • Write a program- in a high-level programming
    language such as C, Pascal, COBOL, Basic Java...
  • Compile the program- Translate it into machine
    code.
  • Run or execute the program.
  • Debug fix errors (bugs)
  • Maintenance cycle through these steps

8
Factorial Example- Algorithm
  • Ask for a number and keep a running total
  • Loop for number times
  • multiply the running total by a lower number
    each time around
  • Print out the final answer

9
Factorial Example - C code
  • main( )
  • int n, count, f1 printf("Enter a number")
  • scanf("d",n)
  • countn
  • while(countgt1)
  • ffcount countcount-1
  • printf("The factorial is d",f)

10
Bug examples in C program
  • Countcount1 instead of countcount-1 
  • Ff1 instead of ff1
  • Countlt1instead of countgt1

11
Two famous examples of bugs
  • Mars Climate Orbiter was lost in space in 1999.
    In the calculation of its route some programmers
    used the metric system while others used English
    units.
  • A patriot missile failed to intercept a scud
    fired at US troops in 1991. The following is from
    an article Specifically, the time in tenths of
    second as measured by the system's internal clock
    was multiplied by 1/10 to produce the time in
    seconds.

12
Questions
  • What is an algorithm?
  • What is the Software Life Cycle?
  • What are some examples of bugs
Write a Comment
User Comments (0)
About PowerShow.com