Production-Grade TypeScript by Johannes Schickling (Effect Days 2024)

แชร์
ฝัง
  • เผยแพร่เมื่อ 8 ก.ย. 2024
  • Get Effect support from the community → / discord
    Effect is an ecosystem of tools to build better applications and libraries in TypeScript.
    Website & docs: effect.website/
    Community: / discord
    X (Twitter): / effectts_
    Github: github.com/Eff...
    ______________________________________
    In the Effect Days 2024 Opening Keynote, Johannes Schickling talks about the challenges of building production-grade TypeScript apps and how the Effect library can help address these challenges.
    Highlights:
    → Building production-grade TypeScript apps can be challenging and requires handling errors, retries, timeouts, and observability.
    → Effect is a set of primitives that helps build efficient TypeScript apps with a holistic standard library.
    → Effect provides maximum type safety, a great developer experience, and code composability, and can be used to build apps that run on various platforms.
    Slides: 2024-effect-da...
    _____________________________________
    Learn more about and follow Johannes:
    X: / schickling
    Github: github.com/sch...
    _____________________________________
    #EffectDays #Effect #TypeScript #EffectDays2024

ความคิดเห็น • 25

  • @joaomendoncayt
    @joaomendoncayt 5 หลายเดือนก่อน +12

    I've seen effect duzens of times before, this is the very thing that will make me try it out, be proud Johannes.

  • @SoreBrain
    @SoreBrain 5 หลายเดือนก่อน +19

    Enjoyed the talk, thanks yt algorithm!

  • @kevin41420
    @kevin41420 5 หลายเดือนก่อน +4

    Errors as values! 🙌

  • @JohnMcclaned
    @JohnMcclaned 5 หลายเดือนก่อน +9

    We need a new effect 101 long form video about how to use it on this channel

    • @Danielo515
      @Danielo515 5 หลายเดือนก่อน +1

      Probably better wait for them to reach stability first

  • @SoreBrain
    @SoreBrain 5 หลายเดือนก่อน +8

    I'm curious how high the performance price is when using Effect in a large code base as it wasn't mentioned.
    Just like Prisma is able to be costly, I wonder where Effect lands on the spectrum in the context of a long living application.

    • @michaelarnaldi6680
      @michaelarnaldi6680 5 หลายเดือนก่อน +8

      From a recent discord discussion:
      depends what you mean by performance, many times performance bottlenecks in JS are due to bad management of concurrency, thanks to structured concurrency and observability it becomes much easier to spot and optimize those issues. There are apps in frontend running at 120fps that use effect intensively, so most likely effect won't be your perf problem. In regards of memory, it doesn't use much more memory than a normal program would, there are a few more allocations compared to non effect code but usually this is no longer the case when the non effect code does the same thing as the effect code. The advise would be start using it and monitor your code, optimise out of need not out of thought, optimizing too early is the root of all evils in software design

    • @SoreBrain
      @SoreBrain 5 หลายเดือนก่อน +2

      @@michaelarnaldi6680 Those are some interesting points, thank you.

  • @seannewell397
    @seannewell397 5 หลายเดือนก่อน +2

    The Client is a distributed system in many ways, so making client apps fault tolerant already has a level of fault tolerant distributed systems as each client (browesr session) in the system has far more robustness. But I get your meaning - composing apps and workflows and services with the TS Compiler. Having this with SST would be huge. Curious if something like how figma operate or Linear with their real time collab could be "effect"-wrapped (ie an Effect-TS version of real time collab)

  • @thiagoalmeida5437
    @thiagoalmeida5437 5 หลายเดือนก่อน +2

    Great talk, kudos to the presenter. How does effect differs from rxjs though?

    • @sebastiansiemssen223
      @sebastiansiemssen223 5 หลายเดือนก่อน

      RxJs is first and foremost "just" Observables. Effect offers streams but that's just a teeny tiny group of modules in relative terms when compared to the scope of Effect which is a full blown effect system, standard library, schema encoding&decoding, dependency injection, etc. etc. etc. (the list goes on and on).

  • @levibaraka
    @levibaraka 5 หลายเดือนก่อน +1

    Pipe reminds me of rxjs and my angular days 😂

  • @vpetryniak
    @vpetryniak 5 หลายเดือนก่อน +3

    Bro, you forgot validation in the beginning, how can you be sure that endpoint returns data in shape that your app expects, so add another 20 lines to those 83. Zod is a good way to validate data

    • @sebastiansiemssen223
      @sebastiansiemssen223 5 หลายเดือนก่อน +2

      Effect has `@effect/schema` for this instead of Zod.

    • @ivan.jeremic
      @ivan.jeremic 4 หลายเดือนก่อน

      You didn't watch the video carefully, the slide even says you don't need zod.

  • @very_unique_username
    @very_unique_username 5 หลายเดือนก่อน

    Nevermind, this is pretty cool :)
    -I'm trying to read the code at --13:10-- and I have so many questions right now. Now granted, I don't have any experience with Effect (although I'd like to try it), but this code doesn't look elegant nor readable to me. The way I read this pipeline: so, we're constructing a GET request pipeline, then run "fetchOk" through it (which I'd assume actually does the fetch and checks the response status after), then I retrieve body from the response as JSON, and after that... do timeout and retry again? I understand the concept, these timeouts and retries only run when fetchOk pipe fails, but there is too much implicit magic happening.-

    • @michaelarnaldi6680
      @michaelarnaldi6680 5 หลายเดือนก่อน

      It's so unintelligible that without having wrote a single line of Effect code you correctly understood what it does :) (ofc learning to write it is a different task, it is like learning anything new, think of learning React for example). I think the main issue here is understanding of "pipe" (normal as it is not a standard) that is function composition, so a.pipe(f, g) is g(f(a)),. In the code snippet everything but the first line is a Higher Order Function that modifies the behaviour of the original effect, in short, line-by-line:
      1) creates a request
      2) declare that we are interested in the success response and we want to fail otherwise
      3) after the response is successful we want to extract the json of the body
      4) declare that we want to timeout after 1 second
      5) in case of failures we want to retry using an exponential backoff policy
      6) we want to instrument the call with an opentelemetry span named getTodo with attributes
      Note that Effect is lazy, meaning just invoking that function won't do anything, only when executed effects actually occur, so you can change behaviour such as saying "hey, for this code I want it wrapped in a try-catch and want to print the error" or really any other kind of behaviour change, think of it like templating a program rather than issuing a sequence of instruction.
      The same code without Effect is about 200 lines and it is almost impossible to understand what is going on when reading it.

    • @very_unique_username
      @very_unique_username 5 หลายเดือนก่อน +2

      @@michaelarnaldi6680 I'm starting to get it now, thank you. Looking at pipelines the "Elixir" way really cleared up any confussion that I've had with this snippet, looking forward to trying out Effect!

  • @xoutaku7600
    @xoutaku7600 5 หลายเดือนก่อน +1

    looks more like a framework to write ts , i see this as something like nest rather than a utility library

    • @michaelarnaldi6680
      @michaelarnaldi6680 5 หลายเดือนก่อน +1

      Given that you can use it even for small parts of an app it is more akin to a library, that said if you use it for everything it can feel like a framework

  • @s4ndeep1203
    @s4ndeep1203 5 หลายเดือนก่อน +3

    I don't see mentions of Nuxt and Vue in the framework logos, are these not compatible with effect?

    • @michaelarnaldi6680
      @michaelarnaldi6680 5 หลายเดือนก่อน +2

      They are compatible indeed, we have production users of both, Effect runs everywhere that JS runs. I guess the reason logos weren't there is just because of space

  • @trejohnson7677
    @trejohnson7677 4 หลายเดือนก่อน +2

    where da production-grade typescript examples at lol? you just landed decent documentation? k then.

  • @sebastiansiemssen223
    @sebastiansiemssen223 5 หลายเดือนก่อน +1

    It should be illegal to be this handsome.