SIMPLIFY Your Python Code With The Facade Pattern

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

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

  • @tryoxiss
    @tryoxiss 6 หลายเดือนก่อน

    Interesting. In the rust world we also use what we call facdes, but not like this. In rust, a facade is simply an interface with no inhernent behavour so it can easily work with any implementation. For example the `log` module is a facade, projects pick thier own logger but the `log` facade provides a consistant API no matter what was chosen.
    Serde is also a common facade, a set of a few macros and traits which allow different implementations of data de/serialization with the same interface.

    • @IsaacHarrisHolt
      @IsaacHarrisHolt  6 หลายเดือนก่อน

      Interesting. That wouldn't technically be the facade pattern, but the strategy pattern, by the sound of it.

  • @rnzqt
    @rnzqt ปีที่แล้ว

    Another great vid!
    Cheers

  • @andrewbuzz7308
    @andrewbuzz7308 8 หลายเดือนก่อน

    Hm. "Self" seems like the most redundant type hint of the decade

    • @IsaacHarrisHolt
      @IsaacHarrisHolt  8 หลายเดือนก่อน

      I like it! It makes it obvious what a method returns. Great for the builder pattern

    • @andrewbuzz7308
      @andrewbuzz7308 8 หลายเดือนก่อน

      @@IsaacHarrisHolt I can understand in case of return type annotation but not for the parameter. Linters and programmers alike already assume self is of type Self to my experience.

    • @IsaacHarrisHolt
      @IsaacHarrisHolt  8 หลายเดือนก่อน

      Oh yeah they do. I mostly include it for completeness... and my OCD 😅