Software outline
This presentation is the property of its rightful owner.
Sponsored Links
1 / 61

Software Outline PowerPoint PPT Presentation


  • 255 Views
  • Uploaded on
  • Presentation posted in: General

Software Outline. Programming Languages Natural Languages vs Programming Languages Programming Language Hierarchy High Level Languages Assembly Languages Machine Languages Converting Between Languages Compiler Interpreter Assembler Our Old Friend hello_world.c Compiler Details

Download Presentation

Software Outline

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Software outline

Software Outline

  • Programming Languages

  • Natural Languages vs Programming Languages

  • Programming Language Hierarchy

  • High Level Languages

  • Assembly Languages

  • Machine Languages

  • Converting Between Languages

  • Compiler

  • Interpreter

  • Assembler

  • Our Old Friend hello_world.c

  • Compiler Details

  • Compiler Details (cont’d)

  • Elements of a Compiler #1

  • Elements of a Compiler #2

  • Phases of Compiling

  • Compiling a C Statement

  • Assembly Code for hello_world.c #1

  • Assembly Code for hello_world.c #2

  • Machine Code for hello_world.c

  • How to Program in Machine Language Directly

  • Why Not Do Everything in Machine Language?

  • Why Not Do Everything in Assembly Language?

  • The Programming Process

  • What is an Algorithm?

  • Algorithms

  • Algorithm Example: Eating a Bowl of Corn Flakes

  • Top-Down Design

  • Eating Cornflakes: Top Level

  • Software Outline

  • What is Software?

  • What is a Program?

  • What are Instructions?

  • What is a Programming Language?

  • What is Source Code? What is a Source File?

  • What is an Operating System?

  • Operating System Examples

  • A Simple C Program

  • Anatomy of a Simple C Program

  • Block Delimiters

  • What Is a Comment? #1

  • What Is a Comment? #2

  • Are Comments Necessary?

  • hello_world.c with Comments

  • hello_world.c without Comments

  • Flowchart for hello_world.c

  • A Less Simple C Program #1

  • A Less Simple C Program #2

  • A Less Simple C Program #3

  • A Less Simple C Program: Compile & Run

  • Flowchart for my_add.c

  • Languages

  • What Are the Ingredients of a Language?

  • Kinds of Languages

  • Natural Languages #1

  • Natural Languages #2

  • Natural Languages #3

  • Natural Languages #4

Software Lesson

CS1313 Spring 2006


What is software

What is Software?

Software, for our purposes, is just a word meaning “programs.”

Software Lesson

CS1313 Spring 2006


What is a program

What is a Program?

A program is a collection of data – on RAM, disk, etc – and a sequence of actions on those data.

The actions in a program are known as instructions.

Software Lesson

CS1313 Spring 2006


What are data

What are Data?

In computing, data are values stored in storage locations: RAM, disk, etc.

Software Lesson

CS1313 Spring 2006


What are instructions

What are Instructions?

The actions in a program are known as instructions.

Examples:

  • Arithmetic/Logical calculation: e.g., add, subtract, multiply, divide, square root, cosine, etc.

  • Memory operations: load from or store into RAM

  • I/O: read from or write to secondary storage

  • Branch: jump to an instruction that is out of sequence

  • Repetition

  • Allocation of resources

    … and many more.

Software Lesson

CS1313 Spring 2006


What is a programming language

What is a Programming Language?

A programming languageis a well-defined set of rules for specifying a program’s collection of data and sequence of instructions.

Examples: C, C++, Fortran 90, Java, Basic, HTML, Perl, Haskell, Prolog, Pascal, Unix shell, SAS, Pentium4 assembly language, etc.

Software Lesson

CS1313 Spring 2006


What is source code what is a source file

What is Source Code? What is a Source File?

Source codeis a sequence of instructions, written in a human-readableprogramming language, that constitutes a program, or a piece of a program.

An example is shown on page 10.

A source file is a file of source code.

Software Lesson

CS1313 Spring 2006


What is an operating system

What is an Operating System?

An operating systemis a program that manages interactions between:

  • users and hardware;

  • users and software;

  • hardware and software;

    ... and so much more.

Software Lesson

CS1313 Spring 2006


Operating system examples

