CS1321: Introduction to Programming - PowerPoint PPT Presentation

1 / 18
About This Presentation
Title:

CS1321: Introduction to Programming

Description:

Example: example of what you would put in should ;; produce example of what should happen ... put your tests here Let's work through an example. Write a ... – PowerPoint PPT presentation

Number of Views:33
Avg rating:3.0/5.0
Slides: 19
Provided by: david3049
Category:

less

Transcript and Presenter's Notes

Title: CS1321: Introduction to Programming


1
CS1321Introduction to Programming
  • Georgia Institute of Technology
  • College of Computing
  • Module 3
  • Design Recipe Introduction

2
Designing Programs
3
Outline
  • Prerequisites
  • Basic Scheme Syntax
  • Objectives
  • Basic recipe for program design
  • Purpose
  • Examples
  • Body
  • Tests
  • Reference
  • HTDP Section 2.5 Designing Programs

4
Road Map
  • Foreign Language
  • Grammar
  • Vocabulary
  • Phrases, Sentences
  • Conversation

Computer Language Syntax Defined
Words Abstraction Problem Solving
Start conversing from the first day
Start solving problems from the first day
5
Design Recipe
  • Incredible way to guide your programming
    experience
  • Well present examples of the Design Recipe in
    this lecture and many others
  • For you HW, be sure to see the HW Skeleton linked
    on the course website under the HW section. It
    gives the format you are to use for homeworks.

6
The basic design recipe Contract ltnamegt
ltvariable typegt -gt ltvariable typegt Purpose A
brief description of the problem Example
ltexample of what you would put ingt should
produce ltexample of what should
happengt Definition ltput your code
heregt Tests ltput your tests heregt
7
Our revision... Name John Doe GT
Numbergt1234a Homework ltnumbergt (and more
see the HW Skeleton on the website under
Homework!) Collaboration Contract ltnamegt
ltvariable typegt -gt ltvariable typegt Purpose
A brief description of the problem Example
ltexample of what you would put ingt should
produce ltexample of what should
happengt Definition ltput your code
heregt Tests ltput your tests heregt
8
Lets work through an example
Write a function area-circle that calculates
the area of a circle. It will consume a number
and return a number.
9
Contract
Contract area-circle number -gt number
10
Purpose
Purpose Calculate the area of a circle given
the radius
11
Example
Example (area-circle 5) should produce
78.5
Alternatively
Example (area-circle 5) --gt 78.5
(area-circle 1) --gt 3.14
12
Definition
Definition (define (area-circle radius)
( 3.14 ( radius radius))
13
Tests
Tests (area-circle 5) expected 78.5 (area-c
ircle 10) expected 314
14
Do I have to do this?
yes!
15
Do I have to do this?
And it works!
16
Summary
  • You should now know
  • Basic recipe for program designsee page 21 or
    http//www.htdp.org/2001-01-18/Book/node14.htm
  • Purpose
  • Examples
  • Body
  • Tests
  • Recipes are required. See HW webpage and course
    webpage for more requirements regarding recipes
    and format for HW for this course.

17
Assignments
  • Read section I Processing Simple Forms of Data
  • HW 1 is due tomorrow at noon..
  • Keep reading newsgroup .announce every day.
  • Lab 1 covering email and newsgroups is online,
    due tomorrow at noon.

18
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com