How billionaire Charles Munger fixed my Angular app

แชร์
ฝัง
  • เผยแพร่เมื่อ 1 ต.ค. 2024

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

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

    Join my newsletter for more content: mobirony.ck.page/4a331b9076

  • @beckerp86
    @beckerp86 3 หลายเดือนก่อน +48

    I loved the video! A great mindset to have. And, as requested, I unsubscribed.

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

      I've decided always invert is terrible advice now

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

      @@JoshuaMorony thinking in takeUntilDestroyed() terms no one should unsubscribe as long as your chanel is available 😅

  • @lordicemaniac
    @lordicemaniac 3 หลายเดือนก่อน +7

    OoOor, you could just pick the state service out of word/dashboard service to be its own shared service and both word/dashboard service could be dependent on it... if you could that easily move those states to another service, then it probably can be service on its own

  • @TheSysmat
    @TheSysmat 3 หลายเดือนก่อน +4

    Invert dislike 😅

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

    You could coin this as the Dependency Inversion principle!

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

      It's funny because this is quite literally a dependency inversion, but I've never really though about DI from SOLID in that way (maybe I should), but I think about it more in the context of depending on abstractions instead of concretions (not changing the direction of a dependency)

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

    I just thought that DI is a monadic thing, like IO in Haskell.
    We act as if we have our dependencies, f.i. IO and then when executed we're actually provided with them and execution might go along.
    strikingly similar to IO monad.

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

    Great mantra. Thanks!

  • @mauricio.azevedo
    @mauricio.azevedo 3 หลายเดือนก่อน

    The solution was so obvious (as you stated yourself) that I couldn't appreciate how the inverted mindset helped

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

      That highlights that it's not just useful for complex things imo, miss an obvious solution, have a technique for questioning/checking yourself, find the obvious solution. I don't know about you but I frequently miss obvious solutions or get trapped in a particular line of thinking.

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

    Cool! A lot of our mindset is implicit so it's hard to explain why some patterns are better. It's great you were able to explain this soon after you realized it. I was lucky enough in 2017 to work with a super computer science geek who explained something like this to me. Basically that dependencies can look like a diamond instead of a tree, where there's the root of the application that's extremely light, and then you can have other stuff that's common for all features that isn't in the root, but rather a tiny standalone thing that gets imported into other things. So small, focused things get imported into bigger features that combine features, like dashboards.
    When he explained it, it felt like my brain became untangled, and like you said it became obvious in hindsight. So obvious that I quickly forgot the mental model I used to have so I can't even explain the realization anymore! And I can't immediately tell who doesn't think of things this way either. But I see weird import patterns all the time. For example: importing routing modules into feature modules. It seemed like the whole community was doing that before standalone components.

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

      I think the idea about a lot of our mindset being implicit is interesting. I feel like I can even use an idea or pattern quite effectively for a long time before some final piece clicks into place that allows me to think about it in a more concrete way (and a way that I could explain without vaguery and hand waving). Declarative code was very much like this for me - for a long time I used the concepts and benefited from them, but then at some point it's like some final little piece of the puzzle clicks in that reveals everything with much more clarity. I often get the sense that my subconscious mind knows these things better than I do (which leads to those ah-ha! moments in the shower), the trick I feel is getting to the point where I can think about it clearly in my conscious mind. Feels a bit woo-woo but I've wondered if there are ways to better or more intentionally leverage our subconscious mind or if there has been much research done in that area.

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

      Definitely not woo woo . I've read a few psychology books and I think most people underestimate how much of who they are and what they think is subconscious.

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

      ​@@mfpears have you read The Master and His Emissary? It's been on my reading list for years now, if I remember correctly it covers the idea of our conscious mind sort of being like a dumb king that thinks it's in control/thinking of all these great plans, but most of it is coming from our subconscious mind (think it touches on implications of the split brain experiments). Curious to know if you think it's worthwhile if you have read it.

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

      @@JoshuaMorony I haven't, but I've learned a lot of psychology over the past 10 years, and now I'm realizing how little psychology most people understand, so I'm looking for resources that might be simpler or purer than how I came to learn these things. I read The Righteous Mind in 2015 and Jonathan Haidt talks about "the elephant and the rider"-so, different metaphor, but same idea I think. But it also has a lot of political stuff that might be boring to some people. So I'm looking for a resource that clearly and convincingly lays out the argument for the importance of subconscious processing.
      I'm trying to remember the first concepts that opened my mind to this idea, because a lot of people resist it pretty strongly. It may have been How to Win Friends and Influence People, because it showed how it's the rule rather than the exception that in order to persuade people, the majority of what you tend to has to be stuff other than the main point you're trying to communicate. Because deep down most people most of the time have to know you're on their side before they'll even listen to you.
      And then once you have an idea that changes your perception of people and the world, you start seeing it everywhere. So that's why it's easy to forget what it's like to not see it at all.
      So this is my primary focus now. I still love learning, but I feel like I've strayed so far from common wisdom that I need to sort of find a way to start bringing more people along. In programming as well.

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

    Nice ending!!! lol!!!

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

    Hello Joshua, thanks for sharing the video.
    What your thoughts about creating a specific lib/module to expose that dependecy like a "contracts"? When i have composable features, like "customers", "sales" to build a "dashboarad". I expose 2 new from "customers" and "sales" called "dashboard-api-claim" and manage what would be exposed to dashboard feature, commonly data-access/some-api-service.

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

      If I'm following you correctly then I think that makes sense for having more granular control over what is exposed (I haven't personally done something like it though)

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

      Yes this is mostly what is recommended and i think Manfred Styer and the angular architect team started it. Inverting is good but it ends up ugly as time pass cause you end up having a shared service that has trivial APIs cause of some small dependency.

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

      @@g-luu Interesting to know. I never did large projects that way thats why i probably never notice that

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

    I use charlies estate management framework.

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

      I'm sure I'll be reading more from Charlie, I picked the book up on a whim but I don't think I've taken so many notes from a book in my life

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

    Well I unsubscribed since that was inverting the state. /s
    Just make sure the part you are inverting needs to be done.

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

    Won't this lead to a pessimistic approach initially to solve our problems

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

    why do you always need "as const" in your signalSlice fun for the status prop in your state?

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

      Because its supposed to be a specific union type or strings (e.g. "a" | "b" | "c"), without "as const" the type will just be a generic "string" not a specific string

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

      @@JoshuaMorony that makes sense, thank you. I was creating specific types but I like your const approach most. Thank you Josh, been trying the signalslice and I find it awesome :)

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

    That actually makes a lot of sense. Regarding folder structure - I have all my data fetching services in one place, kinda like this: core/inventory/products/ product.service.ts and product.types.ts. My core is kinda like your shared as the services can be injected by anyone and don't hold any state, and then I have my pages: pages/inventory/products/products.ts and products.store.ts (ngrx component store) which then holds all the state of that component.

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

      And to not unnecessarily fetch data multiple times I have implemented a caching service using cashew using cache buckets and a cache bucket gets cleared by my backend when someone changes something -> a cache clearing event with the specific bucket name is sent to all clients connected via SignalR. Don't know how well that will scale though but it works very well and I have made it so that if you fetch lets say all products it also caches the keys of each entity and if you fetch a single product it won't have to go to the server if said product has already been fetched with the "get all" request (or paginated request in my case)

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

      @@MrBloodWoork Wow, neat idea. I used to cache manually some standalone bits of state that were fetched often, but never implemented scaleable solution. I m just wondering. How exactly backend clears cached data? You receive some kind of array key with changed objects or something?

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

      @@loko1944 No, in the frontend I have so called cache buckets. With cashew you can decide for every request which cache bucket the data should be stored in. I used a string backed enum to assign the names to the buckets. Let's assume we have the products cache bucket and we use it for the GET /products request in the frontend. Now in my backend I just call my cache invalidation service with the products enum value right after code that changes or deletes a product. So when POST /products is called then a message is broadcasted to all connected clients to clear their cache with the cache bucket name "products". However I did have to create a dependency map and clear all other buckets which depend on products because e.g. an asset has a product and so assets have to be cleared too because I have joined assets and products when fetching assets to be able to display the assets product name.

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

      @loko1944 No, in the frontend I have so called cache buckets. With cashew you can decide for every request which cache bucket the data should be stored in. I used a string backed enum to assign the names to the buckets. Let's assume we have the products cache bucket and use it for the GET /products request in the frontend. Now in the backend I just call my cache invalidation service with the products enum value right after code that changes or deletes a product. So when POST /products is called then a message is broadcasted to all connected clients to clear their cache with the cache bucket name "products".

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

      @@loko1944 However I did have to create a dependency map because e.g. an asset has a product and so assets have to be cleared too because I have joined assets and products when fetching assets so I can display their product names.