Operating System Examples

  • MS Windows/MS-DOS

  • MacOS

  • PalmOS

  • Unix

    • Linux (portable)

    • FreeBSD (portable, underlies MacOS X)

    • Solaris (Sun Microsystems)

    • AIX (IBM)

    • IRIX (SGI)

    • Tru64 (Hewlett-Packard)

    • HP-UX (Hewlett-Packard)

    • Unicos (Cray)

Software Lesson

CS1313 Spring 2006


A simple c program

A Simple C Program

/*

*************************************************

*** Program: hello_world ***

*** Author: Henry Neeman ([email protected]) ***

*** Course: CS 1313 010 Spring 2006 ***

*** Lab: Sec 012 Fridays 10:30am ***

*** Description: Prints the sentence ***

*** "Hello, world!" to standard output. ***

*************************************************

*/

#include <stdio.h>

int main ()

{ /* main */

/*

********************************

*** Execution Section (body) ***

********************************

*

* Print the sentence to standard output

* (i.e., to the terminal screen).

*/

printf("Hello, world!\n");

} /* main */

Software Lesson

CS1313 Spring 2006


Anatomy of a simple c program

Anatomy of a Simple C Program

/*

*************************************************

*** Program: hello_world ***

*** Author: Henry Neeman ([email protected]) ***

*** Course: CS 1313 010 Spring 2006 ***

*** Lab: Sec 012 Fridays 10:30am ***

*** Description: Prints the sentence ***

*** "Hello, world!" to standard output. ***

*************************************************

*/

#include <stdio.h>

int main ()

{ /* main */

/*

********************************

*** Execution Section (body) ***

********************************

*

* Print the sentence to standard output

* (i.e., to the terminal screen).

*/

printf("Hello, world!\n");

} /* main */

Comment block

Preprocessor directive

Main function header

Block open

Execution section (also known as the program body)

Block close

Software Lesson

CS1313 Spring 2006


Block delimiters

Block Delimiters

The open curly brace, also known as the left brace,

{

acts as the start of a block and is known as the

block open.

The close curly brace, also known as the right brace,

}

acts as the end of a block and is known as the

block close.

The block open and block close are said to delimit the block: they indicate where the block begins and where the block ends.

Delimit: indicate where something begins and ends.

Software Lesson

CS1313 Spring 2006


What is a comment 1

What Is a Comment? #1

A commentis a piece of text in a source file that:

  • tells human beings (e.g., programmers) something useful about the program, but

  • is ignored by the compiler, so it has absolutely no affect on how the program runs.

    In C, the start of a comment is indicated by

    /*

    and the end of a comment is indicated by

    */

    All text appearing between these comment delimitersare part of the comment, and therefore are ignored by the compiler.

Software Lesson

CS1313 Spring 2006


What is a comment 2

What Is a Comment? #2

A commentis a piece of text in a source file that:

  • tells human beings (e.g., programmers) something useful about the program, but

  • is ignored by the compiler, so it has absolutely no affect on how the program runs.

    In C, the start of a comment is indicated by

    /*

    and the end of a comment is indicated by

    */

    A comment can use multiple lines of text. The delimiters do not have to be on the same line.

Software Lesson

CS1313 Spring 2006


Are comments necessary

Are Comments Necessary?

Comments are ignored by the compiler, so strictly speaking they aren’t needed to compile and run.

But, if you don’t put them into one of your CS1313 programming projects, YOU MAY LOSE A FULL LETTER GRADE OR MOREon that project.

Why?

Comments tell human beings useful things about your program.

They help programmers – including you, a month later when you’ve forgotten everything about your program – to understand your program.

They also tell graders that you know what the heck you’re doing.

Software Lesson

CS1313 Spring 2006


Hello world c with comments

hello_world.c with Comments

/*

*************************************************

*** Program: hello_world ***

*** Author: Henry Neeman ([email protected]) ***

*** Course: CS 1313 010 Sprint 2006 ***

*** Lab: Sec 012 Fridays 10:30am ***

*** Description: Prints the sentence ***

*** "Hello, world!" to standard output. ***

*************************************************

*/

#include <stdio.h>

int main ()

{ /* main */

/*

********************************

*** Execution Section (body) ***

********************************

*

* Print the sentence to standard output

* (i.e., to the terminal screen).

*/

printf("Hello, world!\n");

} /* main */

Software Lesson

CS1313 Spring 2006


Hello world c without comments

hello_world.c without Comments

#include <stdio.h>

