CS 110 - PowerPoint PPT Presentation

1 / 29
About This Presentation
Title:

CS 110

Description:

Practice problems and exercises. See good problem-solving as ... Arm & finger moves (mouse, joystick, keyboard) Text, spelling, grammar, analogy, reasoning... – PowerPoint PPT presentation

Number of Views:36
Avg rating:3.0/5.0
Slides: 30
Provided by: jack195
Category:
Tags:

less

Transcript and Presenter's Notes

Title: CS 110


1
CS 110
  • Introduction to Computer Programming

2
CS 110 Instructor
Name Dr. Jack Tumblin Office Computer Science
Dept., 1890 Maple Ave. Rm. 350 E-mail
j-tumblin_at_cs.northwestern.edu Office Hours Mon,
Fri 100-300pm, or by appt. Phone
(847)-467-2129 (use sparingly)
3
Class Meeting Places
Monday, Wednesday, Friday at 1000AM Tech,
MG-28 (this room) Tuesday at 1000AM Tech
MG-51 (the computer classroom) for hand-on
programming practice help
4
Resources
  • class newsgroup cs.a10 GONE!!! ?Use Course
    Management System
  • Use to
  • discuss class material,
  • ask questions on the material or the assignments
    (but NEVER post solutions)
  • share solutions to posted practice problems

5
Resources
  • class webpage http//www.cs.northwestern.edu/aca
    demics/courses/a10
  • ?CHANGING to Course Management System
  • Use to
  • download class notes and assignments
  • access helpful tutorials
  • look up information about the class (e.g.
    policies)
  • look up your grades

6
Resources
  • Teaching Assistants
  • Drop-by Lab Hours 4 TAs x 3 Hours/week ?
    Plenty of help!
  • Newsgroup Questions Answers
  • Weekly In-Class Lab
  • Hands-on help
  • Practice problems and exercises
  • See good problem-solving as it happens

7
What is a Calculator?
  • What is a Computer?
  • Whats the difference?
  • A vague notion in our textbook
  • history makes it plain and clear

8
What is a Calculator?
  • Before 1940s Manhattan Project A meticulous
    person employed to make large series of numerical
    calculations. for fluid flow, ballistics, trig.
    tables, bombs, etc
  • Sometimes helped by usingmechanical
    calculating machines
  • Seehttp//www.lanl.gov/worldview/welcome/history
    /22_computers.html

9
What does a Calculator do?
  • Before 1940s Manhattan Project (Women were
    consistently the best calculators by far)
  • Teams of calculators would
  • Read card(s) with list(s) of numbers
  • Follow step-by-step instructions to compute new
    numbers
  • Write new numbers, arrange new cards
  • Tabulate, print, graph, or results.

10
What is a Calculator?
  • Before 1940s Manhattan Project (Women were
    consistently the best calculators by far)
  • Teams of calculators would
  • Read card(s) with list(s) of numbers
  • Follow step-by-step instructions to compute new
    numbers
  • Write new numbers, arrange new cards
  • Tabulate, print, graph, or results.

Input Data
Process Data
Output Data
11
What is a Calculator?
  • Answer a reliable follower of fixed rules
    for modifying numbers (data).
  • Read Write
  • Numbers Numbers

Process Data
Input Data
Output Data
Follow Instructions to make new numbers
12
What is Data?
  • Data numbers with assigned meanings
  • Numbers can mean anything!
  • Alphabet letters 41A, 42B, 43C,
  • Colors 0Black, 128Gray, 255White
  • Decisions 0No, 10Maybe, 20Yes,Data can
    follow ANY rules you define!

Process Data
Input Data
Output Data
13
What is a Computer?
  • Now suppose that we have a calculator, PLUS
  • A vast, huge list of numbers we can change
  • Calculator instructions to read and write numbers
    at any desired place on the list
  • An ID for every calculator instruction 00
    add, 01 subtract, 02 is less than, 03read
  • A way to run the calculator from IDs read from
    the list
  • THEN the rule-follower can change its own
    rules!
  • THIS is a computer! a unified, stored program,
    stored data device...

14
What is a Computer ?
  • Read Write
  • Numbers Numbers

Process Data
Input Data
Output Data
Instruction Follower
Instructions(numbers) ------------------- Data
(numbers)
15
Now what is a Computer?
  • A rule-following engine that
  • Converts input data
  • to output data
  • by following instructions that it can
    change, just like data!
  • A calculator that pushes its own buttons
  • Storage for lists of numbers (memory).
  • numbered instructions (press 2 for add)
  • ability to follow instructions stored as numbers

