Lecture

Stress - Richard Buckland UNSW

This lecture marks the halfway point of the course. Dealing with stress, programming errors involving arrays, how to write a reflective diary entry, 2 puzzles which seem unrelated, vampires, zombies, and structs in C


Course Lectures
  • Richard Buckland teaches Higher Computing at UNSW - The University of New South Wales.

  • Introduction to computing for first year computer science and engineering students at UNSW. What the course is about. A simple C program. Experimentation and fiddling. How a computer works (in 10 minutes), transistors, chips, microprocessors. Our own baby microprocessor, the 4917, and how it works. Lost sound after 50 mins, partial sound restored at 51 mins

  • After some announcements we revise using transistors as switches. Then we look at how to program our basic 4 bit microprocessor using 4917 machine code. At the end we see how we can try out our machine code programs using the 4917 emulator on the web page

  • Strings, elements and layout of a c program. using gcc, comments, ints, printf, scanf, main, #include, printing newlines. Discussion of clarity. also: about transistors, compiling, machine code

  • Style, clarity, hackers vs elite programmers, simple c programming, side effects, compiler options, segmentation faults. You get an error - what to do? Following the spec. Integer division and remainder.

  • Human Nature, Testing, Top-down problem solving. How to get started when you first get a problem. The importance of testing.Also: magic numbers, style - the search for meaning, "why are you here?" mastering skills, why kids give up on musical instruments, pleasure and pain, richard getting fit, software piracy/viking numbers, Bjorn. First twinges of RSI. Moving to an 8bit Microprocessor. My lousy memory about facts and figures: Viking 1 and 2 were landers not rovers, and viking 2 failed first, not Viking 1 - it was Viking 1 with the software problem.

  • The Adversary and adversary models of computation: an all powerful force out to get you. Side Effects: in machine code, in c functions, in general. Returning a value from main. Also: ASCII, talking in lectures, mars bars and Marco Polo and the emperor of china. Music: Triohatala by Stimmhorn (not really vikings)

  • We write a simple c program together during the lecture: "countdown" how many seconds are left until the first assignment is due? We (or rather Richard) make many mistakes. Using top down design, functions, function prototypes, integer arithmetic, input/output. we discuss program style, clarity, simplicity and complexity. how to start to solve a problem. what to do when you get stuck. more on top down approach. # includes magic numbers variable names. why not to write amusing error messages. Prjintf().

  • R Introduction to computing for first year Computer Science and Engineering students at UNSW.

  • After lecture 8 we had a one week break, and during the break we ran a revision session to recap on the material covered in the first two weeks. This was for students new to programming to help them consolidate what we had done so far. This is the first part of the revision session.

  • After lecture 8 we had a one week break, and during the break we ran a revision session to recap on the material covered in the first two weeks. This was for students new to programming to help them consolidate what we had done so far. This is the second part of the revision session. sadly camera problems meant some bits were not recorded.

  • We sum the numbers 0..n using gauss, the formula for an arithmetic progression, and finally using a simple recursive program. Apparently summing the numbers 0..n is important in computer science. Along the way we continue our discussion of style and craftsmanship, chainsaws, floats, doubles, longs, side effects. Skating. Richard explains that this is not a C course. It is a computing course which happens to use C. C is our tool it is not our objective.

  • Class selects class reps for the first 9:30. The lecture looks at functions. What they provide: Abstraction, Code Reuse, Scope. How functions work in C (under the hood) Machine code view of function calls in our 8 bit machine code. Introduction to abstraction. what is abstraction? what are the advantages of abstraction?

  • We start by discussing the skater guy from last lecture. intrinsic vs extrinsic motivation. deep and surface learning. class reps revisited briefly. what can go wrong. what courses of action are open to you to deal with things going wrong in your code? we look at 4 general strategies and discuss their relative strengths and weaknesses. assert as a way of documenting assumptions and of checking them. contracts. who is to blame. what can you expect other parties to do? what do you need to allow for yourself. more types: char for representing characters. ascii, relation to 8917, signed vs unsigned. typecasts. implicit type conversions (widening) vs explicit type conversions, typedef. c is lax with types. getting fit - why is my plan not working. motivation. behaviour change.

  • How a C function call is implemented in machine code. frames. role and responsibilities. Abstraction revisited. Scope revisited. This is the first part of lecture 12.

  • How C function calls are implemented - at the machine code level. The role of the callee. Frames. Saving registers, local variables. one way of returning a value. Also: following safe conventions even when we don't have to do so. The danger of having to think. The lunch box scope example completed. Can you ever have too many comments? The address of operator &. This is the second part of Lecture 12. We finish early which leaves us time to chat about another key person in the development of the science of computing - Alan Turing (see Lecture 12.3 which follows)

  • We had a gap at the end of Lecture 12 so Richard gives an unplanned and impromptu talk about some of the contributions of the amazing thinker Alan Turing. So much to say, so little time, such fast talking. We chat about 3 different major contributions he made to the world - his decryption work during WWII and the Engima Machine; his abstract model of a computer (the Turing Machine) and what things can be effectively "computed"; and finally, briefly only, his thoughts about what it is to be human and the difference between humans and computers - the Turing Test. Alan Turing is a key figure in the development of computing, indeed if I had to pick just one thinker who was the most amazing he'd get my vote. Richard promises to talk about the Turing Test in more depth in the next extension lecture. Also comes up:Epimenides paradox, non computable functions, the halting problem, U-559, Colin Grazier G.C., Anthony Fasson, G.C.,Tommy Brown, Blade Runner,CAPTCHAs. Errata:My memory was about as reliable as usual - I said Tommy stayed outside in a boat but i've since read that all three swam across and went into the U-559. Humbling bravery. I've also since realised that Colin Grazier was from Tamworth in the UK, not the Tamworth in Australia as I had always thought (why are so many English places named after Australian towns?) Finally, something which actually I did know but still managed to get wrong - the important material salvaged was not a cypher machine but quantities of data (ciphertext and the corresponding plaintext I think) which the codebreakers at Bletchley Park were able to use as "cribs" and were of vast help in cracking the submarine code used at that time.

  • Inspirational Scientist Jane Goodall speaks about Jo-Jo and Rick. (sound patchy for first 8 mins - download the full quality 4min audio clip of her lecture from http://www.cse.unsw.edu.au/~richardb/JaneGoodall.wavcourtesy of the ABC RN Science Show) More about the great thinker Alan Turing. The Turing Test and its links with design, computer science, and life the universe and somethings. What is it to be a person? Philosophy T. Intensional vs Extensional points of view. Pointers * and & revisited. while loops common mistakes with loops Also mentioned: godel escher bach auden EOF

  • Introduction to programming course for first year computer science students at UNSW.

  • Students give feedback about what problems they are having with machine code. Most problematic topic seems frames. Richard revises: what *is* a frame? how is a frame used? roles of the calling function and the called function. what is the return address and how is it used? what is the frame pointer and how is it used?

  • Arrays in C. eg calculating the average of a bunch of numbers. man pages - consulting the manual for scanf. debugging by using printf. invalid input to scanf. easy to write an infinite loop!

  • Examples using arrays in C. eg calculating letter frequencies in a text, substitution ciphers. array initialisers. also: strings, ctype.h

  • Tim explains pass by reference and the link between arrays and pointers. Using sample code we see that C passes arrays into functions *by reference*, unlike all the other types we have seen so far.

  • What is fun? UNSW Researcher Malcolm Ryan gives an extension lecture on game design.

  • (*but were afraid to ask)Review of pointers and indirect addressing. pass by reference/pass by value. Passing arrays into functions. 3 neat things you can do with pointers:1. pass by ref2. dynamic data structures (to come)3. ADTs in c (to come) the exponential growth of doubling revisited. magic trick where you are offered a choice - VS the importance of a good spec. Starting to design a suduko solver. Mars bars from Hong Kong.

  • The challenge: can we write a Sudoku solver in a single lecture? What is a sudoku puzzle? Estimation revisited. how to solve a problem - difference between the approach of a master and a novice. What is the most important thing? Also: How to lie with statistics. hang gliding. easy as falling off a bike. algorithms and data structures.

  • Review and discussion of sudoku code from last lecture. Backtrack vs brute force. Course waffles. Stacks, "the stack" in memory, Buffer overflows. Also: the course ENGG1000, wiki textbook (idea from hong kong). Predicates, comparing with TRUE. Stack overflow.

  • Extreme programming, unit tests, test as you go, unit tests in C, one objective at a time, refactoring. asserts. multi-file programs in C. linking. #include header files prototypes. main. static helper functions. object files .o files Also: hornblower patriotism / the French

  • An unexpected miracle. Programming in the large VS programming in the small.

  • How we use standards (called interfaces in this context) to permit us to write large scale computer programs in teams. Task2 as an example of standards. Writing a new interface function. Writing C unit tests using assert. Also: strings vs arrays of chars, array initializers for strings, static functions, unit testing.

  • This lecture marks the halfway point of the course. Dealing with stress, programming errors involving arrays, how to write a reflective diary entry, 2 puzzles which seem unrelated, vampires, zombies, and structs in C

  • Extension lecture introducing randomness. What is a random process? How can a deterministic process on a deterministic computer generate random output? Why is randomness useful? What are problems we face when generating random numbers? The lecture introduces Von Neumann's simple algorithm (which we later analyse in labs), and Knuth's Art of Computer Programming. We briefly revisit the triangle problem. Richard amazes and astounds with magic tricks. Some mention of Shaun of the Dead. Extension lectures are for first year computing students at UNSW. The topics covered are non-examinable, students attend only if they are interested. Richard generally raises more questions than he answers.

  • The first 17.5 minutes are a discussion of what the task2 diaries revealed: poor time management (eek!) Richard confesses he is bad at time management too and makes some suggestions. The remainder of the lecture is setting up for ADTs (introduced in the next lecture). Task2 (the sudoku solver) is used as motivation. Why do we want to break the problem into separate quasi-independent files? (A: Metcalf's law) What was the relation between the sudokoGrid type and its interface? What is the subtle problem Richard keeps alluding to with respect to the way this separation was implemented? Another Richard, or perhaps Alex, comes up with a better way of implementing sudukoGrid.c - is this as wonderful as it seems or have we unearthed a mare's nest? If only there was some way of solving this problem ... (dissolve to lecture 30)

  • Finishes off the ideas started in #29. The need for Abstract Data Types (ADTs). How to implement them in C. Their wonderfulness. Also: Undocumented features. Can we trust programmers? Allocating memory on the stack. Allocating memory on the heap (malloc/free). Introduction to the project (card game: Blackadder & Baldrick).

  • Discussion of the major project for 1917 this year (2008) - the card game "Blackadder and Baldrick". The winner of the project grand final playoff gets the title "coolest programmer in first year 2008", and Marvin.

  • Discussion of the project. Converting sudukoGrid into an ADT. also: Accessing the components of a struct using dot notation, and using -> notation.

  • Extension lecture introducing steganography (hidden messages). Security via obscurity. Hidden messages in book Godel Escher Bach. In film Starship Troopers. In games. In cryptography. In teaching. Digital watermarking. SETI. Are we in a simulation? Extension lectures are for first year computing students at UNSW. The topics covered are non-examinable, students attend only if they are interested. Richard generally raises more questions than he answers.

  • 0:00 Richard talks about what a personal trainer does and how old people exercise. 8:00 project Q&A.27:00 Josephus, whose back story richard discovers from a student. We talk about how to program the Josephus problem. There are many ways we could approach this - we discuss their various merits and sketch out a way of approaching problems like this. Also: Algorithms vs Data Structures. Wei Hua learns to ride a uni-cycle. The Prisoner #6. The WAV format standard. The Australian national anthem - Advance Australia Fair.

  • Download the Australian National Anthem: http://www.cse.unsw.edu.au/~richardb/nationalAnthem.wavAdvance Australia Fair. The Australian National Anthem challenge. What is a file? File I/O in C (FILE as an abstract type). Infinite stacks. Memory management, problems with free(). The snake puzzle revisited (linked lists). PBM graphics format. Are we simulated, real, or just a video on youtube? Sending a message to the creator.

  • Dob in your commie lecturerhttp://www.google.com.au/search?q=makeeducationfair http://www.younglibs.org.au Indirect addressing. Arrays vs lists. Sample code to set up and manipulate a linked list. Doubly linked lists. Also: The 3-way shuffle to interchange two things. The Wiggles. Robert Sheckley. Stranger than Fiction. Filming starts during the break, lecture starts at 2:10

  • Extension lecture introducing do-it-yourself digital design at home using cmos chips and a breadboard. Extension lectures are for first year computing students at UNSW. The topics covered are non-examinable, students attend only if they are interested. Richard generally raises more questions than he answers.

  • Searching, best worst and expected case. Binary search and insert - linked lists vs arrays. Trees. Ordered binary trees. 3 interesting books: Puzzle Guide to Godel (Raymond Smullyan), Surely you're joking Mr Feynman (Richard Feynman), Alice/Annotated Alice (Lewis Carrol/Martin Gardiner)

  • Persevering. Assignment extensions considered harmful. C errors. Errors at runtime, at compile time, gcc, valgrind, mudflap. Array bounds, Segmentation faults. Risky behaviour - it's hard to detect risk when all goes well. Snarks and Boojums and Zoolander. Catastrophes. Types, unsigned, limits.h, example of bitwise operator use. Von Neumann's clever (but flawed) random number generator.

  • Tim and Student Yose Widjaja give a taste of the 3rd year graphics course. Yose shows his project for 3d visualisation, and using Ninjas to create and delete 3d pixels. A demo of a flame simulator done by graphics students as their first assignment on CPU and GPU. At the end Tim talks a bit about directX vs open gl.

  • Detecting fixed points in von neumann's simple random number generator. data structure revision. using trees. implementing a very simple tree. Talk about the anagram lab exercise. Improving the UNSW 89019 microprocessor. CISC and RISC design. Using memory segments to be able to address more memory. The bicycle wheel puzzle. Simulation - a neat and simple way to solve complicated problems when you can't be bothered to use/can't rely upon/have completely lost your ability to do complex maths accurately. mentioned for no apparent reason: GUNNS Limited, Edgar Allen Poe.

  • What is important? What are "Ethics"? What does it mean to be a good person? Whistleblowing. The whistleblowers handbook. Law. Intellectual property. Copyright. Public Domain. FTA.

  • Hamming codes, parity bits, magic. Detecting errors when transmitting information. Even better: correcting errors.

  • Professionalism and computing. Most students in this course are going to be professionals - but what does that mean? What is a professional? How does it differ from being a non-professional? Why Microsoft is not evil. Professionalism and engineering. Arthur Andersen and Enron. NASA and the Challenger (1986) and the remarkable Richard Feynman, again. NASA (again) and the Columbia (2003). The Therac-25. Public perception of ethics of various professions (Australian data, Ray Morgan) Wise advice for professionals who manage projects: One Hundred Rules for NASA Project Managers by Jerry Madden. Ethics revised. Groundhog day. What is it to be a master programmer? Solving the right problem. Henri Cartier Bresson. Ansell Adams is a geek. This is our last (non-examinable) extension lecture. Just for fun. Wrapping up lots of loose threads. What do nationalism and national anthems have to do with being a good programmer?Question everything. Being a scholar. Also, Dane manages to barter his way home, and Theo and Jean-Paul solve the national anthem challenge.

  • The last week of the first computing course course. In this lecture we start to answer the question "What makes a good programmer?" which students have been asking on the forum for a few weeks (what wonderful students!) We then consider how this course fits into the whole computing degree and some ideas about life and learning after leaving university. Craftsmanship. Science. Design. Looking back over what we learned in the course. The first few weeks. Also: striving to be a good photographer. patterns and trees. never giving up. John Stuart Mill. Brave new World. Henri Cartier Bresson. Crazy Idea: Ontogeny recapitulates Phylogeny in computing education.

  • First year computing in summary. Everything we did so far. A lot of what and a bit of why. Also richard gets rick rolled. The course soundtrack https://wiki.cse.unsw.edu.au/cs1917cgi/08s1/SoundTrack And potatoes.

  • The last lecture of COMP1917 /part 1. (The first 18 mins: prizes and course wrap up.)18:25 Richard's teaching philosophy. About teaching and about learning. Where we learn, how we learn, what we learn, why we learn. Intrinsic and extrinsic motivation. Deep and surface learning. More wisdom from Richard Feynman - the brown throated thrush. All of my students are wonderful and amazing. Some of their achievements are publicly acknowledged at the start of the lecture. Also, the 2008 coolest programmer and honour roll. Brownie points. Farewell Alex North. IYP. Course feedback.

  • Note: The Strange Case of the Erotic Kiss is at 56:30 This lecture is the last hour of the last lecture of COMP1917 - the higher stream of the first computing course of the School of Computer Science and Engineering at UNSW. We discussed the structure of the final exam. (Richard has some crazy ways of structuring exams - before the exam make sure you read the sample exam on the course homepage if you missed this lecture - so you don't get affected by misreading the instructions on exam day in the stress of the exam). Group work (and brownies/girl guides). The students' advice to next year's students: * Practise practise practise.* Write your tests *first*!* Do all the lab exercises even if you don't finish them in time for marks. What comes next in your study of computing. About COMP1927 and COMP2911. We say goodbye. The end of a fun semester together - I've very much enjoyed working with you all. My warm best wishes for your future learning and your path through university and beyond, and I hope to see you again in my senior cryptography and security course in a few years. At the end: Richard's fatherly advice for life. Also mentioned: RSI, paper aeroplane injuries, writing the textbook on the wiki for the open book exam, being an actuary. In 2009 I'll record our second course: COMP1927 - "Higher Data Structures and Algorithms". Over the remainder of 2008 we'll post a few more supplementary videos from 1917. At the start of 2009 we'll post the tute and lab material accompanying these 1917 lectures for those who wish to use these videos to teach themselves programming. fond regards,Richard

  • Live C coding samples (screen capture movie) from COMP1917. Material from the first two weeks (Lectures 1-8).

  • Live C coding samples (screen capture movie) from COMP1917. Material from the first two weeks (Lectures 1-8).

  • Live C coding samples (screen capture movie) from COMP1917. Material from the first two weeks (Lectures 1-8).

  • Why is university learning seen as a chore by many students, even when they love the subject they are studying? Why does everything have to be worth marks? This is the start of a talk Richard Buckland gave at the UNSW School of Education in November 2011 where he discusses an experiment with a large first year computing course in which assessment activities did not contribute to students' final grades.