Wednesday, September 29, 2010

Daily, 2010/09/24-2010-09-29: closures and laziness

I got a bit behind this week, and being out of town on the weekend exacerbated the problem!  Here's three dailies in one, albeit short! 

Announcement items:
  • A#3 out; pairings due TOMORROW evening!
  • Reminder: the exam will be CLOSED BOOK but "open wiki appendix"
    • Appendix is up: edit it!
    • First 10 substantive edits: +1 BP!

  • A#3 out by tomorrow; pairings due by Thursday evening!
  • Important A#2 update: {- x y z} in example should have been {- {- x y} z}.
  • Reminder: the exam will be CLOSED BOOK but "open wiki appendix"
  • Vote on Dereck's office hours time (see Vista "assessments" area)
     
  • Wiki appendix or open-notes/text? WINNER IS APPENDIX
  • KEY midterm material today: closures (will make many practice Qs make more sense)
  • Vote on Dereck's office hours time (see Vista "assessments" area)
High-level comment:

We built and admired closures, detoured to the fascinating power of lazy languages, and then came back to implementing laziness.. only to discover that closures gave us everything we needed for laziness!

Meanwhile, I continue to minimize the new code I write in class, which is making it easier to get to the key ideas, although I still find myself running a minute or two over!  It's hard not to linger on interesting bugs we run into as we proceed.  I could certainly fix these more rapidly without discussing them, but each one is an opportunity to model debugging practice and to explore the semantics of programs.  Ah.. the temptation!

I'm wondering how you all are doing with respect to the instructional style, particularly since I've been doing fewer active learning exercises (and, probably consequently, getting less class participation).  So, it's about time I did a survey.  Maybe Friday or Monday..

Details:

Wednesday, September 22, 2010

With Considered Harmful (But Not OUR With)

I've been promising this post for a week already, but having trouble getting around to it.  So here's a short, sweet version.

Douglas Crockford has a fabulous discussion of how JavaScript's designers messed up on JS's with statement.   JS's with is much like our with, except naturally (but not sufficiently carefully!) extended to an OOP context. 

Daily, 2010/09/22: scope!

Announcement items:
  • A#1 feedback should have been mailed; A#1 grades on Vista (both raw and actual)
  • Go to next tutorial (and you should have gone to the last) or A#2 may be VERY HARD
  • Practice Midterm out on Vista
High-level comment:

We hit our second big design axis today: static vs. dynamic scope.  As with lazy vs. eager evaluation, we'll dive much deeper into this axis once functions are first-class, but we've already seen how the choice can change the semantics of a program (with freevar).  More generally, the contrast between static and dynamic properties of programs will come up again and again, not just in this course but in many other courses and in your CS career.  (And life.  After all, you are a dynamic expression of the static code in your DNA!)

On the practical side: I'm going to try to work from more pre-written code.  Today (and last class), we delayed some key points too late in class.  (OK, 1.5 minutes after the end!)  I'll try to skip past the inessentials in the future.


Details:

Monday, September 20, 2010

Daily, 2010/09/20: revisiting substitution + functions

