welcome to comp 40! noah mendelsohn tufts university email: [email protected]@cs.tufts.edu web:...

33
© 2010 Noah Mendelsohn

Upload: vivien-mills

Post on 25-Dec-2015

219 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Welcome to COMP 40! Noah Mendelsohn Tufts University Email: noah@cs.tufts.edunoah@cs.tufts.edu Web: noah COMP 40: Machine Structure
Page 2: Welcome to COMP 40! Noah Mendelsohn Tufts University Email: noah@cs.tufts.edunoah@cs.tufts.edu Web: noah COMP 40: Machine Structure

Welcome to COMP 40!

Noah MendelsohnTufts UniversityEmail: [email protected]: http://www.cs.tufts.edu/~noah

COMP 40: Machine Structure and

Assembly Language Programming (Fall 2014)

Page 3: Welcome to COMP 40! Noah Mendelsohn Tufts University Email: noah@cs.tufts.edunoah@cs.tufts.edu Web: noah COMP 40: Machine Structure

© 2010 Noah Mendelsohn

Course Introduction

Page 4: Welcome to COMP 40! Noah Mendelsohn Tufts University Email: noah@cs.tufts.edunoah@cs.tufts.edu Web: noah COMP 40: Machine Structure

© 2010 Noah Mendelsohn

COMP 40 Themes

Learn how computers work

Turn the corner toward being truly professional programmers

Page 5: Welcome to COMP 40! Noah Mendelsohn Tufts University Email: noah@cs.tufts.edunoah@cs.tufts.edu Web: noah COMP 40: Machine Structure

© 2010 Noah Mendelsohn

How we’ll do it

5

Ramp up your Programming Skills

Big programs that teach you abstraction, pointers, locality,

machine representations of data

Building a Language Processor on your Emulator

Emulating your own hardware in software

Intel Assembler ProgrammingThe Bomb!

Building Useful Applications in your Language

Page 6: Welcome to COMP 40! Noah Mendelsohn Tufts University Email: noah@cs.tufts.edunoah@cs.tufts.edu Web: noah COMP 40: Machine Structure

© 2010 Noah Mendelsohn

Important topics for the term

Abstraction

How machines work

What is a bit?

How languages and runtimes use the machine

The skills and mindset of a great programmer

6

Page 7: Welcome to COMP 40! Noah Mendelsohn Tufts University Email: noah@cs.tufts.edunoah@cs.tufts.edu Web: noah COMP 40: Machine Structure

© 2010 Noah Mendelsohn

How we’ll do it

7

Ramp up your Programming Skills

Big programs that teach you abstraction, pointers, locality,

machine representations of data

Building a Language Processor on your Emulator

Emulating your own hardware in software

Intel Assembler ProgrammingThe Bomb!

Building Useful Applications in your Language

First assignment:1)Programming skills2)Hanson interfaces: practice

in abstraction3)Models of how abstract

types are implemented4)void * practice

Page 8: Welcome to COMP 40! Noah Mendelsohn Tufts University Email: noah@cs.tufts.edunoah@cs.tufts.edu Web: noah COMP 40: Machine Structure

© 2010 Noah Mendelsohn

How we’ll do it

8

Ramp up your Programming Skills

Big programs that teach you abstraction, pointers, locality,

machine representations of data

Building a Language Processor on your Emulator

Emulating your own hardware in software

Intel Assembler ProgrammingThe Bomb!

Building Useful Applications in your Language

Next three assignments:1)How data is represented2)How languages and libraries

use the machine3)Locality

Page 9: Welcome to COMP 40! Noah Mendelsohn Tufts University Email: noah@cs.tufts.edunoah@cs.tufts.edu Web: noah COMP 40: Machine Structure

© 2010 Noah Mendelsohn

How we’ll do it

9

Ramp up your Programming Skills

Big programs that teach you abstraction, pointers, locality,

machine representations of data

Building a Language Processor on your Emulator

Emulating your own hardware in software

Intel Assembler ProgrammingThe Bomb!

Building Useful Applications in your Language

Assembler programming on popular machine

Page 10: Welcome to COMP 40! Noah Mendelsohn Tufts University Email: noah@cs.tufts.edunoah@cs.tufts.edu Web: noah COMP 40: Machine Structure

© 2010 Noah Mendelsohn

How we’ll do it

10

Ramp up your Programming Skills

Big programs that teach you abstraction, pointers, locality,

machine representations of data

Building a Language Processor on your Emulator

Emulating your own hardware in software

Intel Assembler ProgrammingThe Bomb!

Building Useful Applications in your Language

How machines run internally

Page 11: Welcome to COMP 40! Noah Mendelsohn Tufts University Email: noah@cs.tufts.edunoah@cs.tufts.edu Web: noah COMP 40: Machine Structure

© 2010 Noah Mendelsohn

How we’ll do it

11

Ramp up your Programming Skills

Big programs that teach you abstraction, pointers, locality,

machine representations of data

Building a Language Processor on your Emulator

Emulating your own hardware in software

Intel Assembler ProgrammingThe Bomb!

Building Useful Applications in your Language

Build your own versions of the tools you’ve been using

Page 12: Welcome to COMP 40! Noah Mendelsohn Tufts University Email: noah@cs.tufts.edunoah@cs.tufts.edu Web: noah COMP 40: Machine Structure

© 2010 Noah Mendelsohn

How we’ll do it

12

Ramp up your Programming Skills

Big programs that teach you abstraction, pointers, locality,

machine representations of data

Building a Language Processor on your Emulator

Emulating your own hardware in software

Intel Assembler ProgrammingThe Bomb!

Building Useful Applications in your Language

Use what you built!

Page 13: Welcome to COMP 40! Noah Mendelsohn Tufts University Email: noah@cs.tufts.edunoah@cs.tufts.edu Web: noah COMP 40: Machine Structure

© 2010 Noah Mendelsohn

How we’ll do it

13

Ramp up your Programming Skills

Big programs that teach you abstraction, pointers, locality,

machine representations of data

Building a Language Processor on your Emulator

Emulating your own hardware in software

Intel Assembler ProgrammingThe Bomb!

Building Useful Applications in your Language

ABSTRACTION!

Page 14: Welcome to COMP 40! Noah Mendelsohn Tufts University Email: noah@cs.tufts.edunoah@cs.tufts.edu Web: noah COMP 40: Machine Structure

© 2010 Noah Mendelsohn

How we’ll do it

14

Ramp up your Programming Skills

Big programs that teach you abstraction, pointers, locality,

machine representations of data

Building a Language Processor on your Emulator

Emulating your own hardware in software

Intel Assembler ProgrammingThe Bomb!

Building Useful Applications in your Language

Page 15: Welcome to COMP 40! Noah Mendelsohn Tufts University Email: noah@cs.tufts.edunoah@cs.tufts.edu Web: noah COMP 40: Machine Structure

© 2010 Noah Mendelsohn

Becoming a great programmer

Design thoughtfully before you code– Writing down your design helps you think clearly about it and share it with

others

Your work is read by people as well as machines– Your code should be beautiful and easy to understand

– Prose (English) documentation is as important as your code!

Testing is as important as design and coding

Successful programming requires– Patience, perseverance, good rest , humility, confidence

– Insight into good programming & testing techniques techniques

– Often: teamwork, etc., etc.

15

THESE ARE THINGS THAT TOP PROFESSIONAL PROGRAMMERS DO!

Page 16: Welcome to COMP 40! Noah Mendelsohn Tufts University Email: noah@cs.tufts.edunoah@cs.tufts.edu Web: noah COMP 40: Machine Structure

© 2010 Noah Mendelsohn

Key things to watch for throughout the term

Design thoughtfully before you code– Writing down your design helps you think clearly about it and share it with

others

Your work is read by people as well as machines– Your code should be beautiful and easy to understand

– Prose (English) documentation is as important as your code!

Testing is as important as design and coding

Successful programming requires– Patience, perseverance, good rest , humility, confidence

– Insight into good programming & testing techniques techniques

– Etc., etc.

16

THESE ARE THINGS THAT TOP PROFESSIONAL PROGRAMMERS DO!

HELPING YOU DEVELOP THESE SKILLS IS A KEY

GOAL OF COMP 40

