Live data from Hacker News

Phoenix 1.7 is View-less

germanvelasco.com

111–120 of 224 posts

Re: Phoenix 1.7 is View-less

#111
post #76

Earlier quoted context omitted.

What situations would face possible issues with the persistent-socket-per-view approach? A sprawling app with hundreds of distinct views that over-use LiveView? Would there also be multiple persistent sockets for each particular page? I can't imagine the type of site that would need that sort of structure. Typically you'd have your highly-interactive primary subset of your app, about <10-25% of the routes/views which…

We use LiveView extensively and one meaningful issue we have is users with intermittent connections on mobile. On a "normal" req/resp page, their intermittent connection would manifest as a blank then slowly loading page: things that the user understands as being the result (in a way) of "bad internet". With LiveView, the site simply becomes unresponsive. Nothing changes, and the user interprets this as the site bein…

Some of the 1.7 stuff has an alert banner that pops up when the connection is broken. I think that could really help.

However I haven't put that in our app as I have seen other issues of flakey connection reconnect issues, and I would hate to make any of those more visible with a flashing notice.

- https://github.com/phoenixframework/phoenix_live_view/issues...

- https://github.com/phoenixframework/phoenix/issues/5102

- https://github.com/phoenixframework/phoenix/pull/5024

Re: Phoenix 1.7 is View-less

#112
post #102
post #19

We're building a startup ( https://www.batteriesincl.com/ ) with Elixir and Phoenix 1.7rc (git master really). It's been amazing; I could not be happier. - We went hard on components and it's made building UI's easy. In fact I wrote a test library to make component testing easier. - Live view is so easy with a good component library. I'm not a designer, but with snappy interactions and easy to use components, it's no…

> Elixir is a very nice language to write distributed systems in. Functional in all the right places plus it has OTP. This is the biggest blocker for introducing Elixir to any company I work at. I don't want to become / hire experts in the OTP and the Erlang VM. I'm ignorant about it in general, but my feeling is it's not only a new language, it's built on abstractions that I'm not sure I'm comfortable owning or oper…

Ignore OTP for the most part. Just write good code that works at one level at a time. Then when you hit something that needs OTP I send them towards Designing Elixir Systems with OTP

https://pragprog.com/titles/jgotp/designing-elixir-systems-w...

This is all about the onboarding experience of engineers coming onto a team. So you have to be careful with the projects that engineers newer to elxir get. But that's part of the cost of a more niche language.

Re: Phoenix 1.7 is View-less

#113

So did the MVC model just got stripped down to just C, a.k.a. Servlet but with more amenities?

I feel like the title is a bit misleading. All 3 are still uncoupled, it's more that the V and C is now cohered in the directory structure, which seems a bit more ergonomic.

Re: Phoenix 1.7 is View-less

#114
post #30

Earlier quoted context omitted.

> But I would really suggest anyone out there just to avoid backend-frameworks-based view/templating I personally struggle to let go of backend templating. It's so easy to translate your data into the right pieces of markup in the template, and just serve the fully-baked HTML to the user instantly. How should I be looking at this differently?

