How Phoenix LiveView Optimizes Real-Time Web Apps with Streams • Sophie DeBenedetto • GOTO 2023

Поделиться
HTML-код
  • Опубликовано: 27 окт 2024

Комментарии • 6

  • @tommaisey9069
    @tommaisey9069 5 месяцев назад +18

    Excellent speaker, very enjoyable to listen to. I'm increasingly interested in LiveView, it looks like a delightful developer experience.

    • @anatolydyatlov963
      @anatolydyatlov963 Месяц назад

      Yeah, good luck managing large projects without inferred types for your Ecto queries, which would provide IntelliSense hints. It's hard to imagine working without something as basic as this. In TypeScript, I can simply define my endpoint with tRPC:
      export const user = t.router({
      getByEmail: p
      .input(
      z.object({
      name: z.string(),
      })
      ).query(
      () => db
      .select({
      id,
      email,
      // a few dozen other properties
      })
      .from(data_users)
      )
      });
      And just like that, everything is automatically typed both in the frontend and the backend. For example:
      const users = await trpc().user.getByEmail.query({ name: "test" });
      // users.
      After typing the dot, I immediately see a list of properties selected by the query. I don't need to double-check what is returned by that endpoint. Moreover, if I tried to pass incorrect arguments, like `name: 321`, I'd get an error not only at compilation time but immediately in the editor.
      There's no need to even define my types, as everything is derived directly from the ORM schema and the queries. Can you achieve anything even remotely as convenient in Elixir? No. You need to check everything manually. For goodness sake, you don't don't even know what's inside your live view's state object (i.e. the socket assigns)! It's as far from "delightful" as you can possibly get, and I can't comprehend how anyone could possibly enjoy this.

    • @tommaisey9069
      @tommaisey9069 Месяц назад

      @@anatolydyatlov963 I like types too. Although I don't think you should discount dynamic languages entirely - I've worked in large projects with both, and there are tradeoffs (as with almost anything worth discussing).
      When I said 'delightful DX' I was referring to the fact that the front/back end distinction seems to melt away with LiveView (at least conceptually for the developer). That's what's appealing to me.
      I'd love to see LiveView get typed with Elixir's in-progress type system, or perhaps to see a LiveView-like in Gleam (a typed BEAM language).

  • @BuenoFit
    @BuenoFit 2 месяца назад +2

    I bought her book 2 days ago and this is really amazing. I cannot stop to read it.

  • @gonzalomunoz2767
    @gonzalomunoz2767 Месяц назад +1

    This woman is easily one of if not the best communicator in the Elixir community. I'll be on the lookout for more of her content. I have the feeling I'm going to learn a lot and really fast

  • @mk-Watch-9000
    @mk-Watch-9000 3 месяца назад +3

    Any time I see Sophie's name, I know it's going to be a legit Elixir resource, be it article or whatever. Thank you!!!