int main ()

{

printf("Hello, world!\n");

}

Software Lesson

CS1313 Spring 2006


Flowchart for hello world c

Start

Output “Hello, world!”

End

Flowchart for hello_world.c

An ovaldenotes either the start or the end of the program, or a halt

operation within the program (which we’ll learn about later).

A parallelogramdenotes either an input operation or an output operation.

An arrowdenotes the flow of the program.

int main ()

{

printf("Hello, world!\n");

}

References:

http://www.wiley.co.uk/college/busin/icmis/oakman/outline/chap05/slides/symbols.htm

http://www.ncits.org/tc home/k5htm/f2.htm#flowchart symbol

Software Lesson

CS1313 Spring 2006


Outputting compiling and running a c program

Outputting, Compiling and Running a C Program

% cat hello_world.c

/*

*************************************************

*** Program: hello_world ***

*** Author: Henry Neeman ([email protected]) ***

*** Course: CS 1313 010 Fall 2005 ***

*** Lab: Sec 011 Fridays 9:30am ***

*** Description: Prints the sentence ***

*** "Hello, world!" to standard output. ***

*************************************************

*/

#include <stdio.h>

int main ()

{ /* main */

/*

********************************

*** Execution Section (body) ***

********************************

*

* Print the sentence to standard output

* (i.e., to the terminal screen).

*/

printf("Hello, world!\n");

} /* main */

% gcc -o hello_world hello_world.c

% hello_world

Hello, world!

Software Lesson

CS1313 Spring 2006


Anatomy of outputting compiling and running

Anatomy of Outputting, Compiling and Running

Unix command to output to the screen

% cat hello_world.c

/*

*************************************************

*** Program: hello_world ***

*** Author: Henry Neeman ([email protected]) ***

*** Course: CS 1313 010 Fall 2005 ***

*** Lab: Sec 011 Fridays 9:30am ***

*** Description: Prints the sentence ***

*** "Hello, world!" to standard output. ***

*************************************************

*/

#include <stdio.h>

int main ()

{ /* main */

/*

********************************

*** Execution Section (body) ***

********************************

*

* Print the sentence to standard output

* (i.e., to the terminal screen).

*/

printf("Hello, world!\n");

} /* main */

% gcc -o hello_world hello_world.c

% hello_world

Hello, world!

Unix command to compile

Unix command to run

Program output

Software Lesson

CS1313 Spring 2006


A less simple c program 1

A Less Simple C Program #1

/*

************************************************

*** Program: my_add ***

*** Author: Henry Neeman ([email protected]) ***

*** Course: CS 1313 010 Fall 2005 ***

*** Lab: Sec 011 Fridays 9:30am ***

*** Description: Input two integers, compute ***

*** their sum and output the result. ***

************************************************

*/

#include <stdio.h>

int main ()

{ /* main */

/*

***************************

*** Declaration Section ***

***************************

*

*****************************

* Named Constant Subsection *

*****************************

*/

const int program_success_code = 0;

/*

*****************************

* Local Variable Subsection *

*****************************

*

* addend: the addend value that the user inputs.

* augend: the augend value that the user inputs.

* sum: the sum of the addend and the augend,

* which is output.

*/

int addend, augend, sum;

Continued on the next slide.

Software Lesson

CS1313 Spring 2006


A less simple c program 2

A Less Simple C Program #2

/*

*************************

*** Execution Section ***

*************************

*

***********************

* Greeting Subsection *

***********************

*

* Tell the user what the program does.

*/

printf("I’ll add a pair of integers.\n");

/*

********************

* Input subsection *

********************

*

* Prompt the user to input the addend & augend.

*/

printf("What two integers do you want to add?\n");

/*

* Input the integers to be added.

*/

scanf("%d %d", &addend, &augend);

Continued on the next slide.

Software Lesson

CS1313 Spring 2006


A less simple c program 3

A Less Simple C Program #3

/*

**************************

* Calculation Subsection *

**************************

*

* Calculate the sum.

*/

sum = addend + augend;

/*

*********************

* Output Subsection *

*********************

*

* Output the sum.

*/

printf("The sum of %d and %d is %d.\n",

addend, augend, sum);

return program_success_code;

} /* main */

Software Lesson

CS1313 Spring 2006


A less simple c program compile run

A Less Simple C Program: Compile & Run

