Chapter 1 Introduction to Java - NYU Computer Science Department

Introduction to Computers and Programming
Using Python -- Fall, 2009
Professor Deena Engel
V22.0002: Section 1
Class Hours:
Tuesdays and Thursdays, 11:00-12:15 CIWW, Room 109
Email: deena@cs.nyu.edu
Office hours: Mondays 11:00-12:30; Thursdays 2:00-3:30 … and by
appointment … Room 422, WWH
Course Objectives

Upon completing the course, you will understand
 python programming







Designing programs
Decision and repetition structures
Functions
Strings, Lists, Arrays
Working with data files
Introduction to GUI programming
Introduction to scripting on the web
Course Objectives, cont.

You will be able to





Write and run PYTHON programs.
Create and use functions
Develop Python scripts
Write interesting projects
Establish a firm foundation on programming concepts
Course Text Book





Starting Out With Python, First Edition, by Tony Gaddis; Pearson /
Addison-Wesley
Available at the NYU Bookstore
There is a CD that comes with the book which includes all of the programs
that are in the book as well as Python software for Windows. (Mac users
already have Python within the Mac OS!)
Appendix A (Installing Python for Windows Users) and Appendix B
(Introduction to Idle for all users) are at the back of the book.
Please keep up with the reading! I will post readings both in the primary
textbook and in additional readings available on-line from the Bobst Safari
library.
Book Chapters to be covered in this class:

Chapter 1 Introduction to Computers and Programming

Chapter 2 Input, Processing, and Output

Chapter 3 Simple Functions

Chapter 4 Decision Structures and Boolean Logic

Chapter 5 Repetition Structures

Chapter 6: Value-Returning Functions and Modules

Chapter 7: Files and Exceptions

Chapter 8: Working with Sequences: Strings and Lists
Additional topics, depending on time:



Chapter 11: Recursion
Chapter 12: GUI Programming
An introduction to using Python for writing scripts to
build Webpages
6
Course Prerequisites

Prerequisites:


Who should be taking this course:




