This is an issue I’ve found myself facing any time I get interested in web development/web frameworks. I’ve had experience using Django for university, and in that case I felt like I was being hand held to go from 0 knowledge to implementing a cookie cutter web application. When left to my own devices, the scale of complexity begins to get overwhelming.
I’ve recently been interested in Elixir and Phoenix, mainly for Pheonix’s proclaimed benefits with features like LiveView and how I instantly clicked with Elixir’s approach to functional programming. I’ve been going through the Phoenix tutorials on hexdocs and after the lengthy section on contexts, I realised that while following the docs in a project, taking notes, etc I feel like I’m getting in over my head. My abilities in Elixir to begin with are still at a beginner level, and while the tutorials I’ve been following have been incredibly well written (and in general the framework seems easier to understand than some others…), the idea of starting one of my own project ideas is quite intimidating.
This is not a problem that is exclusive to phoenix for me like I said - I generally don’t get on well with webdev so I don’t expect it to be easy. I was hoping I could get some inspiration from this community by asking you this: what were some of your small projects you worked on to learn Phoenix? What small projects have you worked on that exploit the defining characteristics of Phoenix to better understand them? And finally (the most googlable question, apologies), are there any other resources (books articles etc) that you would recommend for someone starting out with Phoenix, particularly geared towards someone without much webdev experience?
Its not uncommon to feel that way, its paralyzing to go from tutorials to just suddenly coding and its one of the biggest hurdles to being self-taught in anything. Best thing for it is to just start on your own starter project or idea you want to create, you need to learn to take something big and break it down, and then break that down event more until you have small focused and easily manageable chunks. Then whenever you don’t know how to do that one thing, refer back to a tutorial or googling.
Coding isn’t about knowing how to do everything, you gotta learn how to learn and how to turn something big into lots of small somethings.
(sorry missed the final questions)
I learned Elixir as my first language 6 years-ish back and my first project was a web scraper for presenting metadata. After that I’ve had various toys for learning stuff, an Ecommerce cart, an inventory management thing. Nothing ever took wings but I always tried to do something different and incorporate a new concept.
Phoenix really isn’t that much different from any other web framework, it does the cool elixir stuff for you. Just learn general web concepts that every language supports and you’ll be golden.
I’m book dumb so I can’t help you there, I’m always looking for new articles though.
Can anyone suggest large web projects on GitHub written in Elixir and Phoenix? In my studies, I use large projects where you can see approaches and methods (for example for django i use netbox project), but on Elixir and Phoenix I did not find big web projects larger than a landing page of a couple of pages and it’s sad.
Hello, and welcome to forums!
You say you aren’t super comfortable with webdev but it’s unclear if you are comfortable with other forms of dev. If you are, one possible route would be to just pick something simple (like a todo app) and start by building out all the business logic only using contexts. Make sure you app can do everything it needs to do simply by calling functions from IEX. This will teach you about contexts and Ecto. Once that is done, I personally feel LiveView is simpler to get started with than REST controllers (especially if you’re starting from the backend without REST in mind), so you could start hooking up all your business functions to LiveView events and build a very simple interface.
This is the book on LiveView though it’s still in a state of being updated fairly regularly. You do get all the updates for free, though means you’ll have to do some backtracking when there is a new version. This is largely a matter of LiveView not being at v1.0 yet (though it’s getting close).
Apologies if this wasn’t super helpful! It’s a bit hard to answer because webdev is just straight up not very straight forward.
@Flaky Plausible Analytics is built with Elixir and Phoenix.
Thank you your reply is definitely helpful! I recently graduated in computing science and have decent experience making desktop applications + general programming skills (algorithms, OOP patterns… things that are not one-to-one transferrable from procedural languages to a functional one like elixir :') ).
I agree I should try getting used to testing what I do on iex more. When I was learning the elixir basics I was using it all the time but never think to use it while doing phoenix tutorials.
I will take a look at the book too
Avoid books, and practice programming.
You don’t learn to play the piano by reading a book. True understanding is obtained through practice and experience. Eventually your experience will accumulate into habits and new concepts will become less intimidating. I believe one of the authors of Programming Phoenix LiveView even said that she doesn’t learn well from reading books. I think they’re good as reference material, but shouldn’t be the primary thing to learn from.
- Practice 1 hour every day and train for consistency. Don’t try to understand everything in a small amount of time.
- If you still haven’t “mastered” Elixir and functional programming, you can start off practicing on Leetcode until you become more comfortable.
- Once you feel comfortable in Elixir, recreate existing projects in the ecosystem but add your own twist to them.
- There aren’t that many open source “tutorial” projects in Phoenix compared to other ecosystems, but the best ones imo are
- Or, find an existing library on Github and recreate it. By recreating libraries, you learn how the internals work and things become less magical and you gain a better map of the programming world. If you ever get lost, refer back to the project codebase
- Do some OpenAI project, you can get amazing results from just calling their APIs and reading the results.
The best learning vehicle is your own project solving your own problems. Don’t worry about technology fit; Any decent language can do any decent project if there is not much external dependency, and Elixir is certainly decent enough.
Arguably one of the most defining characteristics of Phoenix is just how easy it makes implementing soft real time features. Think chatrooms, games, and other multi-user/client interactions.
A fun and easy way to get started is picking a simple tabletop game you like and know well – something like uno or scrabble – and re-creating it as a Phoenix LiveView app that maybe also leverages Phoenix Channels for game state as well as Phoenix Presence for non-playing users/observers.
I gotta say, sometimes the project doesn’t make it easy. A great example is the recent change of the liveview generators to use streams by default. I get their use case, and if you’re writing a chat room or a logs viewer or something sure, I’d reach for streams. But by default? It’s just yet another layer of confusing abstraction over the actually very intuitive and elegant, but hard for visitors from other frameworks, liveview interface. And despite arguments I’ve heard, I don’t believe streams are necessary 90%+ of the time, in fact make that 99%.
If even I, with a few years of phoenix experience, felt confused and lost the first time I tried to generate a liveview scaffold in the new paradigm, then I can only imagine how intimidating it must be to beginners.
I didn’t use phoenix for about half a year and it is as you said, a great amount of changes introduced with phoenix 1.7, I guess after you generate the project, just open the documentation and read about the new things.
I think this is because the aim of phoenix generators is to get you started fast, not to make the project necessarily welcome to beginners, and if we talk about people starting, they should remove a lot of options that come by default.
I think I have some useful advice.
Here is what I do, feel free to emulate.
I don’t focus on learning it with “projects”. Do this instead, list small bite sized actions to complete that are needed for any web app.
- How do I render a static page
- How do I route a page
- How do I render a variable in a page.
- How do I submit form data to a database.
Make your own list.
I ask myself these questions and document my work.
After doing that for an extended time period you should have enough know-how to string these little pieces together and build an app.
Here is an example of one of these bite sized how-to’s that I document on my personal site.
Of course all this stuff is documented online already but that’s not the point. The point is you make it your own with your own words and in a context specific to how you learn.
Totally agree. I wish there was another competitor for Phoenix, focused on stability more maybe? Or maybe developer happiness? Phoenix is cool, but personally quite often it frustrates me and the example you provided is a good example of why.
I know that there is Ash, but it looks like one needs to do a paradigm shift or something to work with it.
Let’s remember that LiveView is not at v1.0 yet. This means frequent breaking changes with each release, but that is to be expected. It’s annoying for now, but we’re almost there.
The default generators, as I understand it, are more geared towards learning than they are meant to be used by experienced users. If you are coming as an absolute beginner to web dev, as is OP, then every concept is going to be new and may as well throw streams in there. If you don’t agree, though, that is good feedback! But it’s not fair to claim that the authors aren’t focused on developer happiness or aren’t working toward stability.
Everybody cares about their own problems and expect everything to be handed to them.
Chris and other members invested a substantial amount of time and effort to get to this, literally years of hard word. Everybody whines about some small details, but show me an alternative that is as powerful as phoenix and liveview currently are.
I think that’s the crux of the problem, or at least one of them, right here.
Have you followed Elixir’s official guides, top to bottom?
People skipping those and jumping into Phoenix is sadly a classic mistake. When you learn something as new there should not be shortcuts.
Many bonus points if you have gotten at least partially through Elixir’s Exercism track.
You already got a few good answers, I’d only ask you this: what are your favorite areas? F.ex. if you like education you can try and make an itinerary / schedule system for students and professors.