COMP 14 002 Intro to Computer Programming - PowerPoint PPT Presentation

1 / 29
About This Presentation
Title:

COMP 14 002 Intro to Computer Programming

Description:

It's never a good feeling to turn in something that doesn't work, but it's not ... Get me those signed honor code guidelines (turning them in now would be great, too) ... – PowerPoint PPT presentation

Number of Views:20
Avg rating:3.0/5.0
Slides: 30
Provided by: andream2
Category:

less

Transcript and Presenter's Notes

Title: COMP 14 002 Intro to Computer Programming


1
COMP 14 (002)Intro to Computer Programming
  • Instructor Todd Gamblin
  • MW 11-1215
  • F 11-1150
  • Peabody 218

2
About Me
  • 3rd year Ph.D. student, UNC Computer Science
  • Work with RENCI
  • Research interests
  • Supercomputing
  • Scalability
  • Really big computers
  • e.g. BlueGene, at left, is 132,000 computers put
    together

3
About Me Before UNC
  • Undergrad
  • Williams College
  • Double major
  • Computer Science, Japanese
  • Swam (200 Backstroke, 400 IM)
  • Worked for a year at a dot com
  • Small company in Tokyo
  • Java Programmer
  • Yeah, this was my job
  • Built interactive websites
  • Affiliate marketing (a.k.a. ads)
  • Web hosting (websites for building websites)

4
Why learn about computer science?
  • Computers are pervasive
  • Understanding programming will help you
    understand what they can and cannot do
  • Computers are important tools
  • You can write programs to solve large and/or
    tedious problems
  • Lots of things are programmable (e.g.
    spreadsheets)
  • Builds analytical problem-solving skills

5
About the course
  • This is a course on programming
  • Learn how to develop simple algorithms
  • Learn structured, object-oriented design
  • Is this course right for you?
  • Have you programmed before?
  • You should know how to download files and install
    programs
  • I assume no prior programming knowledge
  • Ask me about COMP 4 or COMP 14 if you have doubts

6
About the course
  • You need to be enrolled in this course
  • COMP 14 002
  • And this recitation
  • COMP 14 602
  • I put some of you in the right recitation myself.
    I think these are synched up now, but make sure!

7
Textbook
  • Java An Eventful Approach
  • By Bruce, Danyluk, Murtagh
  • Yeah, theyre all from Williams.
  • Theres just one text, despite what they tell you
    at the book store
  • Books were mislabeled
  • Hope you got the right one
  • Get it at UNC or Amazon

8
Software
  • Programs we write will be in Java
  • But you shouldnt focus on that
  • Concepts from Java can be used in lots of
    languages (C, C, Python, Perl, etc, etc)
  • Well be using IBMs Eclipse IDE
  • IDE Interactive Development Environment
  • This is a program for writing programs
  • Helps you write Java
  • This is what they use in the real world

9
Grades
  • 20 Programming Assignments
  • 40 Test Programs
  • 15 Midterm
  • 20 Final Exam
  • 5 class participation and effort
  • Im not taking attendance, but I will notice if
    you speak up

10
Format
  • Programming assignments are approximately weekly
  • Well start these in class
  • These will be the bulk of the work you do
  • These will also be where you learn the most
  • Best way to learn programming is practice
  • 2 Test programs
  • These are basically big weekly assignments
  • You do these all on your own
  • Midterm in class
  • Final after end of classes

11
Honor Code
  • I handed out a sheet of guidelines
  • Please sign this and get it back to me ASAP
  • You could even turn it in today
  • The Guidelines (abridged)
  • You can work with other people on weekly
    assignments
  • You cant copy code, but you can talk about how
    to do them
  • You cant work with anyone on test programs
  • You may use class materials (notes, text,
    previous assignments)
  • Exams should also be all your own work
  • These are in class, scheduled
  • No notes, books, etc.

12
Late Assignments
  • Assignments are due by 3am the night before the
    due date
  • Turn them in online
  • Date will be recorded
  • You can resubmit, but Ill take the latest date
  • Can turn in late for up to 24 hrs
  • After that, the assignment is considered failed
  • 15 late penalty

13
Course Webpage
  • http//wwwx.cs.unc.edu/tgamblin/comp14

14
Course Webpage
  • This is a Wiki!
  • Whats that?
  • You can edit and discuss course pages and
    assignments online
  • Please log in and make an account (well do this
    Friday)

15
Course Webpage
  • All assignments will be submitted on the Wiki

Then just select your homework and upload it!
First click here
Pretty simple, huh?
16
So whats computing about?
  • Used to be about numbers and performing
    calculations
  • That huge thing to the left is ENIAC
  • Electronic Numerical Integrator and Computer
  • Calculated ballistics trajectories during WWII
  • First fully programmable machine