16
Why Bother with Computers?
  • A computer is
  • A fast, tireless, rule-following machine
  • An engine to mimic ANY rule-based system
  • You write the rules the computer solves the
    problem
  • Abstractions exist for almost ANY
    problem(including how can I write a good
    program)

17
What You Will Learn
  • How to solve any finite, defined problem by
  • writing orderly sets of rules (functions) that
    are
  • applied to orderly sets of data (structures), and
  • Re-using earlier solutions (libraries)much less
    tedium.
  • Core ideas found in ALL programming languages
  • The Visual Studio programming environmentone
    good tool among the many available.

18
What is Programming?
  • Program A sequence of human-readable
    instructions telling a computer how to do a
    particular task or solve a given problem.
  • Programming Designing, writing, and testing a
    computer program that works.

19
Programming Artful Common Sense
  • 1) Analyze Find the Core Problem
  • (not how to solve it).
  • Decide the specific inputs and outputs, and
  • Define how to make outputs from inputs
  • Break it down into sub-problems,
  • 2) Implement Write a rule set (a function) for
    each,
  • 3) Debug Bottom up Test each function
    separately then link them together, test, until
    it all works.

20
1. Analyze Find the Core Problem
  • House Example
  • Write a program that computes the square footage
    of a house, given the dimensions of each room.
  • Input
  • The number of rooms (an integer)
  • The dimensions of each room (real numbers)
  • Output
  • The square footage of the house (real numbers)

21
1. Analyze Find the Core Problem
  • Be sure you really understand problem!
  • Refine, simplify, clarify, think. Repeat.
  • Decompose it into sub-problems
  • First ideas are NEVER the best ones.
  • House Example
  • subproblem 1 compute the area of a room
  • subproblem 2 add up area of all rooms

22
2. Implement
  • Translate your sets of rules into C language
    syntax (try not to garble it too much).
  • We will learn how by exploring
  • Variables, Types, Statements, Expressions,
    Assignments, Conditionals and control flow
    constructs, functions, and more.

23
2. ImplementCompiler Linker
  • C is a compiled language it is meant to be
    human-readable.
  • Compiler a converter program
  • human-readable ? machine-executable
  • Compile C text file(s) ? object file(s)
  • Linking object file(s) ? .executable file

24
3. Debug
  • Two Kinds of Programming Mistakes
  • Syntax Misteaks (easy to fix compiler helps)
  • Design Mistakes (harder you must THINK)
  • Computer Jargon
  • bugmistake
  • To debug to find and fix your mistakes

25
3.Debug Find Fix Mistakes
  • Write C ? Compile ? Run, repeat
  • Does it compile?
  • NO? compiler says why. Modify C, try again
  • YES. Does it work right?
  • NO? analyze, modify, try again.
  • YES. But does it ALWAYS work right?
  • (can you prove your analysis is robust?)

26
Conclusions
  • Lets Get Started! As soon as you can,
  • Read Chapter 1 of textbook
  • Find computer labs, log in, and
  • Visit website, look around
  • Visit newsgroup try test message
  • Start Up Visual C, read welcome info
  • Try Assignment 0 (on website)
  • Come to Lab Session on Friday in MG51

27
END
  • END

28
What is input and output?
  • Input/Output conversions between numbers
    ??meaningful things
  • Arm finger moves (mouse, joystick, keyboard)
  • Text, spelling, grammar, analogy, reasoning
  • Molecules, synapses, neural signalling, brains
  • Music, speech, noise, vibration, resonance
  • Image, picture, vision, sketch, light, shadow
  • Robotics, actuator movement, collision, routes
  • Fluid flow, compression, shock waves,
  • AND
  • Computer programming ideas??instructions

29
Dont PanicC Programming 8 Key Ideas
  • All brilliant ideas are simple FmA, be nice to
    people,etc.
  • Computer Science is new few great ideas (yet)
  • Example Programming 3 kinds of instructions
  • Do this list of steps
  • If (A is true) , do that list of steps
  • Do this list of steps again.
  • All the rest (entire book contents) are minor
    details, elaborations, and shortcuts to make
    things easier!
Write a Comment
User Comments (0)
About PowerShow.com