Introduction to Computing and Programming - PowerPoint PPT Presentation

1 / 24
About This Presentation
Title:

Introduction to Computing and Programming

Description:

What is in a Traditional Computer? Secondary Memory: diskettes, ... a named storage area in the computer's memory that holds data required for the task! ... – PowerPoint PPT presentation

Number of Views:21
Avg rating:3.0/5.0
Slides: 25
Provided by: barbaraja
Category:

less

Transcript and Presenter's Notes

Title: Introduction to Computing and Programming


1
Introduction to Computingand Programming
Notes adapted from Introduction to Computing and
Programming with Java A Multimedia Approach by
M. Guzdial and B. Ericson, andinstructor
materials prepared by B. Ericson.
2
Learning Goals
  • Understand at a conceptual level
  • What is a computer?
  • What is in a traditional computer?
  • What is a program?
  • What is programming all about?
  • Why learn to program?

3
What is a Computer?
  • A device that performs high-speed mathematical
    and/or logical operations or that assembles,
    stores, correlates, or otherwise processes
    information.
  • The first computers were people
  • who did computations

4
What is a Computer?
  • By this standard, a lot of things can be
    considered to be computers as well.
  • Some devices are pretty old (like the abacus)
  • Others are brand new or are emerging on the
    horizon (like the DNA computer)

5
What is in a Traditional Computer?
  • Central Processing Unit (CPU) (also known as
    the processor)
  • Executes instructions.
  • Main Memory (also known as RAM)
  • Internal storage that holds the programs
    (instructions and data) currently being executed
    by the CPU.
  • Memory is made up of electronic on-off
    switches, each of which represents 0 or 1 and is
    called a bit (binary digit)
  • Main memory is volatile (information stored in it
    is not retained when power is discontinued).

6
What is in a Traditional Computer?
  • Secondary Memory diskettes, hard disks, CDs,
    DVDs, USB sticks
  • Provide long-term (persistent) storage for
    programs and other information.
  • Organized as files each of which has a file
    name and a folder or directorythat contains it.
  • Input/Output (I/O) units keyboard, mouse,
    screen, printer, webcam,
  • Used for communicating information from the user
    to the computer and the computer to the user.

7
What is in a Traditional Computer?
Memory
Output Devices
Input Devices
Central
Processing Unit
8
What is Programming?
  • Creating detailed instructions that a computer
    can execute to accomplish some task.
  • Like writing a recipe for your favorite dish
  • Or giving someone directions to your house
  • Or making a robot do what you want

9
What is Programming?
  • The end product of programming is, naturally, a
    program.
  • Programs consist of
  • Statements instructions to perform the task.
  • Data a collection of variables.
  • Variable a named storage area in the computers
    memory that holds data required for the task!

10
Early Programming
  • Early computers required the programmer to set
    switches and move wires
  • Which represented a series of 0s and 1s
  • Later computers were programmed using punched
    cards
  • Again, still a series of0s and 1s

11
Language Evolution
  • Early languages were based on how to do
    instructions on each different machine
  • 0s and 1s to add, subtract, read, store, etc.
  • Consequently, these languages were called
    machine languages
  • The (usually small) set of instructions that the
    computers CPU can execute directly.
  • Machine dependant the hardware designers
    decide on the machine language instruction set.
  • Difficult for programmers to use although the
    first computers were programmed only using
    machine language!
  • Example

000100111000010100100110101111001
12
Language Evolution
  • After this came assembly language
  • Introduced to make the programmers task easier.
  • Mnemonic representation of machine language.
  • Therefore, it is also machine dependent.
  • Assembly language program segment example
  • Need an assembler software that translates
    assembly language programs into machine language.
  • Recall for a computer to execute a program, it
    must be in the machine language for that type of
    computer.
  • One to one correspondence exists between assembly
    language instructions and machine language
    instructions.