% gcc -o my_add my_add.c

% my_add

I’ll add a pair of integers.

What two integers do you want to add?

5 7

The sum of 5 and 7 is 12.

% my_add

I’ll add a pair of integers.

What two integers do you want to add?

1593

09832

The sum of 1593 and 9832 is 11425.

Software Lesson

CS1313 Spring 2006


Flowchart for my add c

Flowchart for my_add.c

A rectangledenotes an operation other than I/O or branching (e.g., calculation).

Software Lesson

CS1313 Spring 2006


Languages

Languages

  • What is a language?

  • Kinds of languages

    • Natural languages

    • Programming languages (also known as Formal languages)

  • Converting between programming languages

    • Compilers

    • Interpreters

    • Assemblers

Software Lesson

CS1313 Spring 2006


What are the ingredients of a language

What Are the Ingredients of a Language?

  • Symbols: a set of wordsand punctuation(in computing, words and punctuation are together known as tokens)

  • Grammar(also known as syntax): a set of rules for putting tokens together to get valid statements

  • Semantics: a set of rules for interpreting the meaningof a valid statement

Software Lesson

CS1313 Spring 2006


Kinds of languages

Kinds of Languages

  • Natural languages: used in human communication

  • Programming languages (also known as formal languages): used by computers (among others)

Software Lesson

CS1313 Spring 2006


Natural languages 1

Natural Languages #1

  • Examples: English, Chinese, Swahili, Navajo, Quechua, Maori

  • Typically can be described by formal rules (grammar), but often are not rigidly governed by these rules in everyday use:

    “Any noun can be verbed.”

    “I might could get me one o’ them there computers.”

Software Lesson

CS1313 Spring 2006


Natural languages 2

Natural Languages #2

  • Can mix words from different languages — and even syntax(elements of grammar) from different languages — in a single sentence:

    “Hey, amigo, is it all right by you if I kibbitz your parcheesi game while we watch your anime?”

Software Lesson

CS1313 Spring 2006


Natural languages 3

Natural Languages #3

  • Can be ambiguous:

    “When did he say she was going?”

    could be interpreted as:

    • State the time at which he said, “She was going.”

    • According to him, at what time was she going?

Software Lesson

CS1313 Spring 2006


Natural languages 4

Natural Languages #4

  • Plenty of flexibility regarding “correctness;” e.g., “ain’t,” split infinitives, ending a sentence with a preposition

    “That is something up with which I will not put.”

Software Lesson

CS1313 Spring 2006


Programming languages

Programming Languages

  • Examples: C, Java, HTML, Haskell, Prolog, SAS

  • Also known as formal languages

  • Completely described and rigidly governed by formal rules

  • Cannot mix the words of multiple languages, or the syntax of multiple languages, in the same program

  • Cannot be ambiguous

  • Words and syntax must be EXACTLYcorrect in every way

Software Lesson

CS1313 Spring 2006


Natural languages vs programming languages

Natural Languages vs Programming Languages

Software Lesson

CS1313 Spring 2006


Programming language hierarchy

Programming Language Hierarchy

  • High Level Languages

  • Assembly Languages

  • Machine Languages

Software Lesson

CS1313 Spring 2006


High level languages

High Level Languages

  • Human-readable

  • Most are standardized, so they can be used on just about any kind of computer.

  • Examples: C, Fortran 90, Java, HTML, Haskell, SAS

  • Typically they are designed for a particular kind of application; for example:

    • C for operating system design

    • Fortran 90 for scientific & engineering applications

    • Java for web applets and embedded systems

    • HTML for hypertext (webpages)

    • SAS for statistics

      But often, their uses in real life are broader their original purpose.

Software Lesson

CS1313 Spring 2006


Assembly languages

Assembly Languages

  • Human-readable

  • Specific to a particular CPU family; for example:

    • Intel Pentium4/AMD Athlon XP (PC)

    • Motorola PowerPC G5 (Macintosh)

    • Intel Itanium2 (servers)

  • So, for example, a program in Pentium4 assembly language cannot be directly run on a G5 machine.

  • Set of simple commands; for example:

    • Load a value from a location in main memory

    • Add two numbers

    • Branch to an instruction out of sequence

Software Lesson

CS1313 Spring 2006


Machine languages

Machine Languages

  • Not human-readable, except with immense effort

  • Binary code that the CPU family understands directly

  • Binary representation of the CPU family’s assembly language