Announcement items:
  • Tutorial #2: Resolving lazy scope error WITHOUT deep substitution (A#2 mat'l!)
  • A#1 update: Please keep an eye on or forward your @ugrad.cs.ubc.ca e-mail!
    (For forwarding: http://www.cs.ubc.ca/ugrad/facilities/accounts/email_news.shtml )
  • TestFest: available, helpful, but NOT required!  (Only set up for eager version)
  • Extended office hours this week; see Vista Announcements
  • Practice Midterm out by end of day today (final tuning in progress)
High-level comment:

I'm not sure today's redefinition of our core semantics for WAE made as much sense in class as it did to me before class.  I still think it's a lovely approach to define "ground truth", however.

Meanwhile, we got a bit cut off on functions.  I'll take a moment to revisit the code at the start of class Wednesday so we all see what I did wrong.  (A small, simple coding error, when in our discussion of the idea we had gotten that right.)


Details:

Sunday, September 19, 2010

README summaries

I just read through the Assignment #1 README files.  Thanks for your input, everyone!  I thought I'd summarize what I read and respond to just a few issues people brought up. 

(When I quote people here, I won't use names in case people prefer to remain anonymous.  If you want me to credit you for a quote, drop me a line, and I'll do so.)

Comments I wanted to respond to:

Saturday, September 18, 2010

Daily, 2010/09/17: semantic play!

Announcement items:
  • Last A#1 thoughts: Haven't read Ch 3?  Do so, EVEN NOW!
  • A#2: out later today, due in 1 to 1.5 weeks
  • "TestFest" for A#2: out later today
  • Advice for A#2: work from the textbook!
High-level comment:

I got so swept away with the fun yesterday that I forgot to actually do the announcements.  For what it's worth, they're above.

What had me swept away?  This was our first chance to do some really exciting exploration of semantics!  (More on that below.)  In a few short lines of code, we repeatedly and radically altered the semantics of our language.  The code we came up with encapsulates very succinctly what it means to "get identifier binding right". 


Details:

Wednesday, September 15, 2010

Daily, 2010/09/15: multi+ and with

Announcement items:
  • Thoughts on Reading, Lectures, and Assignments
  • A#1 due FRIDAY; it would help A LOT to read Chapters 1, 2, and 3
  • Thoughts from interactions with students over A#1 (notes to be posted below)
High-level comment:

Today was practice with Racket and parsers: no profound message!  (Well, except the request to think hard about whether (interp (parse '{with {x {+ 1 2}} 2})) should ever cause the interpreter to add the numbers 1 and 2.)  Thus, the details section just contains the notes promised above.

I did try to model how to build a function based on the types the function operates on (e.g., breaking down our parser into cases for each of the types of AE we'll generate).  This is useful, especially to answer (or avoid ever asking) questions like "Why did (second sexp) cause an error here?  Oh, because (second sexp) is not an AE, but I have a function that consumes sexps and produces AEs: I can recursively call parse!"  See How to Design Programs for an extensive introduction to programming using templates like this one (but better).

One other critical thing that happened: a student answered one of my polls by saying he didn't know why we were asking the poll, the single most useful answer.  I'll post more about this on Vista.


Details:

Little Languages Kill; News at 6

The little languages paper we discussed earlier mentions the idea that any interface defines a language.  In that sense, we can apply the principles of language design to a user's interaction with any interface.  Harold Thimbleby's recent article in Interactions (ACM's HCI magazine) gives a fascinating and (literally) deadly example of just that, emphasizing problems arising from a mismatch between the users' perception of the language semantics and the language's actual semantics.  Take a look at the brief example on page 54 of "Ignorance of Interaction Programming is Killing People" in the sections A Fatal Overdose and Calculators Are Mad, Bad, and Dangerous.


Cheers,

Steve

Monday, September 13, 2010

Daily, 2010/09/13: define-type, type-case, and our first "programming language"

Announcement items:
  • Tutorial registration resolution: 3 add'l seats in each tutorial
  • Reminder: A#1 due FRIDAY; started?
  • Is the blog required? No, but tell me if I put something critical there.
  • Can I get access to ACM papers like the one linked from the blog?  SHOULD be possible from any campus connection, including right here.
High-level comment:

We built our first interpreter and learned a couple more key Racket (actually, PLAI) forms.  My scattered whiteboard use (I grab whatever space is available and write on it) and teaching-with-code style may have made it hard to keep up, and may also have masked some of the big picture ideas in the course.  I hope not!  Have to see what I can do to ameliorate this.


Details:

Friday, September 10, 2010

Daily, 2010/09/10: Procedures as Values, Things, and Other Stuff

Announcement items:
  • Old announcement items: see blog 
  • Web redirect fixed (http://www.ugrad.cs.ubc.ca/~cs311 should work) 
  • Tutorial registration issue 
  • Your TODO items: see notes page of website 
  • Tutorial collab policy update + minor add'l update
High-level comment:

We've finished what I really wanted to show in Racket: programming lessons on the basics you'll need and some emphasis on the extraordinary power of "first-class functions" (functions that can be used as normal values).  We'll discuss two remaining Racket constructions (define-type and type-case) as we explore the AE mini-language on Monday.

However, I was disoriented from running to and from my office before class and may have been occasionally incoherent, particularly answering your questions and comments!  I'll avoid hyperventilating before class in the future.  Help me out as long as I have this ear infection by making your contributions loud!

Details:

Another Answer to "Why Interpreters?": Microsoft Does Continuations

Note: The parts of this post in parentheses may make no sense (fleegly-dee floo).  You can skip those parts and still get the point!

Yesterday, I chatted about 311 with my friend Dutch Meyer, a systems grad student at UBC and a very sharp person.  He pointed me at a systems/software engineering article about closures and continuations—two powerful concepts we'll run into this term—that he's returned to many times when thinking about concurrent system design.

Wednesday, September 8, 2010

Daily, 2010/09/08: Whirlwind Start

I write "dailies" (but call them "post-mortems" in my head) after lecture, at least when I'm eating my spinach. These are records of how things went and where we stopped as well as aides to the TAs to track lecture.

This term, at a student's suggestion, I'll try posting these publicly (with my students as my explicit audience: "you"). I apologize in advance for self-censorship.

Announcement items:
  • Introductions: Steve and Dereck (Ben at tutorial)
  • Office hours
  • Extra office hours next week: see Vista announcements
  • Tutorial registration issue
  • Prereq letters
  • Your TODO items
    • Skim PLAI preface, READ PLAI prelude (Friday)
    • Install DrRacket on your computer (Friday)
    • Do Racket exercises 1-15 (website assignments page)
    • Skim/Read Scheme/Racket resources as needed
  • My philosophy on announcements
High-level comment:

I enjoyed the energy and hope that you did, too. I'm glad we made a hefty start on Racket. Oh, and I talked too fast. (Too excited to be back in the classroom after a summer recovering on my rocking chair.)


Details: