Live data from Hacker News

Build a real-time Twitter clone with LiveView and Phoenix 1.5

phoenixframework.org

101–110 of 249 posts

Re: Build a real-time Twitter clone with LiveView and Phoenix 1.5

#101

We are really excited about this release! I also wanted the screencast to be a single take, so I'm happy to answer questions if there are gaps to fill in for things I could have explained more clearly.

Hi Chris. I built a demo with LiveView a year ago and am very happy to see all the improvements.

One thing I didn't understand from the video is how the :post_updated callback worked. It prepends the updated post to the list of posts. How come that doesn't lead to the same post being double in the list?

Re: Build a real-time Twitter clone with LiveView and Phoenix 1.5

#102
post #24

We are really excited about this release! I also wanted the screencast to be a single take, so I'm happy to answer questions if there are gaps to fill in for things I could have explained more clearly.

I'm really amazed this sort of functionality can be implemented in such a nice and clean manner. Your presentation is mind blowing! Just out of curiosity (please don't consider this as a feature request, more like a thought exercise), in case you wanted the application to have offline editing functionality, could the framework provide it in a similar manner? having a generic JS handler that manages pushing state when…

"offline support" is strictly on the side of needing to run a lot of code on the client, so this is where we draw a line and say you need a js framework, of which there are number of great options. We have javascript interop via phx-hook, so it could be made to work, but you'd necessarily have to have a lot of js running on the client, and any feature you wanted to work online & offline would not share a code path or need js, thus client side rendering and templating gets involved and suddenly we're writing a SPA. If we're strictly talking allowing the edit of a textual input and syncing on reconnect, it would be straight forward to do with LV and some small js hooks, but the moment you start adding offline UI features you'll need a js library.

The funny thing is last I tried to use Google Docs offline, it locked the page in read-only mode, so offline mode even in the SPA space isn't just a given – you're definitely opting in to some necessary complexity.

Re: Build a real-time Twitter clone with LiveView and Phoenix 1.5

#103

Earlier quoted context omitted.

> Are many of the other languages you've used strongly typed? That's the thing that gives me pause - I feel like I rely on the compiler a lot in languages where it can do a lot for me, and that I'd be really frustrated managing a large project without it. As someone who has been writing Elixir professionally for 4-ish years, and who is otherwise about as big of a proponent of static types as is possible, this is simu…

To add to this, it's worth noting that Elixir would have difficulty _ever_ becoming statically typed because of how message-passing works. For example, if you look at Gleam [0] -- the recent project that's trying to create a statically typed language for the BEAM -- it can't handle message-passing [1]. And I totally agree with you here: > I've found that it's possible to pretend it is a statically typed language if y…

I've heard a number of times that static typing would be near impossible for Erlang because of how message-passing works, but just the other day I read a quote where one of the creators (I think it was Joe Armstrong, but not completely certain) indicated that the primary reason they decided against static typing was the hot code reloading, not the feasibility. or not primarily anyways.

Not disagreeing with you, I guess. It was just surprising/interesting to read.

Sadly I can't find the quote...

Re: Build a real-time Twitter clone with LiveView and Phoenix 1.5

#104

We are really excited about this release! I also wanted the screencast to be a single take, so I'm happy to answer questions if there are gaps to fill in for things I could have explained more clearly.

How stable do you expect LiveView's API will be going forward? I'm especially invested in this since I've just rolled out an alpha of a project that may incorporate it in the future: https://phoenixigniter.com

As always, I can make no guarantees before 1.0, but we have really focused on refining the programming model and APIs for the last several months, so we're in a good state currently.

Re: Build a real-time Twitter clone with LiveView and Phoenix 1.5

#105

Earlier quoted context omitted.

> When I say perfect, I mean, there has been never once in my career where I hit a roadblock due to the language's limitation or complexity or flawed assumption. I faced this with other languages, but not Elixir. This is pretty amazing praise! Are many of the other languages you've used strongly typed? That's the thing that gives me pause - I feel like I rely on the compiler a lot in languages where it can do a lot f…