Software Lesson

CS1313 Spring 2006


Converting between languages

Converting Between Languages

Compilers, interpreters and assemblers are programs that convert programs that people can read into actions that computers can perform.

Software Lesson

CS1313 Spring 2006


Compiler

Compiler

  • Converts a human-readable high level language source code of a program into a machine language executableprogram

  • Converts an entire source code all at once

  • Must be completed before executing the program

  • Examples: Fortran 90, C, C++, Pascal

Software Lesson

CS1313 Spring 2006


Interpreter

Interpreter

  • Converts a human-readable high level language source code into actions that are immediately performed

  • Converts and executes one statement at a time

  • Conversion and execution alternate

  • Examples: Perl, HTML, SAS, Mathematica, Unix “shell” (interactive system within Unix)

Software Lesson

CS1313 Spring 2006


Assembler

Assembler

  • Converts a human-readable CPU-specific assembly codeinto CPU-specific machine language

  • Like a compiler, but for a low level assembly language instead of for a high level language

Software Lesson

CS1313 Spring 2006


Our old friend hello world c

Our Old Friend hello_world.c

% cat hello_world.c

/*

*************************************************

*** Program: hello_world ***

*** Author: Henry Neeman ([email protected]) ***

*** Course: CS 1313 010 Fall 2005 ***

*** Lab: Sec 011 Fridays 9:30am ***

*** Description: Prints the sentence ***

*** "Hello, world!" to standard output. ***

*************************************************

*/

#include <stdio.h>

int main ()

{ /* main */

/*

********************************

*** Execution Section (body) ***

********************************

*

* Print the sentence to standard output

* (i.e., to the terminal screen).

*/

printf("Hello, world!\n");

} /* main */

% gcc -o hello_world hello_world.c

% hello_world

Hello, world!

Software Lesson

CS1313 Spring 2006


Compiler details

Compiler Details

Software Lesson

CS1313 Spring 2006


Compiler details cont d

Compiler Details (cont’d)

Software Lesson

CS1313 Spring 2006


Elements of a compiler 1

Elements of a Compiler #1

  • Lexical Analyzer: identifies program’s “word” elements

    • Comments (ignored by compiler)

    • Keywords(e.g., int, while)

    • Constants(e.g., 5, 0.725, "Hello, world!")

    • User-defined Identifiers (e.g., addend)

    • Operators; for example:

      • Arithmetic: + - * / %

      • Relational: == != < <= > >=

      • Logical: && || !

Software Lesson

CS1313 Spring 2006


Elements of a compiler 2

Elements of a Compiler #2

  • Parser: determines the program’s grammar

  • Semantic Analyzer: determines what the program does

  • Intermediate Code Generator: expresses, as an assembly-like program, what the program does

  • Optimizer: makes code more efficient (faster)

  • Assembly Code Generator: produces the final assembly code that represents what the program does

Software Lesson

CS1313 Spring 2006


Phases of compiling

Phases of Compiling

  • Compiler

  • Assembler: turns assembly code into machine code

  • Linker/loader: turns machine code into an executable file

    Both the assembler and the linker/loader are invoked automatically by the compiler, so you don’t have to worry about them.

Software Lesson

CS1313 Spring 2006


Compiling a c statement

Compiling a C Statement

Software Lesson

CS1313 Spring 2006


Assembly code for hello world c 1

On Pentium4 Using gcc

pushl %ebp

movl %esp, %ebp

subl $8, %esp

subl $12, %esp

pushl $.LC0

call printf

addl $16, %esp

leave

ret

On IBM POWER4 Using gcc

mflr 0

stw 31,-4(1)

stw 0,8(1)

stwu 1,-64(1)

mr 31,1

lwz 3,LC..1(2)

bl .printf

nop

lwz 1,0(1)

lwz 0,8(1)

mtlr 0

lwz 31,-4(1)

blr

Assembly Code for hello_world.c #1

Different opcodes!

Software Lesson

CS1313 Spring 2006


Assembly code for hello world c 2

On Pentium4 Using gcc

(GNU compiler)

pushl %ebp

movl %esp, %ebp

subl $8, %esp

subl $12, %esp

pushl $.LC0

call printf

addl $16, %esp

leave

ret

On Pentium4 Using icc

(Intel compiler)

