julngomz

julngomz

Elixir + Functional Programming in 9-12 High School

Hello All,

I don’t know how to ask this question or if I am asking it in the right place, but I need some suggestions/guidance. I am currently taking EDU courses in university that revolves around designing and assessing curriculum in K-12 gifted students.

On of the main projects is designing a curriculum that uses the CSTA K-12 Computer Science Standards and Core Standards (I am in Iowa, so I’ll be using Iowa standards for Technology Literacy).

There is already a plethora of information in Scratch and Python, so I am trying to design something for Elixir and Functional Programming.

My questions are:

If you had to teach functional programming in K-12:

Where would you start?
How would you do it?
What would you teach?
Would concurrency be better off taught in another semester of the course, say two courses one in the fall the other in spring?
If you were in high school, what would you have wanted to learn?

Here is a quick outline that I have going on:

Unit 1: Getting Started: Background, Tools, Brief CS Overview
Unit 2: Computer Science Fundamentals: Variables, Conditionals, Functions
Unit 3: Data Types: Integers, Characters, Boolean, Atoms, Structures
Unit 4: Organizing Data: Modules, Functions,
Unit 5: …
Unit 6: …

Each unit will have a project at the end.

Thanks in advance!

Most Liked

bnly

bnly

For starters I think I’d leverage what they already know. For example, at lower levels they at least know what adding and multiplying are, so you can introduce the concept that you can have an “add” function that’s a bit like a box where you put in two numbers and get out a new one.

Higher grades have exposure to some algebra so you can work with that.

Anything that can be quickly used to solve real problems for them is also useful. For example just learning to use a REPL like iex as a fancy calculator already brings real value.

I’d show the absolute minimum in data structures and conditionals to get them writing code. So eg. you can start with just strings, numbers, lists, functions and if at the beginning. Bring in atoms, tuples, maps etc gradually, as a solution for a new problem.

I’d also try to introduce ideas of declarativeness vs imperative code for higher levels. This also fits with what they see in school, ie “let x = …”

Something a lot of educators miss is the importance of leaving mystery. If you can possibly get them to “hey, this is so complicated with all these if blocks I just wrote, is there a better way?” instead of pushing every conditional at them right away, I think it’s a better learning experience. So instead of “here are all the conditionals because this is the conditionals unit” I’d probably sprinkle them more.

It’s so tempting to be focused on making the order of modules look organized at the course plan level that it’s less fun. So eg. you could show them pretty early on how to bring in a dependency and use something like Req to access a fun API. They could do something like build a “what should I wear today based on the weather” project as one example.

Also obviously Elixir isn’t the only option for teaching FP – you could show them browser JS for example – but LiveBook seems like a no-brainer here for teaching Elixir.

Anything that can create games will get a lot of students excited. For concurrency maybe an early way to introduce it is “here’s how to do things in the background” and for higher levels you might even build a multiplayer game together or a messaging app.

Collaborating as a class on a bigger project could be interesting instead of everyone just doing smaller projects. It better reflects what building software looks like in the real world and you could build it on github/etc. too.

bnly

bnly

I like the LiveBook focus and “real world” orientation a lot.

Based on my own learning path with programming – I started from a young age – I think something I’d focus on is getting them quickly to self-directed because it’s a maker space, more like creative writing than eg. pure math where you’re just learning and solving problems for years.

A training wheels metaphor could be useful, where as soon as they’re on the bike, as much as possible you’re letting them steer and pedal, but helping them stay up until they’re good on their own. The training wheels to me would be things like computer science concepts and language details. They’re useful but ideally should be learned alongside doing stuff.

You’re right not all kids will want to program robots–but some might–others might want to build art, some might want to create a discord bot, some might want to make games. Someone could hook up an LLM wrapper and make a “do my English homework for me” bot, or more appropriately a homework helper at least.

There’s a lot to be said for the “case study” approach to learning, where you could deliberately have a few small but cool projects that pair real-world stuff (eg. save to a file, connect to a REST API etc.) with computer science concepts. And then it only takes a few of those before they can do their own thing. I’d get to “individual project” or “group project” early if possible.

Also we have to admit Elixir isn’t the ideal choice for every problem, since it’s best suited for things with networks and servers, but that’s a lot of stuff these days.

julngomz

julngomz

You’re absolutely correct but given that majority of the content that I have found is based on Python, Scratch or Minecraft I want to introduce another way of doing and approaching problems. Elixir might not be the right tool for every problem but it sure does make it easier to grasp the why and how something works.

I also program in C and Rust but that’s far more complex and I don’t want to bog them down with concepts such as the CPU, memory, pointer arithmetic and undefined behaviors. That will just put them off and stifle their creativity. I want them to have an idea, jot it down, and implement it.

My focus in CS is cloud computing and distributed systems and I find that working with Elixir I can express the ideas better.

Here are some projects that I want to implement — some might be complex:

  • HTTP Server/Client
  • TCP Server
  • WebSockets
  • Messaging App
  • Real-Time Interactions with PubSub (Drawing)
  • Kahoot-It Clone
  • Clinic/Coffee/Dentist Web App (Get them thinking on where they can implement elixir + phoenix)

Where Next?

Popular in Questions Top

joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 record...
New
Werner
Hi, I’m using Ubuntu 18.04 and after updating to OTP-24.0 yesterday i have this warning when I run “mix local.hex”: 14:57:30.512 [warn] ...
New
quazar
How to set Jason to encode all fields in ecto schema, I don’t care about security and implementing only is taking long list of attributes...
New
mgjohns61585
Could someone help me? I'm making my first elixir program, number guessing game. I can't figure out how to convert the user's guess from ...
New
makeitrein
Hey all, just started picking up Elixir last week and am writing a scraper as a learning project. Baby step #1 is extracting the number ...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
kostonstyle
Hi all I want to have a unix time, from the current time plus 1 hour. DateTime.now + 1 hour How to get it in elixir? Thanks
New
Exadra37
Sometimes I want to check if the input into a function is not a blank string. My first approach: defmodule Example do def do_stuff(s...
New

Other popular topics Top

srinivasu
How to handle excepions in elixir? Suppose i have A, B, C ,D, E modules. and each module has get() function. A.get() method will call th...
New
dotdotdotPaul
Okay, I'm having a heck of a time trying to figure out how to best handle the validation of belongs_to associations in Ecto. I'm sure I'...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
yawaramin
In the Dialyzer docs ( http://erlang.org/doc/man/dialyzer.html#requesting-or-suppressing-warnings-in-source-files ), there is a way to tu...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
vac
Hi, I'm quite new in Elixir and I'm trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and ...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New

We're in Beta

About us Mission Statement