Wednesday, November 28, 2018

#OZCSCHAT Nov 2018

I was so excited to host the return of the #ozcschat last night! I appreciate everyone who came along to join in the conversation. Especially 
@nickyringland
@c_l_garcia
@sgunja1
@malynmawby
@timmiclark 
for keeping the conversation flowing and sharing so many insights and
@sailpip for letting me to take it on in the first place.

This is the wakelet showing many of the conversations which were started in the #ozcschat last night. You can be involved by joining us on January 29 2019 at 8PM or by tweeting at @ozcschat or with the hashtag #ozcschat. Any ideas for future questions or themes gratefully received.


Monday, November 26, 2018

OZCSCHAT is back!!!

I have received permission from Phillip Cook @sailpip (who started the chat years ago) to start OZCSCHAT back up again and I'm very excited because I've missed it so much. I'm trying to be the Computer science chat I want to see in the twitter.

So tomorrow night I will be marshalling? adjudicating? basically sitting on my computer and hoping for some friends for an hour to give us a chance to have a chat and wrap up 2018 and look forward to what we want out of our teaching lives in 2019 and learn from each other.

Since it's the first one in a while there won't be an official theme but rather just a catch up on what we're doing and where we want to go. Here are the 7 questions I have come up with. If the gong goes at 9pm and we haven't got to any I'll roll them over. 

The best thing about these chats are the spin-off conversations that happen when you ask for more detail or compare notes on a similar experience. Get to know your twitter friends and grow your Professional Learning Network!

Here are the questions:

















Friday, July 6, 2018

Pygame for the kiddies - My preso for GPN and files

Tonight I'm presenting on how to teach just enough Pygame to make something that works for novice Python programmers (read 10-17 year olds). 

One of the issues with Pygame is its barrier to entry but it has great benefits in given kids something visual to play with which has its own intrinsic motivation. This is a link to all the files I will be using tonight as well as my notes (probably to be added later) on each step and where the pitfalls are. 

Clearly, if you are an experienced programmer and familiar with objects, there are much better ways to design games but this project is scoped first and foremost to teach the bare minimum to get the kids going.


Files for use with the game






Steps to build the game in code (steps in text coming)


Step 1: a screen
#import stuff
import pygame

#setup screen
pygame.init()

screen = pygame.display.set_mode((640, 480))
#screen.fill((255, 255, 255))
#pygame.display.flip()


#setup vars and files

#instructions

#keeping track of cards

#managing time


#main loop

    #check time passed (slow computer down)

        #if there is a snap event
            #increase score and print outcome

            #update screen and pause
        
        #reset time_delay, update previous_card and get new card

        #update screen

    #check for events

        #if the quit button was pressed

        #else if there was a keypress (any keypress)    

            #check if card matches

                #increase score and print outcome

            #update screen with outcome and pause
            
            #reset time delay, update previous_card and get new card

            #update screen


Step 2: quitting

#import stuff
import pygame

#setup screen
pygame.init()

screen = pygame.display.set_mode((640, 480))
screen.fill((255, 255, 255))
pygame.display.flip()


#setup vars and files
game_over = False


#instructions

#keeping track of cards

#managing time


#main loop
while not game_over:

    #check time passed (slow computer down)

        #if there is a snap event
            #increase score and print outcome

            #update screen and pause
        
        #reset time_delay, update previous_card and get new card

        #update screen

    #check for events
    for event in pygame.event.get():

        #if the quit button was pressed
        if event.type == pygame.QUIT:
            print("Game over")
            game_over = True

        #else if there was a keypress (any keypress)    

            #check if card matches

                #increase score and print outcome

            #update screen with outcome and pause
            
            #reset time delay, update previous_card and get new card

            #update screen


pygame.quit()

Step 3: Blit


#import stuff
import pygame

#setup screen
pygame.init()

screen = pygame.display.set_mode((640, 480))
screen.fill((255, 255, 255))
pygame.display.flip()


#setup vars and files
game_over = False
#user_score = 0
#computer_score = 0


#instructions

#keeping track of cards

#managing time