pushl %ebp

movl %esp, %ebp

subl $3, %esp

andl $-8, %esp

addl $4, %esp

push $__STRING.0

call printf

xorl %eax, %eax

popl %ecx

movl %ebp, %esp

popl %ebp

ret

Assembly Code for hello_world.c #2

Different sequences of instructions!

Software Lesson

CS1313 Spring 2006


Machine code for hello world c

Machine Code for hello_world.c

10111101010100010101011110101001

10111010101000010101101011101000

01110101010000101011010111010001

01010100101010101101010101011010

...

Software Lesson

CS1313 Spring 2006


How to program in machine language directly

How to Program in Machine Language Directly

  • Write the assembly code for the program directly by hand; i.e., not in a high level language.

  • For each assembly language instruction, look up the bit pattern of the associated machine code.

  • On the computer console, flip switches to match the bit pattern of the machine code.

  • Press the “Run” button.

    Actually, on modern computers, programming directly in machine language is just about impossible.

Software Lesson

CS1313 Spring 2006


Why not do everything in machine language

Why Not Do Everything in Machine Language?

Incredibly tedious and ridiculously error−prone!

Fun and easy!

Not nearly as tedious or error-prone!

Software Lesson

CS1313 Spring 2006


Why not do everything in assembly language

Why Not Do Everything in Assembly Language?

Can’t be run on any other kind of computer.

May be completely obsolete in a few years.

Portable to many kinds of computers.

Will still be useable in 20 years

(“legacy” codes).

Software Lesson

CS1313 Spring 2006


The programming process

Bugs?

Bugs?

Get an A/Impress Your Boss/Sell for Zillions!

The Programming Process

Compile

Formulate Problem

Yes

Debug

Construct Algorithm

No

Choose Programming Language

Run

Yes

Write Program

No

Software Lesson

CS1313 Spring 2006


What is an algorithm

What is an Algorithm?

An algorithm is:

  • a step-by-step method

  • that is written in a natural language (e.g., English) or in pseudocode(something that sort of looks like a programming language but isn’t as precise), rather than in a programming language,

  • that solves a well-defined (but not necessarily useful) problem

  • on a well-defined set of inputs (which may be empty),

  • using finite resources(e.g., computing time and memory)

  • and that produces a well-defined set of outputs (which may be empty).

Software Lesson

CS1313 Spring 2006


Algorithms

Algorithms

An algorithm is a language-independent way of expressing the method of solving a problem; that is, an algorithm could be expressed in two different languages (e.g., English and Japanese) and still be the same algorithm.

A program, by contrast, is a language-dependent implementation of the method of solving a problem; that is, the same set of steps expressed in two different programming languages would be two different programs, even if the two programs accomplished exactly the same result.

Many programs, but not all programs, implement algorithms.

Software Lesson

CS1313 Spring 2006


Algorithm example eating a bowl of corn flakes

Get bowl from cupboard

Get spoon from drawer

Get box of corn flakes from pantry

Get jug of milk from refrigerator

Place bowl, spoon, corn flakes and milk on table

Open box of corn flakes

Pour corn flakes from box into bowl

Open jug of milk

Pour milk from jug into bowl

Close jug of milk

Go to table

Pick up spoon

Repeat until bowl is empty of corn flakes

Using spoon, pick up corn flakes and milk from bowl

Put spoon with corn flakes and milk into mouth

Pull spoon from mouth, leaving corn flakes and milk

Repeat ...

Chew

... until mouthful is mush

Swallow

Leave mess for housemates to clean up

Algorithm Example: Eating a Bowl of Corn Flakes

Software Lesson

CS1313 Spring 2006


Top down design

Top-Down Design

Algorithms for most non-trivial problems tend to be fairly complicated.

As a result, it may be difficult to march from an algorithm’s beginning to its end in a straight line, because there may be too many details to keep in your head all at one time.

Instead, you can use a technique called top-down design: start with the whole problem, then break it into a few pieces, then break each of those pieces into a few pieces, then break each of those pieces into a few pieces, and so on, until each piece is pretty small.

Software Lesson

CS1313 Spring 2006


Eating cornflakes top level

Eating Cornflakes: Top Level

  • Get stuff

  • Transport stuff

  • Set up stuff

  • Eat

  • Finish

Software Lesson

CS1313 Spring 2006


  • Login