Teaching Julia to Children

Hi,

I’ve learned Julia some time ago by reading its documentation multiple times. It’s amazingly well-written! However, it is tailored for people with a university background. I want to teach programming to the next generation, specifically my children. How did you, or how would you, approach this?

There are two ways I might approach this:

  1. I am considering rewriting important parts of the Julia documentation in a less mathematical and more accessible style using the package Documenter.jl.

  2. Writing it in a tutorial style with projects, perhaps focusing on the math and physics taught in school. For this I would also use the package Documenter.jl. While doing this, I would include many comments in the code referring to the documentation so that important parts are referenced and can be systematically updated.

Does anyone have experience with teaching a programming language to the next generation? What I want to avoid is making it seem boring for them, causing them to lose interest.

Best regards,

André

8 Likes

I would do something like your 2, but avoid Documenter.jl; I would use Jupyter notebooks. Seems to me like a much more accessible medium for your target audience as it interlaces normal text with code and figures rather straightforwardly.

CU!

George

6 Likes

Using Jupyter Notebooks is a good idea. Maybe I should use Literate.

you can draw inspiration from my Zero2Hero if you like : GitHub - Datseris/Zero2Hero-JuliaWorkshop: Intensive Julia workshop that takes you from zero to hero

this is what I use to teach BSc students with only rudimentary programming familiarity. Perhaps you can take parts and simplify more according to what you need. I’ve never taught pre-BSc humans so I can’t judge how advanced the material is…

5 Likes

There are some nice sample notebooks in Pluto’s gallery page. Some may be a little challenging for school students, but perhaps you could build on those.

7 Likes

FYI:

and Introducing Julia - Wikibooks, open books for an open world

Please feel free to update the wikibook. They probably do not want or support notebooks, but they might be ok with links to? However, while many people like notebooks, they aren’t considered good by at least one person, for the right reason(s). If I recall it had to do with Jupyter notebooks being non-reactive, and that doesn’t apply to Pluto.jl. So Pluto is better and some Jupyter Python replacement that was based of Pluto’s ideas. I don’t keep track, maybe Jupyter is reactive by now; or maybe only with some extension?

May I ask how old? Or how old you think you can target? The expert programmer Tanmay was only 15 year old when he wrote the book above, and it wasn’t even his first book, actually his third, had also been working for IBM etc. At least read there online publicly available “About the author” and not the forward from Dr. Viral Shah Julia’s cocreator.

1 Like

I personally also would recommend Pluto.jl Jupyter adds another layer of technology and even more confusion, in my opinion and experience. Pluto.jl is just another Julia package and everything works out of the box.

9 Likes

Julia is certainly my favorite language, but as a first language I always recommend Processing because of the immediacy and intuitiveness of the output!

This Processing centered youtube channel is especially good for kids.

Julia would make a perfect all purpose language to learn second!

4 Likes

I also think Julia is a good later language. Scratch and Hedy are aimed at kids. Racket has a curriculum designed for age 12-13.

3 Likes

Depends on how old and how much experience they have.
I think the key on kids is interest.

Show them how they can solve their math schoolbook problems with Julia, or how to program a simple videogame and they will love it :slight_smile:

(especially for the “videogame” option, sratch and scratch junior are great for small kids)

2 Likes

Depends on their age and interests.

Generally, as a first programming language, I would use the generic Algol 60 parts of Julia: here is how you define a function, a loop, use an array, make a struct, etc. Play with the REPL as a calculator. Implement simple algorithms, like the Sieve of Eratosthenes.

I would stay away from code optimality, inference, macros, packages, tooling, and anything that is just too much to digest. So, basically, you would be teaching Julia because you know Julia, not because you require anything Julia-specific.

I would definitely not do that, dealing with tooling as your first encounter with programming will just sour the whole experience. Tooling is necessary, but it is not the fun part.

Ditto. Don’t make them write documentation.

6 Likes

Thanks a lot for the replies so far. I’m targeting the age group between 10 and 15 years.

One of the main things is that I want them to grow up feeling it’s natural to use a programming language. Later, they should use the documentation to dive deeper into Julia.

My children use/used Scratch first. It will also be taught in grades 5 and 6. They have so much fun seeing the results.

One big issue is that code without results can look boring.

I think a tutorial is the right way, and I have an idea that is evolving. It could be like a “Treasure Hunt” , where problems have to be solved using Julia. The most important thing is that psychological effects are taken into account, and they feel that they know some Julia afterwards.

