redrapids
Has anyone seen Building Tetris on Elixir/LiveView?
Groxio is building a series targeted to beginner and intermediate Elixir developers at Quadblock- Elixir/LiveView videos. The first seven are free, and the rest will go for 10 bucks. The proceeds will go to fund coding diversity mentoring programs. I would love comments on the approaches, as I’ll use the same approach in the prag book.
In general, it’s the course my mentees to through (or the first part). I seem to have success teaching these concepts:
- Understand pattern matching first
- Organize modules into like concepts around DATA
- Organize code around the data concepts, with as many reducers over that type as possible
- Write tests as pipelines
Then, the LiveView discussion becomes easy:
- In LiveView, build a static screen first, with hardcoded data in mount
- Change the hardcoded data as your functions later will to flesh out your render
- If needed, extract render-text text into views
And next:
- Replace hardcoded mount with dynamic content (your true model)
- Change the data with handle_event and handle_info
- Keep the handle-callbacks skinny. If necessary have adapter functions in the Live module
Finally:
- Optimize the liveview difs, and tighten them up
- Extract common components
- Implement data rehydration concerns
- Implement pubsub concerns
Does the approach seem sound?
Most Liked
redrapids
Thanks for the insight.
I would like to offer a counter perspective. I could have built an app in LiveView that built all of this code, or most of it, into the view. Some of the examples are built in this way. Doing so would have given the appearance of being a video about LiveView. That approach would have been misguided.
Coding a nontrivial LiveView or OTP will be like what I presented most of the time. If you build something nontrivial, the hard part won’t be the LiveView. It will be the pure core of what your building.
Layering your code into pure elixir for consumption in LiveView IS the problem. It’s the separation of boundary and pure code, the use of reducers, and the like that separate a good codebase from a poor one.
It’s very much like designing elixir systems for OTP. It’s not a book about OTP. It’s a book about building things that uses OTP, and it should be.
romenigld
I like the game and saw yesterday a little.
I will buy this month for sure it’s a nice price.
crisefd
Just finished the course, easy to follow and I learned a bunch while building the app. Highly recommended if you are already mid-level-ish in the language. And it’s a good introduction to LiveView.
Popular in Discussions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