students who want to switch to a computer science major
students who want to take a computer science minor or a computer
applications minor (http://cs.nyu.edu/web/Academic/Undergrad/minors.html)
students who are interested in programming
Who should NOT be taking this course:



No prior programming experience required (Really!!)
Students trying to get out of taking a math requirement.
This class may be more difficult than the math you are trying to avoid.
You must get a C or better in this class to take further computer
science classes as a major.
Administrative Matters
Course Web Site and Blackboard



The course web site is available at:
http://www.cs.nyu.edu/courses/fall09/V22.0002-001/index.html
The website contains the following information:
 Administrative information
 Course Syllabus
 Class notes: All of the programs which we study and write in class will be
posted to the class website.
 Class programs
 Instructions for installing and running Python on your own system
The following will be posted on Blackboard:
 Homework assignments and homeworks will be submitted on Blackboard
 Homework grades and graders’ comments (to protect confidentiality)
 Sample exams
Additional information on “BlackBoard”


In addition, the class email mailing list will be run from the
Blackboard site.
Please watch your email for class announcements during the
semester.
Software



For the course, we will be using Python (and Idle, which we
will discuss in class).
These programs are free and you can download and use them
for your home computer.
To download software for home use, follow information posted
on the course website.



If you are working on a Windows machine, you can use the software that
is included on a CD with the textbook.
If you prefer to use a Mac, Python is included within the Mac OS.
If you do not have your own computer, the computer labs on
campus have all of the software that you will need.
Grading

Your grade will be determined as follows:



Two Midterm exams (40%)
6-8 Homeworks (20%)
Final Exam (40%)
Homework
•Ten points will be deducted for each class day that a homework is late with a possible
maximum of 30 points being deducted.
•Homeworks will not be accepted after the third class following its due date without special
permission.
•For each assignment that you do not hand in within the time limit, your final grade will be
lowered by one letter grade ( i.e., if you are averaging a B+, but you have missed 2 home
works, your final grade will be B-).
•You will need to submit the program to “Blackboard” using your NYU Home Account ;
there are directions on the course home page.
•Be sure to save copies of your programs to removable media or your NYU “home”
account; computer crashes or lost programs are not valid excuses for not handing in an
assignment!
A Word About Cheating


For the purposes of this class, cheating is defined as:
 Copying all or part of another student's homework, project or exam.
 Allowing another student to copy all or part of your homework, project, or
exam.
 Discussing homework concepts is fine, but you must submit your own
work
 However … You are welcome to work with a partner. If you work with a
partner, you must both let me and the grader know when your homework
is submitted that you worked together and also write that into the
comments in both texts of the program comments. We will discuss this in
class!
If you are caught cheating, you will receive an immediate FAILURE for the
course.
Student Civility

In an effort to make this class enjoyable for
everybody…


Please be on time to class!
Please do not talk to your friends and neighbors in class!



It disturbs everyone, and makes it hard to concentrate.
If you have a question, just ask me!
Please turn your pagers and cell-phones off!
Getting Help: very important!!
Whenever you have a question about the course material …please feel
free to drop by during my office hours or write me an email message or
call me on the phone.
If at any time you feel that you are falling behind or are overwhelmed by
the material, please let me know and I will be very happy to help you!
Help is always available!




Option1: Come to my Office Hours
 Hours Mondays 11:00-12:30; Thursdays 2:00-3:30 and by appointment
 Location: Room 422 Warren Weaver Hall
 If you cannot make my office hours, I will be happy to make an appointment with
you at another time.
Option 2: Write to me at deena@cs.nyu.edu
Option 3: Call me at 212-998-3131
Option 4: We will have tutors available in the lab and available by email to help you
with your work
17
Basic Computing information and history
What is a Computer?

Computer



Hardware



Device capable of performing computations and making logical
decisions
Computers process data under the control of sets of instructions
called computer programs
Various devices comprising a computer
Keyboard, screen, mouse, disks, memory, CD-ROM, and
processing units
Software

Programs that run on a computer
Hardware Trends

Every year or two the following approximately double:


Amount of memory in which to execute programs
Amount of secondary storage (such as disk storage)


Used to hold programs and data over the longer term
Processor speeds

The speeds at which computers execute their programs
Personal Computers

Personal computers




Distributed computing


Economical enough for individual
Popularized by Steve Jobs and Steve Wozniak with the introduction of
the Apple in 1977.
In 1981 IBM introduced the IBM personal computer using “off the shelf”
components.
Computing distributed over networks
Client/server computing

Sharing of information across computer networks between file servers
and clients (personal computers)
Programming languages
Three types of programming languages
 Machine languages


Strings of numbers giving machine specific instructions
Example:
+1300042774
+1400593419
+1200274027

Assembly languages

English-like abbreviations representing elementary computer operations (translated
via assemblers)


Example:
LOAD
ADD
STORE
BASEPAY
OVERPAY
GROSSPAY
High-level languages



Codes similar to everyday English
Use mathematical notations (translated via compilers)
Example:
grossPay = basePay + overTimePay
High-level Languages

Early high-level languages – See Table 1-1 on page 17 of your
textbook

FORTRAN


COBOL


Used to manipulate large amounts of data; created in the 1950s
Pascal


Used for scientific and engineering applications
Intended for academic use; created in 1970
Ada

Used in Defense Department Applications
High-level Languages

Current high-level languages – See Table 1-1 on page 17 of your
textbook

Java – created by Sun Microsystems in the early 1990s


Javascript


Not related to Java; used for building interactive webpages
Visual Basic


Used for single-user, network, and Internet applications
Developed in the early 1990s for Windows applications
Ruby

Developed in the 1990s; popular language for applications on web
servers
24
Structured Programming

Structured programming



Disciplined approach to writing programs
Clear, easy to test and debug and easy to modify
Structured programming is hard and takes time to master
The Key Software Trend:
Object Technology

Objects


Reusable software components that model items in the real world
Meaningful software units



Date objects, time objects, paycheck objects, invoice objects, audio
objects, video objects, file objects, record objects, etc.
Any noun can be represented as an object
More understandable, better organized, and easier to maintain than
procedural programming
Good luck! I look forward to working with you!!
Please see me if you have questions or comments
Deena Engel (mail to: deena@cs.nyu.edu or call at
212-998-3131)