tutorial 00 resources and course review. a00q4.rkt (define my-tutorial-info (list ………))

19
TUTORIAL 00 Resources and Course Review

Upload: dennis-page

Post on 12-Jan-2016

216 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: TUTORIAL 00 Resources and Course Review. a00q4.rkt (define my-tutorial-info (list ………))

TUTORIAL 00

Resources and Course Review

Page 2: TUTORIAL 00 Resources and Course Review. a00q4.rkt (define my-tutorial-info (list ………))

a00q4.rkt

(define my-tutorial-info (list ………))

Page 3: TUTORIAL 00 Resources and Course Review. a00q4.rkt (define my-tutorial-info (list ………))

MarkUs

Found under Assignments -> MarkUs

Do NOT use Internet Explorer (it does not work)

Ensure the filenames match the given filenames

E.g. “a00q4.rkt”, NOT “aOOq4.rkt”

Submit EARLY and OFTEN, NOT at the last minute

More information on the course website if you need more help

Page 4: TUTORIAL 00 Resources and Course Review. a00q4.rkt (define my-tutorial-info (list ………))

Piazza

Discussion forum to ask questions and clarifications about assignments and course materials

All announcements about the course will be posted on Piazza instead of course website.

Activate your account by following the link sent to your UW email address

Page 5: TUTORIAL 00 Resources and Course Review. a00q4.rkt (define my-tutorial-info (list ………))

Removing Email Messages

1. Top-right corner

2. Account/Email Settings

3. Scroll down to Class & Email Settings

4. Click “No Emails” for both options

5. Save Settings

Page 6: TUTORIAL 00 Resources and Course Review. a00q4.rkt (define my-tutorial-info (list ………))

Piazza Tips

Do NOT post any code related to

assignment questions

Do NOT post questions asking for someone to debug your code:

E.g. “I get <some random error message> when I run my program. Why is this happening?”

Page 7: TUTORIAL 00 Resources and Course Review. a00q4.rkt (define my-tutorial-info (list ………))

Read assignment CAREFULLY before posting on Piazza. Your question may have already been answered

Use Piazza search function to avoid repeated questions

Use meaningful

names when posting

new topic

e.g. “Values consumed

for a01q3”, NOT “a01q3”

Page 8: TUTORIAL 00 Resources and Course Review. a00q4.rkt (define my-tutorial-info (list ………))

Design Recipe Review

Page 9: TUTORIAL 00 Resources and Course Review. a00q4.rkt (define my-tutorial-info (list ………))

Purpose

;; (fn-name p1 p2 … pn) produces_____

Briefly describe what your function does

i.e how it uses the consumed values to produce the produced values

Mention the names of your parameters

Do NOT copy and paste from the assignment question. We WILL deduct marks!

Page 10: TUTORIAL 00 Resources and Course Review. a00q4.rkt (define my-tutorial-info (list ………))

Contracts - Overview

;; fn-name: Type1 Type2… Typen-> Produced_Value

Capitalize the first letter of each data type

Be specific:

Between Int, Num, Nat

Add requirements as needed: nonempty, >, <, >=, <=, >=len, etc - be sure to mention parameter (by name) that the requirement applies to

Page 11: TUTORIAL 00 Resources and Course Review. a00q4.rkt (define my-tutorial-info (list ………))

If data definitions are given, use them!

E.g. structures, lists etc.

;; A JOB is a list (list Str Sym Nat), ;; requires:;; the first list value is the job title, ;; and it must be nonempty;; the second list is the place of work;; the third list item is the number of hours ;; worked per week

;; fn-name: Type1 Job… -> Produced_Value

Page 12: TUTORIAL 00 Resources and Course Review. a00q4.rkt (define my-tutorial-info (list ………))

Iclicker Question(define-struct module (lines test));; A Module is a (make-module Nat Nat)Program is list of Module.(create pa b)consumes a Program pa, and a non-negative number b, it produces true if the total number of lines and tests exceed b. Otherwise, it produces false.Which one of the following expression for contract is correct?

A. Nat Nat -> BoolB. Program Nat -> BoolC. (listof Module) Nat => BoolD. Two of above is correct

Page 13: TUTORIAL 00 Resources and Course Review. a00q4.rkt (define my-tutorial-info (list ………))

Contracts - Common Mistakes

Improper type names - check the Style Guide

e.g. Use Str, NOT string

Capitalization - e.g. Use Num, not num

Incorrect types

No restrictions

Wrong number of parameters

Use ->, NOT =>

Page 14: TUTORIAL 00 Resources and Course Review. a00q4.rkt (define my-tutorial-info (list ………))

Examples

;; Examples:(check-expect (fn-name p1 p2 … pn) expected_output)

Always include at LEAST 2 examples for recursive data:

Base case

Non-base case

Page 15: TUTORIAL 00 Resources and Course Review. a00q4.rkt (define my-tutorial-info (list ………))

Tests;; Description of test (i.e. what are you testing?)(check-expect (fn-name p1 p2 … pn) expected_output)

Include ALL base cases and some non-base case tests

Include a test for every COND case

Be careful of nonempty list requirements – Don’t include an empty case

Examples do not need to be repeated in your Racket tests

Page 16: TUTORIAL 00 Resources and Course Review. a00q4.rkt (define my-tutorial-info (list ………))

Style MistakesWhitespace:

Lines too longNo spacing between functions (too cluttered)

Use meaningful names for helper, parameters, constants etc.

E.g. total-amt, not x

Simplify code as much as possible!Use helper functions for repeated code

Page 17: TUTORIAL 00 Resources and Course Review. a00q4.rkt (define my-tutorial-info (list ………))

Tips

Check Piazza daily for any announcements

READ assignment carefully for any restrictions

E.g. no reverse, use local only, etc.

Check post on Piazza for allowable functions

Check public tests to see if your code works

WARNING: This is NOT a thorough testing of your code

Page 18: TUTORIAL 00 Resources and Course Review. a00q4.rkt (define my-tutorial-info (list ………))

Do NOT copy and paste anything directly from the pdf file.

Get help:

Instructor and ISA’s office hours

Set an appointment with us by email if the times don’t work:

[email protected]

Be careful of cheating!NEVER show any student your code

Discuss verbally without taking notes

Penalty for cheating is 0 on that assignment and -5% on your final grade, and possibly further disciplinary action

Page 19: TUTORIAL 00 Resources and Course Review. a00q4.rkt (define my-tutorial-info (list ………))

Good Luck!

Questions?