Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Successful with Signals: 3 Rules for Your Archi...

Successful with Signals: 3 Rules for Your Architecture @.NET UserGroup Bern

Manfred Steyer

October 01, 2024
Tweet

More Decks by Manfred Steyer

Other Decks in Programming

Transcript

  1. About me… Manfred Steyer, ANGULARarchitects.io (Remote) Angular Workshops and Consulting

    Google Developer Expert for Angular Blog, Books, Articles, and Talks about Angular Manfred Steyer
  2. Component With Signals flights = signal<Flight[]>([]); const flights = await

    this.flightService.findAsPromise(from, to); this.flights.set(flights); <div *ngFor="let f of flights()"> <flight-card [item]="f" /> </div>
  3. Component With Signals from = signal('Paris'); to = signal('London'); flightRoute

    = computed(() => this.from() + ' to ' + this.to());
  4. Why „Business Effects“ are critical Glitch-free property: Events might get

    lost Auto-Tracking Cycles and Change Cascades Effect: End of the „reactive chain“
  5. Overlapping Req. & Race Conditions Pancakes Sacher Cake Ice Cream

    Pancakes switchMap, mergeMap, concatMap, exhaustMap
  6. Overlapping Req. & Race Conditions Pancakes Sacher Cake Ice Cream

    Pancakes switchMap, mergeMap, concatMap, exhaustMap
  7. Stores Streamline Reactive Flow Component Store "Intention" Signal sync/ async

    computed() computed() Currently: Main Use Case for Signlas Business Effects, Events, RxJS and/or RxJS
  8. More: Angular Architecture Workshop • Maintainable Architectures with Modern Angular

    • Strategic Design with Nx & Sheriff • Micro Frontends with Module Federation • Signals and Your Architecture: CD & Zone-less, NGRX & Signal Store, RxJS-Interop German Version: angulararchitects.io/workshop-de English Version: angulararchitects.io/workshop-en
  9. Conclusion Architecture Rule #1 Synchronously derive state where possible Architecture

    Rule #2 Avoid effects propagating state and signal writes Architecture Rule #3 Stores make your reactive flow more manageable Component Store
  10. Conclusion Hint #1 Signals play well together with RxJS Hint

    #2 Avoid Race Conditions (e.g. RxJS and/or loading flag) Hint #3 Be aware of options and consequences of “Business Effect“