Author
peterbuck
View
283
Download
1
Tags:
Embed Size (px)
2. 3. Vital Statistics
4. 5. Bad News
6. 7. Program = Design + Programming System + Execution Model 8. Program Execution Model 9. Pascal 10.
11. begin end; begin end; begin end; begin end; begin end; begin end. begin end; . 12. flights from PVD to CDG list of flights the third outward flight restricted list of return flights the second return flight ok must rememberlist of flights must rememberrestricted list of return flights 13. user typed ( ok user moved mouse ok user clicked mouse button ok different kinds of handlers 14. user moved right 10 yards ok user tilted phone left ok user moved left 10 yards ok loc: (10,0) loc: (0,0) loc: (10,0) loc: (10,0) loc: (0,0) loc: (10,0) 15. void void void 16. database, memory store, remote Web service 17. database, hidden fields, contns 18. Why is this Bad? 19.
20.
21.
22. void void void Whyvoid ? The hostile operating system Why hostile? Because its neutral But neutralityhostility Neutrals can cooperate (impartially) 23. User OS Callback World World World World 24. Current value of World New valueof World Might beenriched with additional event information Phone example: World is current location Will invokeevent-specific functions (define (on-move w d) (posn+ w d)) (define (on-tilt w o) w) 25. on-tick::w w on-move::wdist w on-tilt::wincl w on-key::wkey w on-click::wbtn w on-redraw::w scene stop-when::w bool 26. 27.
(define (incr-time w) (add1 w)) (define (render-world w) (place-image PLANE (* w 10) (image-height PLANE) (empty-scene width height))) (big-bang width height 1/10 (on-tick incr-time) (on-redraw render-world)) 28. World World Scene World World World 29. World World Scene World World Bool 30. Moby 31. What Its Not
32. What It Is
33. A Little More
34. Baseline
35. Rolling Out of Time 36. 37. 38.
(define-struct world (posn r vel)) (define initial-w(make-world (make-posn ) 30 (make-vel 0 0))) ;; game-ends?: world -> boolean (define (game-ends? w) (or ( world
;; tilt: world number number number -> world (define (tilt w azimuth pitch roll) (make-world (world-posn w) (world-r w) (make-vel roll (- pitch)))) (big-bang WIDTH HEIGHT 1/20 initial-w (on-redraw render) (on-tick tick) (on-tilt tilt)(stop-when game-ends?)) (define (tilt w azimuth pitch roll) (update-world-vel w (make-vel roll (- pitch)))) 40. Minding the Store 41. 42.
(big-bang ... (on-redraw render) (on-location-change update-loc)) ;; update-loc: world number number -> world (define (update-loc w lat long) (make-loc lat long)) 43.
;; description: world -> string (define (description w) (items->string (matching-items-nearby w))) ;; matching-items-nearby: world -> (listof item) (define (matching-items-nearby w) (places-matching-items (nearby-places ALL-PLACES w))) 44. Homeward Bound 45. 46. 47. The World is Not Enough 48.
49. On the Internet,nobody knows youre a Scheme program JavaScript Java Processing J2ME Flash/ActionScript Objective-C NXT NXC RobotC BricxCC Design Programming system Execution model { 50.
Thanks : Danny Yoo Zhe Zhang Kathi Fisler Emmanuel Schanzer Matthias Felleisen (rest)