Page 17: Welcome to COMP 40! Noah Mendelsohn Tufts University Email: noah@cs.tufts.edunoah@cs.tufts.edu Web: noah COMP 40: Machine Structure

© 2010 Noah Mendelsohn

Credits

This version of COMP 40 was originally developed by Prof. Norman Ramsey

Many of the materials and all the assignments trace to him

Updates have been made by Noah Daniels, Mark Sheldon, and Noah Mendelsohn

17

Page 18: Welcome to COMP 40! Noah Mendelsohn Tufts University Email: noah@cs.tufts.edunoah@cs.tufts.edu Web: noah COMP 40: Machine Structure

© 2010 Noah Mendelsohn

Logistics

Page 19: Welcome to COMP 40! Noah Mendelsohn Tufts University Email: noah@cs.tufts.edunoah@cs.tufts.edu Web: noah COMP 40: Machine Structure

© 2010 Noah Mendelsohn

Course staff

Professor:– Noah Mendelsohn

– Emails: [email protected]

– Office hours: Tues/Thurs 3:15 – 4:45 Halligan 214 (or in labs)

Graduate TAs– Sean Butze, Sam Hincks, Raoul Veroy

– Email: [email protected]

Undergraduate Tas– Too many to list: all COMP 40 experts – times on Piazza; find them in the labs!

– Email: [email protected]

19

BTW: I prefer you call me Noah, but Prof. Mendelsohn is fine too.

Page 20: Welcome to COMP 40! Noah Mendelsohn Tufts University Email: noah@cs.tufts.edunoah@cs.tufts.edu Web: noah COMP 40: Machine Structure

© 2010 Noah Mendelsohn

What you must do right now!

Make sure you have a partner for assignment 1

Read course: home page, admin & policies including collaboration policy, pair programming rules, coding standards

Immediately: start reading the HW1 handout and readings from course calendar especially those from Hanson’s book

Sign up for Piazza:– We mostly won’t email announcements – just post there

Come to lab on Friday with your partner – switch labs if necessary

If you want to add the course, come up after class and start work this week while we figure out of we can add you!

20

Page 21: Welcome to COMP 40! Noah Mendelsohn Tufts University Email: noah@cs.tufts.edunoah@cs.tufts.edu Web: noah COMP 40: Machine Structure

© 2010 Noah Mendelsohn

Homework 1 is out now

Instructions at http://www.cs.tufts.edu/comp/40/homework/intro

Also linked from course calendar

Due dates:– Design document: Submit by Monday Sept 8th

– Final submission with code: Thusday Sept 11th

Be sure to understand course policy on late submissions: up to 2 tokens/assignment, 6 total for term. No credit if > 2 days late! (note: in past semesters, limit was 5 total for term)

See admin page for policies on serious illness, etc.

21

Page 22: Welcome to COMP 40! Noah Mendelsohn Tufts University Email: noah@cs.tufts.edunoah@cs.tufts.edu Web: noah COMP 40: Machine Structure

© 2010 Noah Mendelsohn

Pair programming

You must work with a partner – rare exceptions

Both of you must be together when design, documentation, or coding is done!

You must never split the work

After the first assignment you choose your own partner – max 3 assignments with same partner

Be sure to understand and follow all pair programming rules at: http://www.cs.tufts.edu/comp/40/admin#pairprogramming

22

Page 23: Welcome to COMP 40! Noah Mendelsohn Tufts University Email: noah@cs.tufts.edunoah@cs.tufts.edu Web: noah COMP 40: Machine Structure

© 2010 Noah Mendelsohn

Labs

Required – attend with your partner

You can switch from morning to afternoon if http://www.cs.tufts.edu/~molay/lab40 says there’s space

Many labs are designed to give you essential help completing your big projects!

23

Page 24: Welcome to COMP 40! Noah Mendelsohn Tufts University Email: noah@cs.tufts.edunoah@cs.tufts.edu Web: noah COMP 40: Machine Structure

© 2010 Noah Mendelsohn

A few more thoughts

This course is intense

Most students report it is very worthwhile

Grading can be severe on individual assignments but…

…most students do very well in the end

We are here to help you succeed!

Relax…work hard…be patient…have fun!

24

