"Wrapping up the Cruft - Making Wrappers to Hide Complexity" - Jack Reichelt (PyCon AU 2023)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
foreign but I've known Jack for a decade or more so I was just gonna add Libs and really embarrassing facts about how awesome he is how he's been passionate about Computer Science Education uh since I met him and he was a teenager at the time I thought it was a bit weird no it was fantastic um he is a CTO of connected ed code um and he's particularly keen on making Tech accessible to students I'm really excited about hearing about that in this talk so Jack welcome come on up uh join us thank you very much hello oh I'm on yes very loud all right [Music] sorry too many layers this is great footage for all of you online all righty alrighty yes cool nice back on sorry about that cool oh sir yes my talk today is about wrapping up the craft and what I mean by that is making wrappers to hide complexity um so who am I and what do I do why why am I the one to talk about this well I'm a bunch of stuff I teach at Presbyterian ladies College in Sydney I teach Cambridge computer science to grade nine um since I wrote this slide I'm also temporarily teaching at Emanuel School in Sydney teaching nine to twelve while they thought out a new teacher because one's left um I'm the CTO at Connected code so our whole mission statement thing is connecting code with context community and curriculum we do basically any kind of education-y thing we make uh projects for people to do we help with teacher PD we come and run events all sorts of stuff around Tech education and then I'm also a professional dungeon master I run role-playing games for people with great team building events come talk to me yay let's focus on the relevant one which is connected to third we do all sorts of events um the big four events that we've done uh so far are the first one was called Data detectives and with this we planned a whole uh murder mystery just a fake murder but a murder mystery and we went to a school and had them develop all sorts of programs to solve the murder things like using moisture sensors to check whether a car had been in a car park when it had rained and if they had been there when they said they weren't well that's a little dodgy isn't it things like that we ran Escape artists another incursion into schools where we went and we took uh all of we took a whole year level all of grade eight um we assumed they had no programming experience beforehand which was largely true and in three days they built whole Escape rooms in about eight groups and these were moderately complicated moderately large Escape rooms um with all sorts of things RFID reading you know ciphers to crack um you know lock boxes with solenoids and all sorts of things there and we've worked with the University of Wollongong on a couple of cubesat workshops uh cubesat being a little 10 centimeter cubed satellite um basically a little weather station and we got the kids again a variety of Ages variety of programming experience some who've never done any some who've done quite a bit and we got them all to program this weather station tied them to balloons hanging time to drones flew them up in the air and got atmospheric data out of that so these have been typically aimed at high high school students who've done a little bit with primary school students and one thing we do that I touched on a bit there is we aim for differentiation we want to support all experience levels particularly with school students even though coding is part of the curriculum it's implemented at the moment pretty differently at a lot of different schools and so we can't make any assumptions about what the kids are coming in knowing so we want to give it so that the kids who've never done anything can learn and grow and have a fun experience and get excited about tech but the kids who've done loads of programming aren't really bored because they're learning about if statements again for the nth time so one tool we use for this are kookaburrias so the kookaburries are great they are a little micro computer made by the OST stem Foundation which is up in sort of the Central Coast Sydney area they run micro python they're easy to use they're flexible they're fun they're a lot like a BBC micro bit if you've used that um and they're a little less like but still pretty similar to things like arduinos and Raspberry Pi's and so on one great thing about these is that they've got a bunch of plugs on the back and they can have peripherals you can plug in all sorts of things so many things and this is just some of the stuff that I've already written rappers for um now how do we get it so that the kids can use all of these different devices and feel capable and like they're achieving things and get excited even though some of these devices are quite complex and they're all wildly different well we wrap up the craft so what do I mean by Craft I mean really the stuff that doesn't matter I'm gonna do an unconventional thing for a talk at a python conference and start by talking about Java um so let's look at Hello World um there's quite a lot in hello world in Java and that can be pretty intimidating for a first time programmer and it's also very intimidating for a first-time programmer when you guide them through typing all this and then they have a question and they have a question about kind of most of it you know what does static mean and the typical response that I've seen is don't worry about that for now and the problem is when you say don't worry about that for now to a kid who's maybe a little unsure of texts for them what they hear is Tech isn't for you this is bad so let's talk about the stuff here that doesn't matter um you know what let's just go ahead and change the color of everything that doesn't really matter to red that's a lot of stuff so how about we can get rid of all that stuff huh that's better also doesn't that look a bit like python so Talk's done if you just use Python then you're good to go maybe not okay so let's look at a bigger example and we'll flash some lights so we're going to make a little program that lights up the first three neopixels in this bar it's going to light them up red green and blue in turn and then they're going to stay on for a little moment and then they're going to clear and it's just going to do this forever so here is all the code for that you don't have to read all this I'll skim through it but there's a few things here um we got a whole bunch of imports we've got some mysterious line here that initializes the Neo pixel bar and it's weird because you've got to say pin but then you tell P1 and you've already told the kids that the pnp1 stands for pin so you're saying pin pin one but I don't really understand that then you just got this eight ah um and then in the loop you're using indexes and they don't you haven't started on lists yet this is an early program so what is an index uh and then after you've written in that you want that first pixel to be read then you've also got to do right and I'm now writing twice but I don't really get why so there's a lot going on here so what we've done is we've put together a fancy little library that you can just replace all of those inputs with from connected code import Star and then we've got to have a nice smaller program where we just say hey connect a bar light on P1 and they understand what a bar light is because it's the lights that are in a bar and also you've told them um and that function does what it says it connects a bar light and then in your Loop we've got set pixel and you set pixel zero you do have to tell them about zero indexing and then you give it a color and in fact this function is actually really robust if you want to pass in a string that's an uh hex code that's totally fine three or six characters that's fine with or without the hash that's fine if you want a string that looks like an array of the red green blue that's fine handle all of those really uh misunderstanding proof mistake proof um because typing in three numbers or looking up a hex code is not the learning like that's not the logic that's not the computer science that we're trying to teach that's a step and so and then we don't have a right step and then to clear it oh yeah I meant to mention that bit and then look at the bottom here to set it all back to black and clear it you've got to fill it with zeros and then right but we just turned it off and didn't write turn stuff on but it's anyway now we've got it's got Bardock clear and that clears the bar and we like that but that's pretty small example what about a bigger example um well one of the things that we wanted for our Escape rooms was to have RFID readers that way you could find various I don't know if you escape the room was magical themed or whatever you could find various potions and each could have a little RFID tag on the bottom and then you could put that on the sensor and you had to get the right potions in the right order um so here's all the code to make the RFID reader work um or actually once we've all wrapped it up here's all the code to make that RFID reader work and now yes absolutely that's abstracting a lot away but you can't teach a grade 8 kid who's never programmed before how to implement an i squared C protocol in three days it's not gonna happen and so you do this and then they can read a tag name and they can focus on the procedure and the logic and the steps and the problem solving and they can do cool things that they want to do and there you go they understand it they feel cool they make a cool thing that gets them excited so how do we wrap things up well I focus on a couple of main points the first thing I ask myself is uh what do they want to do and by this I mean like when I'm a student sitting down to work on a project and I think okay next I have to do x what am I putting in there well the biggest and broadest one is make a device do something I want to do something and for a bit more detail there we could be like checking a condition they might not know the term condition but they want to you know see if something some condition has been met C if it's ready to do something that kind of thing they want to update the state again might not know state but State includes changing those lights turning them on and off they want to update State and then again a bit broader they want to get input or produce output they all of these are kind of verb statements they're doing things so that's their goal and we want to help them get to that goal so what bits make sense to them this is the stuff that we're going to build off so we build off good function names A lot of the time in programming we have function names that make sense if you already know what they are I know that if I'm connecting to something via uart then I'll use the uart function but if I'm teaching a kid like oh yeah you know you're going to plug into this radio and then send the radio messages yada yada and so you type uart what does uart have to do with radio oh it's just not related and so a big emphasis is on good function names and that's why it had names like connect to Bar Light it might be long it might be a fair amount of typing but it says what it does and I think that's really underrated the next is clear steps this is what I was getting at with that neopixel initializing uh line there it had a few steps that didn't really make sense we were telling it connected on P1 pin one but then we have to tell it that that's a pin but surely like it should know that right one of the things that I was always taught when I was learning to program shout out to my mum um was don't ask the user for anything that you already know I know if I'm setting up a near pixel or any other peripheral I know if it needs a pin right and sure I don't know what pen it's plugged in on I've got to get them to tell me that pin but I have to get them to tell me that the pin that they're telling me is a pin that's known so remove those unclear steps clarify things um get rid of that eight that eight if you're wondering is how many pixels are on the bar but I as the teacher in this scenario I bought all those bars I know how many pixels are on those bars they don't have access to any other neopixel things it's those bars they all have eight I don't need them to tell me it's got eight they also understand generally if statements and I did want to call this app because programs that just do the same thing every time aren't that exciting to the kids they want to feel like stuff changes and so and and it's generally pretty easy to explain if statements to them the the classic example is if it's raining take an umbrella they're like oh yeah you check a thing and then you do a thing and so whenever you can strip the logic down to present it to them as if statements that is easier than a lot of other um like using functions that have sort of hidden implicit ifs that they don't know about and things like that and the last thing that makes sense and this controversial is variables eventually um variables are really hard to explain I'm sure any of you who have tried teaching programming will agree with me variables are one of the biggest stumbling blocks but they do get there and in fact most of them get there pretty quickly and so then you can keep using variables and you can build upon that and they will understand okay you put something in a variable and then you can use that and this helps keep um keep things going rather than having a sort of implicit state or a static class or things like that put it in a variable and they tend to understand that a bit better so what gets in the way well this is the stuff that we want to limit um and in a way it's kind of the exact opposite of that previous list but we're going to start with bad names um bad names are bad they they are confusing if the name is not clear it won't it it provides a barrier every time both to just using it correctly but also to remembering it and the ability to actually just sit there and be like oh yeah I know what I have to do that's really critical to feeling like they're achieving something and feeling like they're learning something for a lot of students if they don't feel like they can remember the stuff that they've been learning then they don't feel like they're learning and they don't feel like they're achieving eliminate extra steps like we saw with the neopixel where we had that extra right after we told it what pixel it is now to be clear I understand the difference between setting the color and using right if you've not used neopixels before they essentially just get treated as an array you put your colors in and then when you say write the whole set of neopixels updates but um computers are fast even like little computers like a kookaburra or a micro bit and as far as 99 of the stuff that the kids will be doing matters you could just write that every time it doesn't really matter so don't get the student to write it I'll write it in the wrapper um unnecessary arguments things that are confusing things where you have to specify stuff that should already be known a la how many micro how many neopixels are there if you can remove those by adding default arguments or even just not having them just fixing them that makes it a lot more approachable every time they have to have another comma and another thing inside the brackets it's another question of wait where does the bracket go and what order do these have to go in and have I done all of them or have I forgotten one so remove unnecessary arguments and then uh remove protocols I touched on this with i squared C and alluded to uart but when you have to follow a procedure that is Technical and has many good technical reasons for existing but you are just starting your technical Journey that procedure is impossible so you won't do it and that limits what you can do lots of really cool things use I squared C and use uart and use all sorts of ways to communicate over these protocols that students won't manage to get to and if you can do that behind the scenes for them and expose them in an abstracted interface that tell that offers to them what they want to do that will lead to them having a vastly expanded set of actions that they can do instead of features that they can implement and the last thing I consider is that consistency is key like really this is really key you want to build on what they know if they have learned how to use the basic functions like print or int build on that keep using basic functions that are similar to but distinct from print and int if they have understood a while loop build on that let them keep using while Loops reinforce that knowledge and help them to understand how you can remix that knowledge essentially into all sorts of different things so you're reinforcing these lessons they can keep uh using the same systems in different ways they will um become more familiar they'll become more confident and they will start to achieve a lot more and then maintain your patterns this is more comes to when using or making this kind of wrapper um but if you start to establish one pattern keep that going as much as possible when you have all these different peripherals like I showed they're all from different manufacturers and they all have different um different feature sets different interfaces different ways of operating that each one is a new thing that has to be learned and we've all come across that when you install a new library using pip or you get a new piece of hardware and you start using its interface and it's different to other ones and you have to spend quite a lot of time learning that that's time and expertise that the children don't have yet they don't have the time with a suitable teacher because you've got a whole classroom or you've got a bunch of kids you're tutoring or you're running a whole event and so you can't give them the one-on-one time that many will need to get across that interface and then also they don't have the expertise they're not confident in Tech they're not comfortable with reading documentation so you can't just say here are the docs off you go learn it they just never open that and then they will not do Tech and then they all drop out of the class and then they won't ever do Tech again because you have taught them it's not for them so maintain your patterns one that I really like to use is from English I mean lots of other languages but it's what we do here uh subject verb object I want my thing subject to do a thing verb about this thing object and we saw this with the bar light bar dot set pixel that pixel to that color same for the iPhone e-reader RFID reader Dot read tag name that one doesn't have an object not every sentence has an object sometimes the subject verb is enough she ran so how have these rappers gone when we've used them what kind of results did we see so as I said before we had four major events with these rappers and we run surveys before and after the events where the students answer a bunch of questions about what kind of stuff that they've done before the tech that they've done before how much are they engaged with stem what do they like yada yada and we asked them in various forms how much do you like coding totaling up the surveys from these events before the events about 26 percent of students have a positive opinion of coding and 39 don't um clearly that's not a lot of the kids so how did we go with using these wrappers well in the surveys after the events 55 of the kids said that they like coding and only 15 said that they didn't I think this is a huge success this is this is taking kids who genuinely didn't like coding thought like an end when I put this together I checked like is this are these results coming from kids who have done some coding and I filtered down to that and yeah they've done coding and they're like yep it sucks I don't want to do it but their school said they had to uh so we had them and then they did and then they liked it I think that a lot of the problem is yeah we're being thrown in the deep end and being told like yeah you're going to do this thing and you're going to work it out and there's a lot here that is difficult and then they're not given the support and they're not coped through and there are a lot of impediments to achieving things and I went through a whole bunch a whole bunch like 400 kids worth of the feedback and there's lots of it and lots of it was positive and one of the really recurring themes was that we made it approachable we made them feel like they could do interesting things that they didn't think that they could do we made them feel like they could read an RFID tag and when that the right tag is placed on the thing you could open up a box that was previously locked had a solenoid in it to be an electromagne like controlled by circuitry controlled by the kookaburri locked in there interesting things it's an escape room opens up because of code that they wrote and they can see oh wow yeah when I do this that happens and I think that's a really important thing I think this is as a slight tangent why devices like kookaburrias are really good is because if you first teach python using idle as an example and you teach them print hello world then they type into the computer and then text appears on the computer and and also text appears on the computer when they hit the Run button it's just over there now and like uh text appears to the computer when I type all the time like that's just what happens when you type I haven't done anything that's just what computers do but they understand the concept of two different computers and they understand that the kookaberry is a different computer with this little screen and so when you type display.print hello world and then you hit go and it appears on the kookaberry well now you've made a computer tell another computer to do a thing and that's big like I think that is a huge distinction that is vastly overlooked that gets them excited and then when you can go a step further and you have your computer tell the little computer to tell the box to unlock you can control a lock with a computer being controlled by a computer that you typed into that's good stuff they like that so how can you do this too well there's a bunch of stuff you can do firstly you can check out some of the demo wrappers that I've put together on GitHub um that's our organization and the repo I'll leave it I'm not about to change the slide anytime soon so take photos if you want um that has a few of these wrappers available for you there's a couple that are pre-compiled because also this is our business um and but there are a few of them that are just there as python files you can have a look you can see how I do them you can also see the cunning way that I have that connected code Library set up where you can import just from connector code import Star and you get all of the libraries and all of the wrappers and everything um you can make your own wrappers this is particularly good if you are not using uh cooker berries which I'll talk more about in a second most of you probably aren't using cooker barriers um but if you're using things like arduinos or raspberry pies um writing your own wrappers might well be the way to go um email me for advice my email's been on pretty much every slide it's also there's a second email for connected code that's on this side as well so you've got two of my emails now um email me and ask for advice or just show off that's cool I like to see what people have done um you can email us at Connected code um and we can come to you we go to schools and run events we and and they can be little events for you know four or five students who just need someone to come in and do a fun project um to help with you know a grade 11 or 12 uh software class um or we can come and run a huge event we've we've won ones for the escape room was 165 students I think the data objective was 180 students we did it for two whole grades each um and they were huge events and we can absolutely do that and lastly check out the kookaburries so the kookaburries uh real quick quote for them the Austin stem Foundation is really cool that a really cool stuff with the kookaburries and with supporting educational initiatives um the cookware is now available to purchase again you email them and sort it all out the reason for that process is because they have had been supply chain issues crypto miners chips ordered you all know that or if you don't it doesn't really matter um but they're available again so check those out at Austin um that's pretty much it for me there's a nice picture courtesy of Apple uh does anyone have any questions yeah oh yeah there's Mike coming that's better because then everyone on the recording can hear that is there a mic I don't know do I have to just come and that's good Tech stuff there we go oh yeah [Music] thank you thank you mug okay question I'll get on that thanks very much for the presentation Jack thank you I had a curious question when you're introducing coding to kids of I don't know no matter the age do you jump directly for them to use Hardware like koled like a kugaberry or a robot or a raspberry whatever or do you spend some time purely with coding with things like scratch or something that takes only like software related so basically yeah the question is like to introduce them you jump directly to software and Hardware or you spend some time with silver only and then once they know the basics jump into Hardware as well I think jumping the hardware um is the way to go I think because of that distinction I was saying about um bringing like making your computer make another computer do something I think that's a really exciting moment for a lot of kids and I think the sooner you can get to that the sooner you will get them interested and this is important because the longer you take to get them interested the more disinterested they will become and the more kids will decide that it's not for them and they're not interested yes that's a great Point thank you Renee who is the CEO of connected code um one thing that we do do for younger kids is the Austin Foundation also uses uh blockly they have their own slight variant called cooker blockly um and so these kookaburries can be programmed using blockly that's great for the younger kids um the rapper concept doesn't really apply to blockly because you there are fixed blocks and such but we have also worked with the ostam foundation to add in a few blocks when needed to essentially do the same thing and you know here's here's a block that does this little feature fakes the channel on a broadcast radio or something like that um so yes great question and great suggestion thank you yeah um thank you Jack um so I'm curious about what happens and I know you said it's sort of the one percent case what happens when the student hits the edge of the of the rapper and I'm I I know there's lots of things you could do but I'm really curious how that pans out in the classroom and what your experience has been with that yeah terrific question um so um one thing that I didn't highlight as much in this talk as I could have or should have I don't know there's a time limit um is that with these rappers we aim for differentiation so we have a few different um functions a great example is with the potentiometer which is um I think I remember one of the demo ones where we give them like read in a number of steps and it will just give them a number between 1 and 20 or you can read percentage which I'm same thing one in a hundred but we also just give them read which lets them get the whole number as a 16 bit integer um lets them see Zero to six five five three five and then they have to do the maths to work out what divisions they need and if they get beyond that then they can start importing in other things that like the actual libraries that our libraries depend on um and that's just for the potentiometer for other ones you can have um we have a bunch that have optional parameters so with the neopixel bar and our other Neo pixel sort of modules um there is actually an optional parameter where you can say how many neopixels you have and so if you do buy a different thing you can and different stuff there with the RFID reader those you can specify and address to daisy chain them um and we just always secretly hide away the default address but if you specify an address you can connect more of them and so by putting stuff behind default arguments or having multiple functions that kind of do the same thing but with more or less assistance that's how we let the kids who are really progressing get into the more interesting and more advanced stuff without sort of giving them a hard stop of well now you have to really Dive In The Deep End on your own well we focus on teaching this stuff to the other kids I was I was waiting to cut you off we are out of time I know there are more questions I'm gonna throw Jack under the bus by saying around out outside at morning tea there's also the Discord I have connected to the Discord so message me um we have 12 minutes from morning tea generous time but as you're packing up um I want to throw just a slight the next talk is perhaps the most controversial of the entire conference come back to find out why it's also about Pi game it's really awesome come and join us thank you so much thank you Jack [Applause]
Info
Channel: PyCon AU
Views: 316
Rating: undefined out of 5
Keywords: JackReichelt, pyconau, pyconau_2023
Id: QSETqBJ6kkU
Channel Id: undefined
Length: 35min 36sec (2136 seconds)
Published: Thu Aug 24 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.