I think few reasons that made me go with this new (for me, at the time) approach were: - Backend/API that can be consumed by anything, are frontend-agnostic - Frontend that depends on JSON/source-agnostic data so that can have functionality tested faster (no "proper"/"dynamic" backend involved, just give it some ApiBlueprint/swagger mock server - The frontend rendering isn't a concern of the backend removing some loa…

Business-wise, I cut the JS only part as a free plan (local use only), so it's zero dollar cost. The paid plan has the Phoenix Channel integrated.

Re: Phoenix 1.7 is View-less

#115
post #107

Earlier quoted context omitted.

What are you using for the component library? I was thinking of trying out Elixir and if there’s something that works well with it I’d rather start there than by trial and error.

I would recommend Petal: https://petal.build/ It's what I used for quite a while and I think it's the most comprehensive currently. We're building two different UI's that share a common design language so we ended up creating a common UI application in the umbrella project.

Thank you.

Re: Phoenix 1.7 is View-less

#116
post #102
post #19

We're building a startup ( https://www.batteriesincl.com/ ) with Elixir and Phoenix 1.7rc (git master really). It's been amazing; I could not be happier. - We went hard on components and it's made building UI's easy. In fact I wrote a test library to make component testing easier. - Live view is so easy with a good component library. I'm not a designer, but with snappy interactions and easy to use components, it's no…

> Elixir is a very nice language to write distributed systems in. Functional in all the right places plus it has OTP. This is the biggest blocker for introducing Elixir to any company I work at. I don't want to become / hire experts in the OTP and the Erlang VM. I'm ignorant about it in general, but my feeling is it's not only a new language, it's built on abstractions that I'm not sure I'm comfortable owning or oper…

My answer to this is the following: do your software have by any chance, SQL writes and HTTP request to any third party APIs within the same endpoint? Or maybe it uses some background job processing that's not SQL based and you have at least one endpoint where a job is enqueued AND something is written with SQL?

If the answer is yes, you already have a distributed systems with all the downsides and none of the mitigations.

If that's the case, you can also use Elixir without still knowing anything and have the same level of penalties.

It's really hard nowdays to avoid distributed systems, it just happen that people don't realize they have one.

The classic Rails + Postgres + Sidekiq is a distributed system

Re: Phoenix 1.7 is View-less

#118

What's the best way to get started with Phoenix 1.7, for someone with no Elixir experience? Should I learn some Elixir before diving into the Phoenix docs?

With the caveat that I’ve only dabbled with elixir and Phoenix for side projects

I really liked the approach taken in this book - https://pragprog.com/titles/lhelph/functional-web-developmen...

In which you first build out the functional core in just elixir and then hook up Phoenix as the web interface

Re: Phoenix 1.7 is View-less

#119
post #71

Earlier quoted context omitted.

Every time people talk about static types and the lack of them in Elixir I chime in to repeat that it is a misconception to think of typing as a black and white issue. Typing systems exist on a spectrum: I constantly get type issues on Javascript and Python, refactoring is a nightmare without a ton of tests, while it was never a big issue in Elixir. Yes, its typing system is inadequate, and dialyzer isn't great, but…

A type system saves a lot of time when reading code that has been written by other people and has evolved over time. In Elixir, I often end up adding debugging statements to code and running it, just to check the data structures. A type system also gives additional assurances when changing code that is used from many places. It's so nice to make a change and have additional confidence in it because the type system is…

I agree 100% and I'd add, static typing helps when you inherit a poorly written codebase. This unfortunately is probably 99% of codebases in the wild. It has happened so many times when i've seen a lack of test coverage, a lack of understanding of the codebase but the business requirement to make changes.

Having a type system in place makes minor refactoring possible in this nightmare scenario.

I have been in the situation of poorly written ruby codebases and I can tell you 100% that I would prefer to have a poorly written java codebase with its static types. I prefer ruby as a language but man when it's bad, it's terrible. Just trying to work out the intent of a function when multiple types are passed in as the same argument over the codebase is pure hell.

Re: Phoenix 1.7 is View-less

#120
post #30

Makes little difference to me, it has been few years now that I create API backends consumed by separated frontends, them being either CLI or JS etc. If anything for me this approach has done wonders for e2e tests using api mockservers But probably for simpler projects and new starters makes sense But I would really suggest anyone out there just to avoid backend-frameworks-based view/templating (guess json responses…

> But I would really suggest anyone out there just to avoid backend-frameworks-based view/templating I personally struggle to let go of backend templating. It's so easy to translate your data into the right pieces of markup in the template, and just serve the fully-baked HTML to the user instantly. How should I be looking at this differently?

As company gets larger, it's so nice to have "important business logic" via API only, that way mobile apps, web apps, partners, etc can use same logic/data. Server side templating is a real drag on enabling this.
Post reply on HN