What is your go-to project for learning a new language?
24 points by Toric
24 points by Toric
Ive been playing around with learning a lisp language for a while, and I recently decided to go for it and learn fennel (as I already am comfortable with lua) just to see if I like lisps as a class. Normally, I try to do the first 5-10 days of a previous advent of code to pick up a lang.
Setting up my advent of code environment got me wondering: what projects do other people use to learn new languages/tooling? Id love to hear how other people approach learning a new skill.
I like building a web app. It can start very simple, for instance by simply responding 200 OK to all requests, and then expand in whatever direction I'm most curious about at the given time: Templating, parameter handling, input parsing, talking to a database, consuming an external API, whatever. This naturally leads to not only learning about the language itself, but also its ecosystem, the community around it, where to find help, and so on.
I also like advent of code, but it's a style of programming that is mostly disconnected from my other work and projects.
My go-to projects are
Those align with my interests, and can be done with a lot of twists, so I don't mind doing them repeatedly. Also, both projects can be done without dependencies (or with relatively simple libraries rather than complex frameworks), in contrast to, say, a typical web app. So I can focus on practicing the core language rather than learning new frameworks and the ecosystem at the same time.
I usually build a Sudoku solver first when I learn a new language. This project has a number of desirable properties:
I have yet to find a more suitable problem for learning a language in a practical way.
Conway's Game of Life can be a fun project!
I used to write IRC clientsn! It worked really great for me and I used to recommend it to everyone as well, but these days IRC is a bit dead I think (with lots of alternatives) so the end result may not be as useful for some people as they might like.
I did it with Python, Java, Haskell, C, Rust.
It teaches you IO (stdin/stdout, sockets), concurrency (to handle IO events from the stdin and sockets concurrently), and some libraries and GUI programming as well if you want to do it as a GUI rather than TUI and depending on how much you're willing to do yourself vs. just calling into a library.
These days I learn on the job.
(And yes, this is how tiny started.)
Ironically (or is it? Amusingly?), mine is implementing a basic lisp language interpreter.
Conway's Life is a good one, or other simple (non-graphical) games like tic tac toe or hangman.
Apart from that, digging through old code repos, it seems I mostly write boring stuff like reimplementing data structures or sorting algorithms.
For learning basic syntax, patterns, and idioms I always start with creating the common collection types from scratch (vector, linked list, map, graph). To dip my toe into the standard library and broader ecosystem I usually like building a web app of some kind.
The only reason I'd learn a new language nowadays (since I am a master of D which is the best language ever and suitable for all purposes) is because I've been assigned to a project that requires that knowledge... so the go-to project would be the the specific assignment.
I tend to find maintenance in unfamiliar languages a lot easier than new projects since I have the existing code to build upon and copy...
AoC is nice but I usually can't be bothered doing it again, as I often do 2 languages in December anyway (either it's a year with little time, then I do one thing or I want to learn something then I try the new thing, but switch to Python if I just need to get it done, and then redo the new lang).
I suppose I either have a project I want to try or rewrite anyway. IRC bots are one of my favourite, or some small web app if I want to use the language for web dev.
But overall I wouldn't say I have a real go to and can point to even 5 implementations of the same thing.
+1 on IRC bots. It is super simple but requires networking, string processing, unicode handling which can provide a good overview of the language's basic ecosystem (standard libs/dependency handling/build environment/tooling) quickly.
I usually like making some weird 3D visualisations, often system monitor data tied to 3D elements like cubes. I tend to use Raylib for it since it's for so many languages.
I like Hamurabi as a „Beyond Hello World“ project.
Input parsing, simple data structures, plus I can have fun with inventing different scenarios.
Static site generator.
I like to test I/O capabilities on files and networks and I have a thing for "vintage retro" technology, so I usually make a barebones gopher server.
I write a Formula 1 News aggregator as my first task in most languages.
It needs to:
So it has to actually do some web requests, parse XML as well as content from it (like dates), do some UI, paginate/infinite scroll loading, etc. It works nicely as a toy task for web frameworks, desktop apps, mobile apps, etc.
Mine’s a simple time tracker. Can be a UI app in languages where that’s a common target (Swift, Kotlin, web frontend stuff) or as a command line program, could be as a local app or one with a server backend, storage can be in a JSON file, database, or API…
An RPG dice roller. You have the standard set of D&D dice (d4, d6, d8, d10, d12, d20), and you read in dice notation and generate a random roll for it. For example "3d4 + 2" means roll 3 4-sided dice, add the results together, then add 2 as a flat modifier.
This is a small, super simple but non-trivial project you can knock out in a day that touches:
Add ontop whatever you particularly wanna learn. Webdev? Make it a server that reads input from a POST and stores roll history in Postgres. Gamedev? Bind raylib and have actual 3d dice roll on screen. Scientific computing? Go all in and make a more industrial dice roller like https://anydice.com/ but for comically huge numbers of dice and return a report comparing the actual distribution rolled vs the expected distribution.
It touches many things, but not too deeply. Just enough to get a sense of how the language thinks about things. You should be able to knock out a complete working version really quickly.
This puzzle is from the NES game James Bond Jr. It’s a hybrid of a sliding puzzle and a Rubik’s Cube. It’s a good candidate for trying a brute-force solution first and then optimizing it in various ways. https://youtu.be/sRZNDnXU8B4?si=-qGfcWHXNt2IYAqV&t=6570
Mine is writing a parser for a random custom programming language or writing a simple lisp interpreter. Another project I like for trying new languages is writing a simple GUI web or native (if the language has bindings for something like gtk or for a custom toolkit)
An MPEG4 container parser. I started doing it with QuickTime (in elisp!) and then just kept going.