Elixirland - a collection of assignments, each with an idiomatic example solution

Since I started using Elixir, I have benefited greatly from being able to study various open-source projects. The codebase of LiveBook, in particular, has been a valuable resource for me. However, I also found that having access to a broader range of projects would have been even more beneficial (and from what I gather I am not to only one!).

This is what drove me to create Elixirland — a collection of assignments, each with an idiomatic example solution, intended as a learning resource. The goal is to provide learners with a diverse range of open-source solutions to well-defined problems (i.e., the assignments) and to encourage community discussions around these solutions.

Currently, my focus is on making a few assignments public to get the ball rolling. Over time, and with your feedback, the assignment descriptions and example solutions will be improved. Ensuring that the code in the examples is indeed idiomatic is important, though early versions may need refinement.

One challenge I anticipate is addressing the varying levels of consensus on what is “the right way” of solving different parts of an assignment. My aim is to implement Elixirland in a way that helps users understand where consensus is strong and where is might be weaker. Over time, I will be able to focus more on tackling this aspect.

Go to elixirland (Elixirland) · GitHub to find out more about Elixirland.

Currently, one assignment is public. It’s called Xl Phoenix API and can be found here: GitHub - elixirland/xle-book-club-API: Build a simple Phoenix API for a book club.. As you can see, writing tests and documentation are also part of the assignment.

Contributions are welcome.

P.S. Elixirland will also be accessible at https://elixirland.dev. Coming soon. I’ll post when online.

28 Likes

That’s an amazing idea! I have just recently started reading hex.pm source code and figured out that it’s a really good way to learn more advanced functionalities of your tools and discover more idiomatic solutions to problems because during project-based learning i don’t really go through all the documentation regarding topic related to the problem i’m solving and even when i do go in depth there’s usually not a lot of info on when it’s the best to use it and when to avoid it.

You’re doing a giant favor for people which want to advance from begginer to intermediate or from intermediate to advanced while preventing newcomers from introducing foreign concepts from other languages which don’t work well with elixir which could’ve harm quality of libraries, with such active community i’m sure elixir will be the first functional language to achieve widespread market adoption :slight_smile:

1 Like

The link at the end should be modified to remove the period.

3 Likes

OK, this is extremely neat, I was thinking of doing something like this but by breaking bigger projects into smaller pieces.

I am ready to be a full contributor, count me in.

5 Likes

A humble first version of https://elixirland.dev/ is now online.

4 Likes

Great to hear!

1 Like

This is very awsome! Hats off!

2 Likes

I’d really like something like this but about telemetry. I understand technically how it works, but setting it up to be practical and actionable is beyond me apparently :slight_smile:

4 Likes

Good one. Let me know if you have any ideas about specifics.

Currently setting up three Elixirland exercises to get things started. (1) Building a Hex package, (2) chat room with LiveView and (3) a simple server API.

But def interested in any other suggestions.

2 Likes

Like that idea also. Maybe different exercises can build upon each other…?

2 Likes

I’m looking for feedback on the description of the exercise titled “Book Club.” If anyone can spare a few minutes to review it, that would be super helpful.

The description needs to not only be clear but also engaging, encouraging people to participate. This is the first Elixirland exercise, so your input will help set the tone for future descriptions. I’d love to hear your ideas :slight_smile: .

You can find the exercise description here: xle-book-club/README.md at main · elixirland/xle-book-club · GitHub.

1 Like

Perhaps a tutorial where you pick a popular elixir library, identify the relevant data structures, go over how to implement those data structures individually, then in the final section you compose those data structures into a rough version of the finished library. If each project has a defined list of prerequisite data structures the reader needs to know, they can brush up on those topics before completing the rest of the tutorial. This also allows the reader to see how the same data structure can be used in different contexts.

I’m not sure which library you’d choose but I’m not sure it matters that much. You wouldn’t have to handle all the edge cases of whatever you choose as it’s just a learning guide, just cover the big ideas for the problem

1 Like

Tutorials in combination with exercises can be great, I think. For now I want to focus on the exercises, though, and do that one thing well.

2 Likes

Maybe what you had in mind is similar to this exercise?

2 Likes

By the way, it would also be great to get feedback on that exercise.

1 Like

Is probably one of the hardest things to learn/teach in Computer Science IMHO, as most examples are small and they do not make any sense to split apart and big examples are often too complicated to teach the point. And I’ve never seen a project that implemented full on domain driven design being successfull :thinking:

3 Likes

Do you think it’s achievable?

1 Like

So, Phoenix / Elixir gives you a lot of tools to help you with breaking up big apps, there is:

  • Phoenix Contexts / Modules / Umbrella apps/ The fact that any file can live anywhere is great for Domain logic.
  • Phoenix pubsub for eventing / realtime communcation between parts
  • EXQ / background workers
  • OTP for singular state enforcement
  • Opus.Pipeline for workflows
  • Statemachines

et cetera. The core issue IMHO is the question “when should we use which part”, so that we:

  • Don’t make things even worse (ever tried debugging an app that is strung together with Pubsubs? Sideeffects with sideeffects)
  • Do not get stuck in refactor hell (lets change the wheels on a car while driving!).
  • Don’t get stuck in a Design Pattern hell (FactoryFactoryFactory).

I think you can teach all of the tools of the toolbox above, but knowing when to use what is mostly down to experience IMHO. My teacher used to call it “Navigating the swamp”.

Now that I think of it, you can probably make an example where you basically say “as an exercise it has been decided that in this case we will try and decrease the complexity of the app by using a Pubsub pattern”.

You would probably be able to create one single “complicated” example and have multiple possible solutions. Start with a SignupController that is 200 lines long.

  • Convert it to using Managers
  • Convert it to using Background workers where possible that update the frontend using Pubsub
  • Convert it to use a workflow
  • Convert it to use a statemachine …
4 Likes

This is a wonderful idea. I will try some of the exercises and see how it goes :slight_smile: thanks.

2 Likes

Appreciate the thoughtful response. There’s is a lot to think about in your message.

Just to check, are you saying (among other things)?

It would be great to have a learning resource that (1) teaches about realistic problems in codebases (especially complex ones), (2) how those problems relate to the tools that exist in the ecosystem, and (3) shows examples of how to implement solutions using those tools well.

I’m making some assumptions here, but asking to get an even better idea of your perspective because this topic is very valuable, I think.

1 Like