4 ms·
I just shipped my fourth large project based on Phoenix LiveView and I think it is the best thing that happened to web dev since forever. The javascript is min
by kuon 5y ago
I just shipped my fourth large project based on Phoenix LiveView and I think it is the best thing that happened to web dev since forever.
The javascript is minimal (like to manage selection in text field or to handle copy/paste). Everything else is in elixir. Tailwind is used for CSS.
Having the full client state available on the backend is really incredible. It is so much easier, no more ajax/graphql... You just have all your backend data "under your fingers".
I can only recommend giving it a try.
Also, if your app is offline first, phoenix channels are great for sync. It is not live view, but it is easier to use than ajax calls.
- jon1628492 5y agoA question from a newcomer to the ecosystem: do you have any recommendations for an admin system like Django's? On a related note, how do you usually determine whether a package is abandoned vs stable?
- dnautics 5y agoThe crazy thing is that most elixir packages that are abandoned still basically work. This is both a blessing and a curse all around
- _xnmw 5y ago> Having the full client state available on the backend is really incredible. Got the exact same feeling writing my latest app with Laravel Livewire. The ability to use backend state seamlessly on the frontend without explicitly passing state back and forth reduces complexity so much it's like writing 1 application instead of 2. I was able to build rich, fully interactive apps with minimal JS -- I'll never go back to React again.
- vasergen 5y agoout of curiousity, how difficult to support large project in elixir, especially refactoring, giving there is no static typing. I know about pattern matching, which helps, but interesting to hear practical experiance
- kuon 5y agoIn practice, there are two things: - crash on error - functions are just functions The first one is counter intuitive to many programmer. Basically you use pattern matching aggressively, like this: def full_name(%{first_name: <<a::utf8, _::binary>>, last_name: <<b::utf8, _::binary>>}) do "#{a} #{b}" end This code will work only if a map/struct with the correct non null field are passed. The pattern match utf8 string of at least 1 valid utf8 character. Any other argument will crash. Crashing in elixir is the way to handle unexpected things. For example, you will do: {:ok, myobject} = DB.get.... And if the DB fails (something unexpected), it will crash, the process will be restarted and the live view connected remounted and it will start again from a clean state. Of course, error that are expected should be handled. The second thing with elixir, is that functions are decoupled from data. You can move them around easily. For example, the above function will work on any struct with the correct fields and a plain map. But you can pattern match on specific struct too, which makes the code more like OOP, but it is more rarely done. The key idea is to restrict code paths to something you expect, and always be explicit about what to expect.
- aej 5y agoWhen it comes to refactoring, the fact that Elixir is compiled helps a lot - there are a set of mistakes you make during a refactor which the compiler will just catch for you.