Page 25: Welcome to COMP 40! Noah Mendelsohn Tufts University Email: noah@cs.tufts.edunoah@cs.tufts.edu Web: noah COMP 40: Machine Structure

© 2010 Noah Mendelsohn

Design Documents

Page 26: Welcome to COMP 40! Noah Mendelsohn Tufts University Email: noah@cs.tufts.edunoah@cs.tufts.edu Web: noah COMP 40: Machine Structure

© 2010 Noah Mendelsohn

Why write down your designs?

Forces you to think clearly and make deliberate choices

Changing a written design is (usually) easier than changing code– Your first design will probably not be a good one!

– Keep refining until the design feels right

Your code is more useful if other people can understand it

On real programming projects, designs are debated before code is written!

26

Page 27: Welcome to COMP 40! Noah Mendelsohn Tufts University Email: noah@cs.tufts.edunoah@cs.tufts.edu Web: noah COMP 40: Machine Structure

© 2010 Noah Mendelsohn

COMP 40 Design Documents

Three layers documented in separate sections– Architecture: the big picture

– Interfaces: how pieces communicate…what they hide from each other!

– Implementation: how the pieces are built

Invariants– Important concept in computing

– Structural invariants & loop invariants

– We’ll discuss invariants in the next lecture

COMP 40: special documentation for ADTs (to be discussed)

27

Important information about writing Design Documents canbe found from the “References” tab of the COMP 40 Website:

http://www.cs.tufts.edu/comp/40/reference/

Page 28: Welcome to COMP 40! Noah Mendelsohn Tufts University Email: noah@cs.tufts.edunoah@cs.tufts.edu Web: noah COMP 40: Machine Structure

© 2010 Noah Mendelsohn

COMP 40 Design Documents

Three layers documented in separate sections– Architecture: the big picture

– Interfaces: how pieces communicate…what they hide from each other!

– Implementation: how the pieces are built

Invariants– Important concept in computing

– Structural invariants & loop invariants

– We’ll discuss invariants in the next lecture

COMP 40: special documentation for ADTs (to be discussed)

28

Important information about writing Design Documents canbe found from the “References” tab of the COMP 40 Website:

http://www.cs.tufts.edu/comp/40/reference/

For HW#1 (Intro)You will submit a simplified design document that just explains your

data structures.

See the handout for information about what’s required.

Page 29: Welcome to COMP 40! Noah Mendelsohn Tufts University Email: noah@cs.tufts.edunoah@cs.tufts.edu Web: noah COMP 40: Machine Structure

© 2010 Noah Mendelsohn

Getting Help

Page 30: Welcome to COMP 40! Noah Mendelsohn Tufts University Email: noah@cs.tufts.edunoah@cs.tufts.edu Web: noah COMP 40: Machine Structure

© 2010 Noah Mendelsohn

Where to get help

Piazza!– We much prefer you ask questions there

– You must not share your own code or test cases with other students: mark those questions “instructor only”

– We prefer you not be anonymous…but it’s your choice

TAs: in labs most days and evenings– Schedule will be kept on Piazza page

Office hours: see my home page

Online sources– man pages, Google, Stack Overflow

30

Page 31: Welcome to COMP 40! Noah Mendelsohn Tufts University Email: noah@cs.tufts.edunoah@cs.tufts.edu Web: noah COMP 40: Machine Structure

© 2010 Noah Mendelsohn31

“If you give a man a fish he is hungry again in an hour. If you teach him to catch a fish you do him a good turn”

Anne Isabella Thackeray Ritchie

Page 32: Welcome to COMP 40! Noah Mendelsohn Tufts University Email: noah@cs.tufts.edunoah@cs.tufts.edu Web: noah COMP 40: Machine Structure

© 2010 Noah Mendelsohn32

In COMP 40, we will sometimes decline to give you fish, but we will always help you learn to fish.

Noah M.

Page 33: Welcome to COMP 40! Noah Mendelsohn Tufts University Email: noah@cs.tufts.edunoah@cs.tufts.edu Web: noah COMP 40: Machine Structure

© 2010 Noah Mendelsohn33

But…just this once since we’re hitting you with a lot at once…

…I’ll give you a few fish!