Saturday, 30 May 2009

Well, that was all a bit rushed.

Over the winter, I'd lost track of the deadline, so it was a bit of a mad panic when Darryl emailed me to say he was nearly ready for my chunk! Especially as I was due for a weeks sailing pretty shortly.

Got it done just in time (the morning of departure, of course). Probably the most difficult aspect was thinking of good examples that illustrated the required learning points with the minimum of fuss and the maximum of pizazz. The actual writing (including developing the examples) wasn't too bad, and really quite interesting. My only regret is not leaving enough time for the chunk to "settle" before submitting it. By which I mean, time for me to get away from it, then come back and review/edit it, as well as get feedback from 3rd parties. I did get one person to read through it, but as she knew I had only hours to finish it, I suspect she may have withheld any serious comments.

Apologies for the doc version of the file (I was in a hurry!). Here is the pdf version of chunk 12.

Saturday, 23 May 2009

At last

Now completed my chunk (long story with no blog updates). Rather than trying to convert to the correct layout for this blog, here is a link to the word doc file:
Chunk 12.

Tuesday, 11 November 2008

Token - but no book

Got my book token through - thanks Darrel!

But no book. I placed an order on 27th Oct with an ebay seller, Charlies Chapters, who claimed to have 20 in stock. Only after a week, when I'd emailed twice, did he admit that he didn't have any in stock, and nor did his supplier. He claims he has sent a full refund via paypal. But it still hasn't arrived nearly a week later. Needless to say, I expect to open a dispute pretty soon unless I get my money back.

Some time off from Mass Writing recently - other committments, including start of M885. But I'll be back shortly.

Update: I opened a dispute through paypal, and miraculously got a refund within a couple of hours.

Sunday, 26 October 2008

First stab at a chunk outline

This is my first stab at an outline. It will change! And it already includes unanswered questions. Interestingly, it is just about 500 words, or one fifth of the way there.


Students will have met primitive data types. Declarations. And have seen some simple scripts.

Focus on a large number of very compact examples.

--The need to hold a number of similar pieces of data. Discussion examples - eg names, images in a slideshow, coordinates of lines, colours of pixels
--(Learn: purpose & utility of arrays)

-Example 1
--A simple example - create and access an array of names. Slow talk through. Then a program that displays them (no loop - hard code the array indexes).
--(Learn: recognise an array. Declare array. Access one element (get and set). Counting starts from zero)

--(initial example string vars - because simple in concept, don't have to struggle with abstract types. Don't use integers as I don't want any scope for confusion between index and value at this stage. Downside is that extra code is needed to create & load a font before I can display a string. And might end up being too machine dependent - does everyone have Arial?).

-Example 2
--Extend the example. One idea: Add a second array for colour values (for gold, silver & bronze). Mention that the first array of names was olympic medal winners. Step through array, displaying name in medal colour (or with a medal circle?). Second thoughts - just been playing; colours are tricky to get into at this time. I think the example looks too complex. Maybe better to have another of the same complexity as the first.
--(Learn: consolidate on previous)

-Some extras
--finding length of an array. Fixed size. More on counting from zero & implications.
--(learn: array.length, fixed size, obiwan errors)

For statements
--The need to step through an array one item at a time. Discussion examples - big arrays where you can't hardcode.

--Take an earlier example & convert to an enumerated for loop

--Slow talk through the elements in the enumerated for loop

--Another stepping through array example - eg initialising a large array

--Not just for arrays. A for loop for any countable loop. More on varying the parts of the loop (eg the increment)

--A nice visual one, eg lines on a screen (different colours giving a gradient? Or splayed from a point, starburst-like?

-Another example
--Stepping through all the pixels in an image (but don't pre-empt chunk 21 too much!)

Deeper into arrays
-Multidimensional arrays
--Maybe review single-dimensional ones first? Stick to 2-dimensional, eg pixels.

--A nice big 2-dimensional array example, eg process squares in an image

-Array reference
--Array Functions - append() arrayCopy() concat() expand() reverse() shorten() sort() splice() subset()
--At least mention them, even if I don't cover them in detail.

More on For
-I suppose we should cover for..each loops. I have doubts whether this is the best place for them, but can't find them mentioned later in bookfragments. (I couldn't get one to iterate over an array - do for..each loops even exist in Processing?).

Wrap it up
-summary of learning points.
-A more complex (but colourful!) example to get them thinking.

Getting started

OK, so what do I need to do in order to get this chunk written?

First steps, not in any particular order:

* Understand the problem: exactly which concepts and parts of the language am I teaching

* Understand how Processing does all that

* Develop some good metaphors & teaching examples

* Read around - how have other authors tackled the task of teaching these topics for other programming languages? (a trip to the library is called for!)

* Understand the scale of what I've committed to. How much is 2500 words? Answer: a little over twice what I've written so far in this blog (including this entry).

* Read around previous chunks by my co-authors. Eg what screen interaction are they using? None is explicitly taught, but we'll all want to give some feedback that the algorithms & simple programs are doing something. Makes sense to use the same mechanisms unless there's a particular need to teach a different one.

The last point begs a question - how collaborative will this project be? That's worth a separate set of musings...

Oh - and somewhere in that lot, devise a structure for the chunk, and develop prose and code to fill the structure.

Friday, 24 October 2008

Chunk 12 - Arrays and for statements

Yes - Darrel's confirmed I'm good for chunk 12!


TITLE Arrays and for statements
DESCRIPTION Describe single-dimensional arrays and show how for statements can access such arrays.This is a very tricky topic for the beginning programmer so use lots of examples. Describe a program of similar complexity to Greenberg 90--92. Teach brackets in the context of for statements as well. Students will have met brackets before but assume that they only have a hazy idea.
  • Be able to look at a section of code which contains a for statement and array references and describe what it does.
  • Be able to develop simple sections of code that involves a for statement and array references
  • Understand a program of similar complexity to the one you describe in text.
REFERENCE Greenberg 87--92
HINT Please dont make the programs too complicated: loops are a really difficult concept for beginning students.
PROGRAM Develop a program similar in complexity to the one you describe in the text

Previous chunks (so I know what I'm depending on):
1 Intro to Computer Art
2 Introduction to Java
3 Algorithms 1
4 Algorithms 2
5 Algorithms
6 Two simple programs
7 Basic types and naming conventions
8 Big linear program
9 Operators
10 Conditional statements
11 Switch and ternary conditions

First big question for coordination with earlier authors - what output mechanisms will the student have met by now?

Hmmm..... what to write?

Now there's the question - what to write? And can I separate the writing part from the playing-around-with-the-software part?

Early chunks look hard - teaching complex programming constructs from scratch to people with unknown background. But the later parts look hard too - heavy maths & trigonometry. I suppose I could write about Bezier functions if I knew what they were... But the later parts would encourage me to learn, and interact more deeply with the software.

I'm drawn both ways. But I think I'd like to start near the beginning. I'm drawn to the challenges of clear teaching of complex topics. So I've volunteered to write chunk 12 "Arrays and for statements". I rather fancy seeing if I can teach that clearly in 2500 words. Plus, I should be able to make a start without waiting for the book.

Meanwhile, I'm still frittering time away looking at the examples, and also at the Arduino board, and thinking of what applications they open up for me.