#main loop
while not game_over:

    #check time passed (slow computer down)

        #if there is a snap event
            #increase score and print outcome

            #update screen and pause
        
        #reset time_delay, update previous_card and get new card

        #update screen

    #check for events
    for event in pygame.event.get():

        #if the quit button was pressed
        if event.type == pygame.QUIT:
            print("Game over")
            game_over = True

        elif event.type == pygame.KEYDOWN:

            #check if card matches -- faking this
            #yet to implement
            if pygame.key.get_pressed()[pygame.K_SPACE]:

                #increase score and print outcome
                #user_score = user_score + 1
                print("You Win!")
                #print("Computer: " + str(computer_score) + " User: " + str(user_score))
                
                image = pygame.image.load("snap.png")
            else:
                image = pygame.image.load("boo.png")

            #update screen with outcome and pause
            #screen.blit(image, (300, 80))
            #pygame.display.flip()
            #pygame.time.wait(500)
            
            #reset time delay, update previous_card and get new card

            #update screen


#pygame.quit()

Step 4: Cards


#import stuff
import pygame, time, random

#setup screen
pygame.init()

screen = pygame.display.set_mode((640, 480))
screen.fill((255, 255, 255))
pygame.display.flip()


#setup vars and files
game_over = False
user_score = 0
computer_score = 0
cards = ["ace.png","2.png","3.png","4.png"]

#instructions

#keeping track of cards
previous_card = "0"
card = cards[0]

#managing time
sec_to_add = random.randint(2,5)
time_delay = time.time()+sec_to_add

#main loop
while not game_over:

    #check time passed (slow computer down)

        #if there is a snap event
            #increase score and print outcome

            #update screen and pause
        
        #reset time_delay, update previous_card and get new card

        #update screen

    #check for events
    for event in pygame.event.get():

        #if the quit button was pressed
        if event.type == pygame.QUIT:
            print("Game over")
            game_over = True

        elif event.type == pygame.KEYDOWN:

            #check if card matches -- faking this
            if previous_card == card:

                #increase score and print outcome
                user_score = user_score + 1
                print("You Win!")
                print("Computer: " + str(computer_score) + " User: " + str(user_score))
                
                image = pygame.image.load("snap.png")
            else:
                image = pygame.image.load("boo.png")

            #update screen with outcome and pause
            screen.blit(image, (300, 80))
            pygame.display.flip()
            pygame.time.wait(500)
            
            #reset time delay, update previous_card and get new card
            time_delay = time.time() + random.randint(2,5)
            previous_card = card
            card = random.choice(cards)

            #update screen
            #screen.fill((255, 255, 255))
            #pygame.display.flip()
            #pygame.time.wait(200)


    image = pygame.image.load(card)
    screen.blit(image, (10, 100))
    pygame.display.flip()

pygame.quit()

Step 5: Computer Play (final ish)
#import stuff
import pygame, time, random

#setup screen
pygame.init()

screen = pygame.display.set_mode((640, 480))
screen.fill((255, 255, 255))
pygame.display.flip()


#setup vars and files
game_over = False
user_score = 0
computer_score = 0
cards = ["ace.png","2.png","3.png","4.png"]

#instructions
print("Press any key to SNAP!")

#keeping track of cards
previous_card = "0"
card = cards[0]

#managing time
sec_to_add = random.randint(2,5)
time_delay = time.time()+sec_to_add

#main loop
while not game_over:

    #check time passed (slow computer down)
    if time.time() > time_delay:

        if previous_card == card:
            #increase score and print outcome
            computer_score = computer_score + 1
            print("Computer Win!")
            print("Computer: " + str(computer_score) + " User: " + str(user_score))

            #update screen and pause
            image = pygame.image.load("snap_computer.png")
            screen.blit(image, (300, 240))
            pygame.display.flip()
            pygame.time.wait(500)

        #reset time_delay, update previous_card and get new card
        time_delay = time.time() + random.randint(2,5)
        previous_card = card
        card = random.choice(cards)

        #update screen
        screen.fill((255, 255, 255))
        pygame.display.flip()
        pygame.time.wait(200)

    #check for events
    for event in pygame.event.get():

        #if the quit button was pressed
        if event.type == pygame.QUIT:
            print("Game over")
            game_over = True

        elif event.type == pygame.KEYDOWN:

            #check if card matches -- faking this
            if previous_card == card:

                #increase score and print outcome
                user_score = user_score + 1
                print("You Win!")
                print("Computer: " + str(computer_score) + " User: " + str(user_score))
                
                image = pygame.image.load("snap.png")
            else:
                image = pygame.image.load("boo.png")

            #update screen with outcome and pause
            screen.blit(image, (300, 80))
            pygame.display.flip()
            pygame.time.wait(500)
            
            #reset time delay, update previous_card and get new card
            time_delay = time.time() + random.randint(2,5)
            previous_card = card
            card = random.choice(cards)

            #update screen
            screen.fill((255, 255, 255))
            pygame.display.flip()
            pygame.time.wait(200)


    image = pygame.image.load(card)
    screen.blit(image, (10, 100))
    pygame.display.flip()