A tutorial in the form of a story could have 20 chapters. In the beginning, a boy and a girl and the reader go into a library and find a mysterious book.

They are fascinated by it and want to find some kind of treasure, let’s say from the Vikings. The map to the treasure, either a text or a picture, is encrypted. (I would use a decryption algorithm in Julia.) However, they get the password step by step (in each chapter) by solving the treasure hunt. In the end, they use something like decrypt("password", "encrypted_text") to solve the riddle. Each chapter contains part of the story and small programming tasks that have to be solved on the way.

2 Likes

I remember from my early days that I found it much more exciting if the computer did something with the “real world” rather than just calculate some number or run some algorithm. Things that I’d group into that category:

  • the internet (downloading/scraping something/calling some API and getting a response)
  • hardware
    • display an image, a video, or an interactive visualization
    • play some sound
    • interact with some other device somehow

Playing with an arduino I had so much fun just making LEDs light up.

For example, you could show for loops and arrays by building sentences and sending a command to the computer to use the silly inbuilt computer voice, and make it sort of mad-libs style by interpolating random words from a set or dictionary into those.

(This works on my mac, other OSes might have similar commands)

animals = ["dog", "cat", "duck"]
sounds = ["woof", "meow", "quack"]
for (animal, sound) in zip(animals, sounds)
  run(`say The $animal says $sound`)
end
2 Likes

You know your own children best and should be the best person to make up an interesting problem they can solve with Julia.

That said, I am skeptical of the approach of pouring glitter on everything just to interest children. I think that the problem with Scratch is that it is full of distractions and does not achieve the purpose of getting children interested in programming per se, because that knowledge is hidden under so many layers of visual concepts. I have seen children who completed a Scratch “programming” course, yet have no idea what loops or branches are (though Scratch has both).

If you insist on graphical elements, and interactive play, you will be spending a lot of time on interfacing those parts. Moreover, to be honest, these are not Julia’s comparative advantage.

1 Like

I also believe they should use “real” Julia, but embedding it into a story is another matter. Let me provide an example: suppose there is a riddle involving an ancient text.

ancient_text = "☥♠♣ ☧♣♥ ♦♤ ♠♣♢♣"

ancient_dict = Dict('☥' => 'T', '♠' => 'H', '♣' => 'E', '☧' => 'K', '♥'  => 'Y',  '♦' => 'I',  '♤' => 'S',  '♢' => 'R')

decoded_message = replace(ancient_text, ancient_dict...)
println("Decoded Message: ", decoded_message)

Among other things, this would help to explain strings, characters, and Unicode and still be interesting.

5 Likes

Actually, your last post is a fantastic example for young children!!! I will absolutely steal it for when I have kids!!!

I think a good approach to making young children appreciate programming is its “efficiency”: you make it do a task you can do but faster. This decoding example is very nice. Because you if you have only a sentence, you can do the translation yourself. But then you give your kids a whole A4 page (that has been first transcoded with Julia) and you’re like “well, we don’t have all day to decode! That’s when we can turn to a computer!!!”

1 Like

The great thing about Julia’s strings (and your example) is that one does not need to bother understanding what Unicode is at an introductory level. Those are characters, and strings are made up from characters (just don’t index them, iterate instead).

The user learning programming would not need to know about Unicode and encodings at all. (Except if you want to tell them about the olden days, when we only had ASCII and various ISO encodings, and used to walk five miles to and from school, uphill both ways, etc).

Have you consider getting them to read “Goldbug” by Eager Allen Poe and have them decrypt the treasure message?

julia> ciphertext_goldbug
"GBXXFBIGDDOLKEMNODEXHDEXDKMIOLKEMFMUOIDDMGKZXWKJXLMFMBWMMDGLFKEOWKMMLYOLTKMDLXWKEMGDKGLFNJLXWKEYGOLNWGLCEDMUMLKEIOYNMGDKDOFMDEXXKZWXYKEMIMZKMJMXZKEMFMGKEDEMGFGNMMIOLMZWXYKEMKWMMKEWXTBEKEMDEXKZOZKJZMMKXTK"

1 Like

I think my first programming experience was with terrapin logo; I remember the creative/visual aspect was engaging (try to make the turtle draw something you imagine), and being able to use loops to make spirals and such helped me see the possibilities of programming (“oh I don’t need to type this 20x, I can just do a loop”).

Pluto has a similar notebook: Turtles – introduction

5 Likes