Glad you asked.
As anyone that has tried to teach arrays can tell you they can be a bit dry. Sadly, the best way to really understand anything in programming is to practice. One of the best workarounds I have found is storing music in arrays. My AP kids never really got into the classic drunkards walk program, but make it a random set of notes on a kazoo and tuba and they were all over it. Music lets them play, which means more practice.
This is fairly simple to do. Each note is a number, or an object, depending on the language. I have done this in Scratch, Visual Basic and Java with the kids. Scratch music is built right in, in VB we use the Beep command, and in Java I use the JMusic tools.
And what, you might be asking, does this have anything to do with You can Call Me Al?
If you listen ahead to about 3:30, there is a bass solo. A Palindromic bass solo. The first part was recorded by Bakithi Kumalo, then played backwards for the second half
- Play the video - ask them if they notice anything about the bass solo - you might need to play it a few times, and it helps if you have some band kids in the room.
- Make sure everyone understands palindromes
- Code a tune - store your notes in an array.
- Create a new array that will store the original tune, then store it backwards.
- So if your original tune was: A B B D E the new array would store A B B D E E D B B A
- Demo the songs to the class.
Another extension here is to watch the video of U-Bassists Abraham Laboriel and Bakithi Kumalo jamming in 2012. What happens if a musician makes a mistake on stage?
I am planning on using this as a journal prompt this year. One of the hardest things for new programmers happens around mistakes. Sadly this is a by product of much of the rest of their education. They are trained to find the right answer. In computer science we care most about the correct solution, and that is usually going to take several tries. Sometimes the mistake points the way to a better solution. My goal is to get them to embrace their mistakes.
- Making Music with Java - by Andrew Brown
- More info on jMusic you can download it here: http://explodingart.com/jmusic/GetjMusic.html
- Bakithi Kumalo Video playing the solo - on a fretless bass! Starts at min 2:20. While you are at it look at his hat - so want one.
- And if you are really in the mood for more bass: U-Bassists Abraham Laboriel and Bakithi Kumalo jamming in 2012
Curious if anyone is using music in any other languages - if so, please share.