pygame.quit()

All files can be found here: https://drive.google.com/drive/u/0/folders/0BzfvVt8-JyCmR0F5bmJOZzh6MVU

Tuesday, September 19, 2017

Kivy Basics - explaining widgets

This is my video that has gained some small amount of traction on YouTube that explains the passing of information becak and forth between py and kv files.



Example 1:  Coin Toss

main.py
CoinToss.kv

Example 2: Noob basic shape
main.py
noob.kv

Hope this is useful to people trying to get started in Kivy.




Tuesday, June 20, 2017

The Day I fell out of love with UNSW ProgComp

I love programming. 


I really like getting into a problem I find difficult. I quite relish the heart pounding self doubt before I finally untangle my own thoughts and get a stupid machine to do my bidding. I'm not very good at it, I am not able to intuit node traversal or dynamic programming or (god forbid) prolog parsing but I love having a go and am completely addicted to the euphoria when I get a problem out. Cryptic crosswords are a similar joy (except Fridays in the smh, gah!). So with all this love in me I try to engender the same kind of relish for tricky problems with my students.

I run a code club and teach years 8, 9 10 and 11 and have some form of programming in the teaching programs for all of those years with Year 11 studying the NSW Software Design syllabus. These students are encouraged to seek out ways to stretch themselves forward rather than just do what already feels comfortable. 

Every year for the last several years we've had a ProgComp Party!

ProgComp is an annual competition run by UNSW where the grand prize is scholarship money towards the winning students' future tuition. It's part of the UNSW outreach program and is more about recruitment for them but also purportedly about getting more students engaged with tricky programming problems.

What's a ProgComp Party? The students spend several weeks (for an hour or so a week) honing their Python skills, I order Pizza for lunch and buy a stupid amount of lollies. I book out a computer lab and we move all the library's portable white boards in. The students have some code snippets to get started with and when it kicks off at 2PM I print 10 copies of all the questions and teams do their best to hack together an answer or two. 

We're not very good. We're never going to get into the finals and I have been known to prod the younger students a bit to get them over the line of completing a question. We don't mind not being real contenders though. As one of my Year 9s said "It's not about winning it's about getting a bit better each year."

We usually get to the end of the 2 hours feeling bruised and battered and exhausted but happy in our small successes.

Not this year however. This year the atmosphere was completely different and I had to convince some of my students not to leave early -- that's never happened before.

What was it about this year that was different? It was harder and more mathy, more impenetrable and much less accessible to my students. The questions were so poorly explained that I had to read them multiple times to work out how to retell them to the students in a way that would get them started. 

I understand that we're not the target market for this competition. It's about attracting the super-geeks and encouraging them to put UNSW first on their uni application. But my goal is to present kids with tricky problems that will whet their appetites and sharpen their thinking skills and have them feel more efficacious than they did the year before. 

I'm not a maths teacher but I do run the maths club at school (although that might be a grandiose title for what it is), and I'm not afraid of a bit of maths but it's intimidating for kids to see formulae they don't understand. 

The Junior question was not very hard once you understood it. It involved file processing and formula following but it was so badly framed that my juniors were at sea and I was giving far more help than I ought to have just to have them feel like they were still part of it.

The first question after the junior was quite a tricky problem with a mapping of the shape of strings necessary. It took a serious amount of time to decompose before even thinking about syntax. 

Needless to say we're not going to the finals but my concern is that the on-ramp was so steep that I might lose some of my students who walk away thinking this programming thing is impossible. Now I'm going to make it my mission in life to ensure that doesn't happen but I can't see booking a room with the whiteboards and the Pizzas and the lollies again next year. Maybe we'll attempt the Friday cryptic crossword instead. 

Sunday, June 11, 2017

Edutech talk

It was my privilege to be invited to speak at Edutech this year. This is  my talk from the main stage in the expo. What an amazing event!

STEM is Hard but Valuable

SUPERGIRL
There’s an 11-year-old girl I know and she’s a force to be reckoned with. She’s not your average kid, she’s been coding in Python and scripting HTML from the age of 8 and she’s completed the National Computer Science School Intermediate Challenge with a perfect score. She’s no fading violet either. She’s a scout, she competes in martial arts tournaments and rides a road bike at nearly 30 km/hr and when she occasionally falls off she wipes the blood off and gets right back on again. She is resilient and she has some mad skills.
The other day she was working on a harder competition and was faced with a coding problem she didn’t know how to solve. She burst into tears. She said she didn’t feel good enough at programming.

