You are on page 1of 19

CMP 131

Introduction to Computer
Programming
Violetta Cavalli-Sforza
Week 1, Lecture 1

26-February-2007 CMP 131 Introduction to Computers and Programming 1


Course Description
• Introduction to algorithms and
programming
– What is an algorithm?
– What is programming?
• Programming philosophy
– How to think of a programming problem
– How to plan the solution to the problem
• Problem decomposition
• Top-down refinement

26-February-2007 CMP 131 Introduction to Computers and Programming 2


Course Description (2)
• Using an interactive development
environment (IDE)
• Types of programming errors
– Syntactic
– Semantic
• Using a structured programming language
(Pascal)
– What is a programming language?
– What is a structured programming language?
26-February-2007 CMP 131 Introduction to Computers and Programming 3
Course Description (3)
• Main language concepts covered:
– Simple data types
• Numbers (integer, real)
• Boolean
• Characters
• Strings
(NOT structured/complex data types)
– Input / output statements
– Basic statements (assignment, conditionals,
iteration/looping)
26-February-2007 CMP 131 Introduction to Computers and Programming 4
Course Objectives
• Understand basic components in a
computer architecture
• Appreciate the role of programming
languages
• Design a top-down solution for solving
problems
• Be familiar with an IDE
• Edit, compile, debug and run short
programs
26-February-2007 CMP 131 Introduction to Computers and Programming 5
Logistics
• Detailed description
– Will have to wait a little bit because …
– I will post it on the web, as well as
assignments, etc.
• Class meetings (each week):
– Mon,Wed: lectures (1.5 hours each)
– Thu: lab (1.5 hours)

26-February-2007 CMP 131 Introduction to Computers and Programming 6


Assessments
• Exams (50%)
– midterm (7th week) – 20%
– final (end of course) – 30%
• Quizzes (30%)
– measure progress
– every 2 weeks
• Homework (10%) … will say more
• Participation (10%)
– attendance
– will I remember who you are?

26-February-2007 CMP 131 Introduction to Computers and Programming 7


Homework
• Initially not programming, but thinking
about programs
• Small programs, 1 or more, depending on
the complexity
• Frequently assigned (each week)
– Like a language, you need frequent practice
• Do not wait until the last moment to work
on your program
26-February-2007 CMP 131 Introduction to Computers and Programming 8
Homework
• Expect (esp. true of programming HW):
– I will assign homework on Monday
– I will take questions on it on Wednesday
– I will help you out on Thursday during lab
– You will submit it by mail on Friday
– I will discuss briefly on following Monday

26-February-2007 CMP 131 Introduction to Computers and Programming 9


Computers

26-February-2007 CMP 131 Introduction to Computers and Programming 10


What is a computer?
• Computer
– one that computes (Webster’s dictionary)
– In other languages:
• French: ordinateur (from “order”)
• Italian: cervello elettronico (“electronic brain”)
• Other?
• Computer: a programmable device that
can store, retrieve and process data.

26-February-2007 CMP 131 Introduction to Computers and Programming 11


What’s in a Computer?
• Hardware:
– The actual physical machine
– Consists of several hardware devices
• Software:
– The programs that tell the machine what to
do, i.e. give instructions to the machine
– Different types of programs written in
different languages

26-February-2007 CMP 131 Introduction to Computers and Programming 12


Hardware Devices
• Input:
– Keyboard
– Mouse, Touchpad, Joystick
– Pen & tablet, Perforated cards
• Output:
– Printer
– Screen (monitor)
– Teletype
• Input & Output:
– Auxiliary Devices:
• disks (hard disk, floppies, DVDs/CDs, USB keys, Flash memories)
• tape drives
– Touch screen
– Network cards (intranet, internet)
26-February-2007 CMP 131 Introduction to Computers and Programming 13
Hardware Devices (2)
• Memory
– Permanent: Disks & other I/O devices
– Volatile: Main memory, Graphic memories
– Virtual
Main memory is like a very large set of
mailboxes, each with its own address.
It stores data encoded as binary numbers.

26-February-2007 CMP 131 Introduction to Computers and Programming 14


Hardware Devices (3)
• Central Processing Unit(s)
– One or more
– A CPU contains
• Arithmetic Logic Unit (ALU)
• A Control Unit: controls the actions of other components
– Special Floating Point processors
• The CPU controls just about everything else by
executing instructions
– stores data in memory
– retrieves data from memory
– performs computations
– sends and gets data from other devices

26-February-2007 CMP 131 Introduction to Computers and Programming 15


Hardware Devices (3)
• Bus: A group of wires through which
the other devices communicate.

I/O devices are controlled by drivers,


which are very specialized kinds of
programs

26-February-2007 CMP 131 Introduction to Computers and Programming 16


Computers through Time
• Vacuum tubes
• Mainframe computers (IBM)
• Mini computers (DEC)
• Micro computers (IBM, NEC, MacIntosh)
– Desktops
– Laptops
– Blackberry
• Supercomputers
26-February-2007 CMP 131 Introduction to Computers and Programming 17
Hardware Trends
• Every year or two computer power
approximately doubles
– Memory size (RAM)
• Memory used to execute programs
– Secondary storage (permanent storage)
• E.g. disk storage, used to to hold programs and
data over time
– Processor speeds
• Speed at which computers execute their programs

26-February-2007 CMP 131 Introduction to Computers and Programming 18


Hardware/Software Trends
• Applications:
– Rapidly increasing hardware power allows
applications to get bigger and more complex
• Costs
– Hardware costs dropping
– Software development costs rising
• Software development complexity
• Programmer salaries
• Cost of slipping schedules
– Unanticipated interactions in complex systems
– Unpredictability of software development times
26-February-2007 CMP 131 Introduction to Computers and Programming 19

You might also like