LOAD R1, PRICELOAD R2, TAXADD R1, R2, R6STOR
R6, TOTAL
13
Language Evolution
  • Next came the high-level language
  • Created to help programmers more easily write
    correct programs that perform complicated tasks.
  • One to many correspondence exists between
    high-level language instructions and machine
    language instructions thus, high-level languages
    are said to be more powerful than assembly
    languages.
  • High-level language program segment example

if ((numberOfStudents) gt MAX_STUDENTS)
fullCourse true
14
Language Evolution
  • More on high-level languages
  • Need a compiler software that translates
    high-level language programs into machine
    language.
  • Machine-independent high-level languages are
    not designed with a particular type of computer
    in mind.
  • i.e. a program written in C can be executed on
    many different types of computers (e.g. PC,
    Macintosh) once we have a C compiler for that
    type of machine.
  • A couple of terms
  • Source code a program written in a high-level
    language (e.g. Java, C, Pascal).
  • Executable (or binary) code a program that has
    been translated (usually by an assembler or
    compiler) into machine language code.

15
Which Language?
  • High-level languages are eventually translated
    into machine language
  • You can write the same program in essentially any
    language
  • The computer doesnt care what high-level
    language you use, because it is eventually given
    the machine language
  • The language matters to the programmer
  • How easy is it to learn the language?
  • How long does it take to write the program?
  • How hard is it to change the program?
  • How long does it take to execute?

16
Java
  • A high-level language developed by Sun
    Microsystems in the early 1990s
  • Cross-platform, object-oriented language
  • Includes the advantages of previous programming
    languages while excluding many of the
    disadvantages hopefully!
  • Used in business, science, and education
  • One of the fastest adopted technologies of all
    time

17
Java
  • Java source code to machine language
  • Different from previous high-level languages.
  • Java is compiled but, not directly into machine
    language like its predecessors, rather into an
    intermediate language called Java bytecode.
  • Java bytecode is machine independent.
  • The Java interpreter (aka Java Virtual Machine)
    then translates and executes the bytecode on the
    computer, one bytecode instruction at a time.
  • Java compilers that compile down to machine
    language directly are available, but are not the
    norm.
  • Why does Java do it this way?
  • Portability create compiler once then create an
    interpreter for each machine. (An interpreter is
    easier to create than a compiler )

18
Why Dont We Just Use English?
  • English is good for communication between two
    intelligent humans
  • Even then we sometimes dont understand
  • Computers are very stupid
  • They basically know how to add, compare, store,
    and load
  • Programs are very detailed instructions
  • Everything must be precise and unambiguous

19
Programming Exercise
  • Write down instructions for how to make a
    sandwich
  • Have someone else read the directions and do the
    actions literally, precisely as they were written
  • stop anytime anything isnt clear and ask for
    clarification
  • It isnt that easy, is it?

20
Why Learn to Program?
  • Alan Perlis, first head of Carnegie Mellon's
    Computer Science Department, made the claim in
    1961 that computer science, and programming
    explicitly, should be part of a liberal education
  • Seymour Papert claimed in the 70s and 80s that
    learning to program is learning to think, and
    debug ones own thoughts.
  • If you learned to program, you learned to plan,
    to debug, to handle complexity, and so on.

21
Why Learn to Program?
  • The computer is the most amazingly creative
    device that humans have ever conceived of. If you
    can imagine it, you can make it real on a
    computer.
  • Computers will continue to have a major impact
    on modern life
  • Movies, games, business, healthcare, science,
    education, etc.

22
Computers are Commonplace
  • Computers, or at least processors, are in many
    common devices

23
Programming is Communicating
  • Alan Perlis, You think you know when you can
    learn, are more sure when you can write, even
    more when you can teach, but certain when you can
    program.

24
Summary
  • Computers are fairly simple machines
  • Fancy calculators with lots of storage
  • But incredibly fast
  • Computers have changed modern life
  • Programs are instructions to a computer to
    accomplish a task
  • Programs written in high-level languages must
    somehow be translated to machine language for
    execution
  • Programming can be tricky to learn
  • But there are some ways to make it easier
Write a Comment
User Comments (0)
About PowerShow.com