RESEARCH?
All of the research I’ve read suggests that confidence issues in Technology and Maths stem from bad experiences when young, negative attitudes to technology and Maths from female role models such as primary school teachers, negative attitudes to technology and maths from the mother – none of these applied here. And maybe it was a bad example, maybe she was tired?, having a bad day?, it’s by no means a representative sample but it struck me none-the-less. How can this happen? How can a capable, resilient, skilled young girl feel so overwhelmed by a tricky coding problem? And what hope is there for the rest of us?

IS THE ON-RAMP TOO STEEP
I’ve told this story to people I know.
My teacher friends say – the problem was too hard, the student needed more scaffolding, the on-ramp was too steep. Who agrees with that?  I don’t really think so. I know the kinds of problems this kid has solved in the past – I think it *was* appropriately on-ramped and I’m a bit of a geek so I enjoy this stuff but, if you scaffold things too much I think it takes the fun away and makes learning a tutorial. People get frustrated by tutorials.
My tech friends have a different take. The kid cared too much about the mark and not enough about the problem. It was a motivation issue.
This feels true. We heard about this kind of thing from Carol Dweck. The kid was crossing that line to the Fixed mindset rather than the Growth mindset. She was pushing herself forward to achieve an arbitrary outcome – it was an intellectual exercise. The only reason to complete the problem was to say she completed the problem. Let’s look at the rest of her life and see if we can determine her motivation in other things.

She is an active Scout. Scouts involves social games and problem solving and small fabric arbitrary outcomes that you can sew onto your uniform. You can even get a small fabric arbitrary outcome for sewing other arbitrary outcomes onto your uniform. But I get the feeling that the motivation is more playing around in the dirt and lighting fires than it is about the badges and research seems to agree with me. There’s a fun article by Deci, Koestner and Ryan that argues with the previous debunking of the original paper that posits that badges probably undermine intrinsic motivation (I like tracking the arguments) -- but it all kind of depends on the learner and the type of learning.

The next thing we know about the kid is that she trains in Martial Arts. Martial Arts definitely involves extrinsic motivation but it’s by no means arbitrary. If you watch a Martial Arts class you see that the belt colours are more a representation of levels like in a computer game. They are motivating because they define the ranking in the class and the social structures are all built around the levelling. Those high-ranked colours earn you some respect but they’re also not the reason you work hard, they just keep track of where you are on the continuum!

Finally, we know that she rides a bike, not in competitions but for the joy of getting from one place to another fast. It’s not about ranking or winning (except she thinks it’s awesome to “beat” her brother -- but doesn’t everyone?).
None of these things only derive a sense of accomplishment from the checking off of tasks – the completion of the next pre-defined difficult problem. But so often our school type problems – and particularly abstract STEM challenges do.
So how can we help our girl to continue to grow her skills in STEM without breaking her spirit? We must make the problems meaningful to her. The Digital Technologies Curriculum and the draft Curriculum for NSW Digital Technologies both talk about “real world” problems.

REAL WORLD
So, what is a “real world” problem?
Dan Meyer is one of my favourite educational bloggers. He’s a former maths teacher who did a TEDx talk on how we should do Maths differently – it went kind of edu-viral a few years back. He makes a distinction between real world problems and interesting problems. He says the interesting problems are the ones that hook the kids to have them want to know the answer – or indeed to come up with their own questions. This is actually how I define “real world” problems when I read them in the syllabus documents. This reminds me of the Melbourne Declaration which states “Successful learners– are creative, innovative and resourceful, and are able to solve problems in ways that draw upon a range of learning areas and disciplines.”

STEM-EMBEDDED AUTHENTIC PROJECTS
The place to start is STEM embedded in authentic projects. The challenge our original little girl was faced with was a difficult file processing problem. Now I don’t teach many 11 year olds but I do teach a bunch of high schoolers and in a bunch of my classes we have to do file processing with code. I can teach the iteration and what to do with strings line by line and slowly watch the kids’ eyes glaze over as I lose them. Or I can have them make a computer game. Once students have been making a game for a while and they’ve had some success and let their friends play some of the early levels they start to ask how they can keep track of high scores even after the program is closed down. How can they do that? Computers don’t do a good job of holding onto information after the power has turned off. – The students need to do it by writing to a file. And when they open the game the next time the first thing that game has to do is open up that file and process the information in it. Suddenly the kids care about file processing and teaching them how to solve those problems are no longer my idea but theirs – it’s practically no longer teaching!
So all we have to do is make our students care about each individual content dot point and everything will be rosy! Except…

