How ElixirConf 2022 Changed SmartLogic's View of Phoenix LiveView
At ElixirConf 2022, Chris McCord's keynote presentation highlighted updates, features, and improvements of Phoenix LiveView. His speech shifted our perspective and inspired us to adopt LiveView for future projects at SmartLogic.
What is Phoenix LiveView?
At the tail end of 2018, Chris McCord introduced the Phoenix LiveView library as a simplified programming model with which you can create interactive, real-time apps without writing a single line of JavaScript. LiveView uses a persistent WebSocket connection, creating an instantaneous reaction to user events in an application.
Careful Considerations
In an industry where new features and methods emerge constantly, we need to be discerning with our energy. When new methods emerge, it's best to approach with cautious curiosity. Shifting to a new skill requires everyone on the team to invest time in education. Implementation without a cohesive strategy could easily result in a single point of failure.
When Phoenix LiveView was first introduced, there was a lack of resources available. We were excited to dip our toes in, but it was challenging to research and solve problems. Since it hadn’t been released, there was also a concern that the public API might change drastically before version 1.0.
Our approach was to wait and see if it had legs and traction before jumping in. LiveView is maturing, and the wealth of information and potential benefits are promising. As programmers like Chris McCord and Miki Rezentes give talks on LiveView, adoption becomes more practical. Today, there are more resources and examples available.
The Benefits of LiveView
The industry is evolving, and we see more cohesive communication between front-end and back-end development. LiveView aligns with other tools, like Figma and Tailwind, and simplifies the implementation of UX design elements and accessibility features. LiveView allows developers to solve a problem once and reuse components, which is more efficient and seamless.
LiveView is a departure from some of the overly complex systems for communicating data, from everything being HTML to the nightmare of JavaScript to JSON APIs. LiveView sends the minimum amount of info via WebSockets. Elixir allows us to create stateful applications in which the user or server can trigger an update in information. This technology expands the possibilities of what we can implement and design.
What Tipped the Scales?
Programming with LiveView requires less bandwidth and rendering of assets, and it simplifies the APIs. Ultimately, we ask ourselves if this is best for our customers.
We've come to recognize that there is an entirely new class of applications that you can build with LiveView that would otherwise be impractical; anything that is constantly refreshing and displaying new information or fast-paced interactions demanding a quick response.
Adopting LiveView optimizes the data going back and forth and eliminates unnecessary steps. This reduces and streamlines the workload for the team.
Deploying LiveView into Production
At SmartLogic, we're training as a team and looking forward to deploying Phoenix LiveView into production. Implementing this programming model will allow us to create applications more responsibly and efficiently.
Ultimately, our goal is to deliver the best possible user experience and the best product for our customers. Where it applies, this new skill set will expand the realm of what is possible.
More Resources
Jason Stiebs, core contributor to Phoenix, joined Sundi and Dan on Elixir Wizards to discuss the functional components and practical applications of Phoenix LiveView. Listen to the full episode to learn more.
Do you want to learn how Phoenix LiveView works and what you can do with it? We recommend the courses offered from The Pragmatic Studio.
Programming Phoenix LiveView: Interactive Elixir Web Programming Without Writing Any JavaScript is a thorough guide and reference manual.