https://sudoroom.org/algebraic-data-types-in-rust-whiteboard-style-kung-fu-…
Algebraic Data Types in Rust Whiteboard Style! Kung Fu at our Women and
Non-Binary hack nightSummarizePosted on:
Romy Ilano <https://sudoroom.org/author/romyilano/>August 13, 2024
<https://sudoroom.org/wp-content/uploads/2024/07/Untitled-Notebook-5-2.jpeg>
<https://sudoroom.org/wp-content/uploads/2024/07/Untitled-Notebook-5-2.jpeg>Starting
off with a wikipedia entry and whiteboarding from there with Jade!Humans
and Whiteboards First!
<https://sudoroom.org/wp-content/uploads/2024/07/IMG_9927.jpeg>
As you know, after holding a session on “Learning how to Learn
<https://sudoroom.org/wiki/LearningToLearn>“, we realized that the best
thing about SudoRoom is that we love tech but want to *use our tech wisely* for
the forces of good. We decided to switch to a whiteboard first format with
no online or hybrid component, just a bunch of human beings face to face
during our Rust session at women and non-binary hack night!
It was a little different. Of course we still had laptops nearby, but
mostly closed, and a tablet if we absolutely had to look things up online.
<https://sudoroom.org/wp-content/uploads/2024/08/IMG_9931.mov>Whiteboarding
at Women & Non-Binary Hack Night
What resulted as a cool “jam” as just about everybody was able to grab a
whiteboard marker and participate!
We were nervous… would this work? We set up the whiteboards, laid out the
tables, and hoped people would be into this freestyle form of symposium!
Mothball and Jade led us through a journey of all their favorite ins and
outs of Rust and even the Haskell programming languages.
Algebraic Data Types: Let’s Start with the Wikipedia Definition!
Jade explained that even though the initial definition of “algebraic data
types <https://en.wikipedia.org/wiki/Algebraic_data_type>” in the wikipedia
entry has language that’s a little scary if you’re not deep on math or
computer science, you can just take apart the definition piece by piece to
learn while in a conversation with others.
<https://sudoroom.org/wp-content/uploads/2024/07/Untitled-Notebook-5-2.jpeg>Starting
off with a wikipedia entry and whiteboarding from there with Jade!
It feels a lot less intimidating if you can ask people in person, and
sketch things out in examples. Plus people who work as engineers could give
out examples (like a URL builder out of an enum in Swift), creating a
mini-symposium of happy, smart people drawing things out on a big
whiteboard for fun!
<https://sudoroom.org/wp-content/uploads/2024/07/Untitled-Notebook-5-12.jpeg>Talking
about Recursion and Stack Overflow in Whiteboard
It’s nice to step away from the computer screen and discuss recursion and
stack overflow. So much less dry than an online class, and these notes I
took were outside of the whiteboard fray!
<https://sudoroom.org/wp-content/uploads/2024/07/Untitled-Notebook-5-4.jpeg>Functional
programmers LOVE recursion!
This was also a fun way to get embedded engineers in dialogue right before
we went down the rabbit holes journeying from Rust to Haskell (!) But for
the others at the women and nonbinary hack night, it’s nice to get down
lowwwww and talk about memory in these systems programming languages and
even the exotic, weird languages like Haskell.
<https://sudoroom.org/wp-content/uploads/2024/07/Untitled-Notebook-5-11.jpeg>Things
get Weird in a Good Way
Some parts got pretty wild: I think at this point Mothball was showing us
how they used an enum (algebraic data type) in Rust to do math for all
natural numbers… I think it was a “Reverse Polish notation” calculator?
Can you imagine using enums to do all your addition of natural numbers?
<https://sudoroom.org/wp-content/uploads/2024/07/Untitled-Notebook-5-3.jpeg>
The notes had us on a discussion of pattern matching in Rust with algebraic
data types. When you wield algebraic data types the right way, you can do
tons of pattern matching and avoid uncertainty and errors, especially in
data structures that handle stuff like network calls! The pattern matching
can avoid tons of boilerplate code and if/else statements and totally nasty
crashes!
<https://sudoroom.org/wp-content/uploads/2024/07/Untitled-Notebook-5-9.jpeg>Pattern
matching is awesome in Rust! And it makes invalid states totally
unpresentable!!!!!!!
<https://sudoroom.org/wp-content/uploads/2024/07/Untitled-Notebook-5-7.jpeg>
The notes get a little wacky here, but what was nice was that we could take
notes and investigate later.
https://gist.github.com/CMCDragonkai/9f5f75118dda10131764
<https://sudoroom.org/wp-content/uploads/2024/07/Untitled-Notebook-5-5.jpeg>
And it was so nice! Everyone stood physically closer to each other, and
even though a lot of us were noobs at Rust and had never touched Haskell,
the advanced people made it easy for senior and advanced beginners to
understand. Even people who usually program C were able to join in!
<https://sudoroom.org/wp-content/uploads/2024/08/IMG_9930.heic>
Fun times! We look forward to more in-person meetups. Why meet online when
everyone is sick of online meetings? Is it really healthy for people to
only socialize and do hacking from a discord channel in their bedroom, when
it’s so much nicer to connect with people in person in a crazy hackerspace
like sudoroom? we say YEAH!
=============================
Romy Ilano
romy(a)snowyla.com