THE SITUATION SO FAR
In primary schools Science and Technology make up a minimum of 6% of indicative teaching time. The Technology portion is 3% (charitably) In the shape of the new curriculum Technology is made up of Design Technologies and Digital Technologies so that leaves 25 minutes per week to work on a programming project. Tricky to get to those moments where the students are begging to learn the thing they need to solve the next problem.
Google talks about future careers being CS + X where CS is computer science and X is whatever it is you’re interested in. I think this needs to be reversed in our classrooms, particularly in primary schools. Our focus is not to make hundreds of thousands of computer scientists but to teach students authentic problem solving and algorithmic thinking and STEM is just a hammer with which to hit that particular nail. Steve Jobs once said “Everyone should learn how to code because it teaches you how to think.” So let’s enrich Maths, English, Arts, HSIE with projects that incorporate STEM. Designing projects that allow us to do double duty lets us make the most of the time we have with the students.

PROJECTS
I have a few projects I can talk about here as integrated with STEM to make the best of time with students while also meeting DT outcomes. The first is a Mandatory Technology project in the area of textiles that has been adapted to incorporate computational thinking and coding. The students were encouraged to design their own outline and features for a monster soft toy with ahidden switch and soft circuitry. They then worked with Arduino version of C to write a simple program. Some of the students extended their project to incorporate a squeeze switch to change the sequence. The good thing about this project is that it’s student defined (within a defined framework) it hits the required outcomes, it’s engaging, it extends the original textiles project and it’s scalable to meet the skills of the students. The difficulties with this project were the frustration with sewing unshielded conductive thread with beginners stitching… can you say zigzags and short circuits? Debugging of the circuit is only possible once complete lines of stitching are done but then fixing that requires the unpicking of complete lines of stitching. Unpicking is very hard on motivation. It’s slow and arduous and we watched students become slightly less enamoured with their monster with each time they had to unpick anything.

The second case is a cross curricular project centring around Health from PDHPE. The students spend 19 weeks (totalling about 30 lessons) learning the components of health and how they’re measured. They also concurrently learn about using MIT Appinventor and being reminded of the design cycle by following the design thinking model. The students then define their line of inquiry, choose a target audience and develop an app that meets the need of their target audience to try to improve a component of health. The benefits of this project are that it is student led, they choose their audience, their area of health, their motivation techniques and they use the LMS to learn the skills they need Just in Time. The detriments were that the time was quite short all told and the students had pretty high expectations for what they could achieve in that time. --- 
It is a problem these days. Even when I first started teaching the skills required to make something that looked professional were within the grasp of the average computing student but now everything is so slick and the User experience is so good that there’s a chasm between what our students can make in the time allocated and what they see on their phones every day. ---
That said it was an extremely successful project and we’re looking forward to running it again.
One of my favourite concepts was an app where young children were encouraged to move more to earn points to get water and food and accessories for their pet cactus. Cactuses are way cool with 14-year-olds right now.

The showcase was a “shark tank” like presentation where the students showed their Minimum Viable Product to a panel of judges to ask for investment (the most persuasive presentation got a gold bar {of chocolate}). This project shows that you can meet outcomes from very disparate KLA silos. It showcases the best of the idea behind X + CS. But STEM is still hard.

WHAT'S NEXT?
I believe that things are going to get easier. As Digital Technologies implementation gets smoother and teachers become more comfortable with the content, as senior primary teachers can start to rely on the kids they teach to come into upper primary with sound algorithmic thinking skills from lower years and high school teachers can build even further. The kids are going to be bouncing off the walls if we give them a Scratch project or Blocks based App inventor project – they’ll want to break any benchmark we set them now.
The girl from the beginning of my story is fine. She slept on it, asked some questions, picked herself up, wiped off the blood and cracked the problem the next day. But it’s still not the best way to motivate a student to push themselves in STEM learning.

Authentic real world projects involving student autonomy that are well designed to cover syllabus outcomes and allow for embedded just in time learning. I just said that so quickly it sounds almost easy. I don’t think that’s easy that’s what they say in the tech biz is a non-trivial problem. Extremely difficult but not impossible. So I’m going to leave you with a question to take home just before I open for questions from you. Can you think of ways to incorporate authentic STEM enriched projects into your non-tech units?