Static typing is far from a panacea. Don't forget that the rise of Perl and PHP, and then later Ruby and Python was in response to statically typed languages like Java. There are trade-offs.

One of the things I like about Guards is that you can enforce/match against types as needed.

Re: Build a real-time Twitter clone with LiveView and Phoenix 1.5

#106

Earlier quoted context omitted.

To add to this, it's worth noting that Elixir would have difficulty _ever_ becoming statically typed because of how message-passing works. For example, if you look at Gleam [0] -- the recent project that's trying to create a statically typed language for the BEAM -- it can't handle message-passing [1]. And I totally agree with you here: > I've found that it's possible to pretend it is a statically typed language if y…

I don't know if I'd say "ever", but it definitely won't be easy! Take a look at session types [0] if you haven't seen them! Type checking unrestricted message passing would be difficult, but I can imagine a subset that's typeable. [0] http://groups.inf.ed.ac.uk/abcd/index.html#about

I haven't seen them, thanks!

> Type checking unrestricted message passing would be difficult, but I can imagine a subset that's typeable.

I'd love to see a discussion on this somewhere. I can totally imagine a world where it's true that "yes, you can't send messages of type X because the receiver can't pattern match on them in the way you expect, but what you're really trying to do is Y, and you _can_ send messages of type Z that accomplish Y."

Re: Build a real-time Twitter clone with LiveView and Phoenix 1.5

#107
post #95

Earlier quoted context omitted.

To add to this, it's worth noting that Elixir would have difficulty _ever_ becoming statically typed because of how message-passing works. For example, if you look at Gleam [0] -- the recent project that's trying to create a statically typed language for the BEAM -- it can't handle message-passing [1]. And I totally agree with you here: > I've found that it's possible to pretend it is a statically typed language if y…

Hi, I'm the author of Gleam. We have fully type safe message passing, we just don't have any special syntax for it. I'll update the documentation to make this clearer.

Hi! Super cool project you've embarked on. I know everyone I work with (those who write Elixir, anyway) is very interested in its progress.

> I'll update the documentation to make this clearer.

Thanks! Much appreciated.

Re: Build a real-time Twitter clone with LiveView and Phoenix 1.5

#108
post #27

Question to the former Rails devs out there: We mostly see threads fawn over Elixir and Phoenix, have you experienced any downsides to switching? Anything you miss from Rails? I'm convinced to give it a try after that demo!

It seems like a lot of companies are moving to Go for fast services. As a rails dev for 10+ years, I am looking at Go instead of Elixir and Phoenix, b/c Go is a much more popular language than Elixir.

I’ve invested a lot of time into both Go and Elixir. I like both languages a lot.

My anecdotal view of the marketplace is that Elixir recruitment emails tend to come from startups looking for their 2nd or 3rd dev, usually full stack, and the salaries are nothing special. Go recruitment emails tend to come from bigger companies looking for backend devs, often hoping for kubernetes experience too, and the pay is higher.

I built an internal service with LiveView at work and I loved it. I gave a presentation about how it all works and was hoping it would catch on. It didn’t. The front end team would probably mutiny if we told them to give up React and level up their LiveView skills.

If I were running a web business as a solo founder I would 100% want to use LiveView. As a dev on a larger team that already has specialization it’s a tougher sell.

Re: Build a real-time Twitter clone with LiveView and Phoenix 1.5

#109

We are really excited about this release! I also wanted the screencast to be a single take, so I'm happy to answer questions if there are gaps to fill in for things I could have explained more clearly.

Hi Chris. I built a demo with LiveView a year ago and am very happy to see all the improvements. One thing I didn't understand from the video is how the :post_updated callback worked. It prepends the updated post to the list of posts. How come that doesn't lead to the same post being double in the list?

Components IDs are unique. So once you try to render the same component, we know you simply want to update the current one.

The same happens on the client. If the server emits the same DOM ID, the client just updates it in place too.

Post reply on HN