A "hidden" side benefit of DECLARATIVE code

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 ก.ย. 2024

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

  • @JoshuaMorony
    @JoshuaMorony  3 หลายเดือนก่อน +1

    Get extra content in my newsletter: mobirony.ck.page/4a331b9076

  •  3 หลายเดือนก่อน +8

    I believe that was the whole idea behind the code folding feature.

  • @SuperQuwertz
    @SuperQuwertz 3 หลายเดือนก่อน +1

    What editor do you use? It looks like Neovim, but has UI elements which I thought are not achievable in a regular terminal

    • @JoshuaMorony
      @JoshuaMorony  3 หลายเดือนก่อน +1

      It's neovim (LazyVim specifically), you can check my config here if you like: github.com/joshuamorony/lazyvim/

    • @SuperQuwertz
      @SuperQuwertz 3 หลายเดือนก่อน

      @@JoshuaMorony Thank you!
      I'll check it out :)

  • @justfizzbuzz
    @justfizzbuzz 3 หลายเดือนก่อน +1

    Where can we try the game? 😅 super curious

    • @JoshuaMorony
      @JoshuaMorony  3 หลายเดือนก่อน

      You can check it out at urltown.io if you like (it's more of a strange productivity/organisation tool than a game though)

  • @enverusta7811
    @enverusta7811 3 หลายเดือนก่อน

    In this approach have you ever encountered an issue like in some cases your observable triggered when you do not actually need it. Let's say you combined 2 observables, however what you actual need depends on a property of that object. What's your approach in that case? Think like you only depend xObj.foo not need to subscribe the entire object's state change. In some cases xObj.y might change and you might uninentionally trigger your entire combineLatest([x, y, z]) or something.

    • @JoshuaMorony
      @JoshuaMorony  3 หลายเดือนก่อน +1

      The key is just creating a stream from whatever it is you want to react to, so if you did want to only re-calculate some thing when some particular property of an object changed then you could create a stream for that, e.g. perhaps you have a myThing$ stream that emits new objects, but if you only want to react to myThing.x changing then you could create a myThingX$ stream that maps to that specific property

    • @enverusta7811
      @enverusta7811 3 หลายเดือนก่อน

      @@JoshuaMorony Thank you for the response!

  • @geexup
    @geexup 3 หลายเดือนก่อน

    Files tree on the right side is crazy btw

  • @sulaimantriarjo8097
    @sulaimantriarjo8097 3 หลายเดือนก่อน +6

    Do you share your code in this video in github by any chance? I want to learn how you set up your state

    • @JoshuaMorony
      @JoshuaMorony  3 หลายเดือนก่อน +2

      The Angular example from the video can be found here: github.com/joshuamorony/angularstart-quicklists/tree/ngxtension this isn't specifically the default way I tend to go about managing state, I have some more recent videos on that topic with example code as well though if you want to explore

  • @AndresJimenezS
    @AndresJimenezS 3 หลายเดือนก่อน +1

    You should a take a look to EffectTs im pretty sure you Will enjoy to code and to push functional and declarative to the next level

  • @jordanking3715
    @jordanking3715 3 หลายเดือนก่อน

    "more painful than using vim as my daily editor" hahahaha

  • @ucnguyenphanhuynh3134
    @ucnguyenphanhuynh3134 3 หลายเดือนก่อน

    Good

  • @enverusta7811
    @enverusta7811 3 หลายเดือนก่อน

    If you don't mind, could you show us a declarative example for this scenario:
    - paginated list
    - search ability
    - each item's properties might change.
    Think like you have a grocery list but the price might change for each item. Also, the user might change the price and then search something and remove that search. At the end we should keep the state of that price. I think you got my point. In these kind of tough scenarios, how should we hande it with reactive approaches.

    • @JoshuaMorony
      @JoshuaMorony  3 หลายเดือนก่อน +1

      If you're willing to do some digging I have covered similar scenarios to this in other videos, but there isn't really anything special/different to consider. In any case here the "thing" we want to declaratively define is a grocery list. What does that grocery list depend on: the current page, the current search term, the current filters - we identify all the things that the grocery list needs to react to and generally do something like use combineLatest() to create a stream that combines all of these things. This stream now emits when any of the things the grocery list depends on changes. We can then switchMap that to the request to server to load the appropriate items based on the page/search/filters.
      There is also a slightly atypical requirement you mention here about the price of items changing, I assume you mean that rather than the user filtering the price the price for the item might change on the backend and this should be reflected in real time (i.e. rather than just having the price update the next time the data is fetched from the server, which would be more typical). In any case, you could still do that, but now the underlying price data from the server is another thing grocery list is dependent on, and so you would also need a stream of that data to incorporate into this combineLatest
      In short though, create a stream that combines all of the other things the thing you are defining depends on, and react to that.

    • @enverusta7811
      @enverusta7811 3 หลายเดือนก่อน

      @@JoshuaMorony Really thank you so much for the detailed explanation. Apreciate it!

  • @stevenvaught9429
    @stevenvaught9429 3 หลายเดือนก่อน

    You can get this same thing in React with a combination of derived state and IIFE

  • @nicholasantidormi6238
    @nicholasantidormi6238 3 หลายเดือนก่อน

    Everything is a stream

  • @dimitrisdrosos245
    @dimitrisdrosos245 3 หลายเดือนก่อน

    I see you have lsp and highlighting in your html files, could you share how you did it? I don't have any in my .html files. Thanks for your great angular content.

    • @JoshuaMorony
      @JoshuaMorony  3 หลายเดือนก่อน +1

      You can check out my neovim config here if you like: github.com/joshuamorony/lazyvim/ but generally (assuming neovim) for any particular file format you want to make sure you have the Treesitter Parser installed for it + optionally LSP

    • @dimitrisdrosos245
      @dimitrisdrosos245 3 หลายเดือนก่อน

      @@JoshuaMorony thanks, I will.