17
So whats computing about?
  • These days, we need to manipulate all kinds of
    information
  • Numbers
  • Text
  • Images
  • Sound
  • How do you make a computer understand these
    things?

18
So whats computing about?
  • We need
  • Clever ways to represent information in a
    computer
  • Data structures
  • Well build some simple ones
  • Algorithms to manipulate them correctly and
    efficiently
  • Whats an algorithm?

19
Algorithms
  • Algorithm
  • A series of instructions to be followed to solve
    some problem
  • Think of a program as one type of algorithm
  • series of instructions in software that controls
    the operation of a machine
  • We want to design algorithms that are
  • Correct Does the right thing actually solves
    the problem
  • Efficient Solves the problem fast and doesnt
    use too many resources (e.g. too much memory)
  • Understandable Humans can read and understand
    easily

20
Algorithms
  • Designing good algorithms is difficult
  • Dont believe me?
  • Consider
  • How common bad instructions are
  • Ever been given the wrong directions?
  • Computers are really dumb
  • They do exactly what you say
  • They cant figure out what you actually meant,
    whereas people can

21
Algorithms
  • Lets try making an algorithm
  • Give me directions from here to Starbucks
  • Now give a robot the same directions
  • How are they different?
  • How detailed do they need to be?
  • Are your instructions the same every time?
  • What if theres construction?
  • What about traffic?
  • This can get pretty complicated

22
Writing good code
  • When you write a program, it should be readable
    by a human
  • Most real programs are constantly changing
  • Most likely, someone other than you will need to
    understand what your code does
  • Make it easy for them!
  • Part of your grade on coding assignments will be
    for clarity and elegance
  • More on this when we actually write code

23
Object-oriented programs
  • Programs we design will be object-oriented
  • Well model the world as objects
  • Objects you build will respond to messages
  • Suppose we wrote a program for the robot
  • Build an object to represent the robot
  • Design it so we can tell this object to walk,
    turn right, turn left, back up, stop
  • Might even get more specific
  • Robot object can be made of others
  • Arm object, leg object, head object, body object
  • Can send them messages
  • Tell leg to lift
  • Tell leg to move forward
  • Tell leg to lower

24
Events
  • Some of the programs we write will be
    event-driven
  • Respond to events
  • E.g. When the mouse clicks, do this
  • Mouse click is the event
  • do this is the action to take
  • Robot might generate events
  • E.g. Im out of battery!
  • Battery exhaustion is the event
  • We could write a program that responds to this
    event by telling the robot to go recharge himself
  • Model Were notified of an event, and we write a
    program that describes how to respond

25
Concurrency
  • Events in our programs can happen at the same
    time
  • The mouse might be clicked and a key might be
    pressed at the same time
  • The actions that respond to these events will
    occur at the same time
  • Programming is moving more and more towards this
    mode of thinking!
  • Remember my research? Those big computers can
    and do have 132,000 things going on at the same
    time
  • Your computers can browse the web, play music,
    and check email all at once.
  • For this course, well stick to very simple
    concurrency
  • Our concurrent tasks wont interact w/each other

26
Some advice
  • Writing programs can take some time
  • Youll need to test things to make sure they work
  • Youll know if things arent working
  • This can be really maddening
  • Start assignments early!
  • There will almost always be bugs in code you
    write
  • Its never a good feeling to turn in something
    that doesnt work, but its not the end of the
    world
  • Turning in partially working code is always
    better than cheating

27
How to get help
  • Talk to me after class, during office hours, or
    by appointment
  • Office hours are TBA, will be posted on website
  • Will be held in Sitterson 312 (thats just across
    the parking lot)
  • Email me
  • tgamblin_at_cs.unc.edu
  • Call me at 919 360 8283

28
Feedback
  • Email me with questions or comments on the course
    (tgamblin_at_cs.unc.edu)
  • Use the webpage!
  • Every assignment has a discussion section
  • You can post comments and questions there, and
    Ill try to respond.
  • Your classmates can, too, if I dont get to it
    before they do.

29
Questions?
  • Homework
  • Assignment 0 has been posted
  • Read it, do it, and turn in the written part via
    the webpage
  • Get me those signed honor code guidelines
    (turning them in now would be great, too)
  • This Friday Recitation
  • Bring your laptops
  • Well do most of Assignment 0
  • Well download Java and Eclipse (if you didnt
    yet)
  • Register on the Wiki
  • Well talk about how to use Eclipse and maybe
    write some really simple programs
Write a Comment
User Comments (0)
About PowerShow.com