Facade Pattern - Design Patterns

แชร์
ฝัง
  • เผยแพร่เมื่อ 8 ก.ย. 2024
  • The facade pattern is one of my favorite design patterns, because of how incredibly useful it is when refactoring code. The idea of the facade pattern is to create your own API that hides away complex or repetitive code so that you are left with a clean and easy to use API. The benefits of this is not only clean code that is easy and fun to work with, but your code is also much easier to refactor when the complex code behind your facade needs to change.
    🚨 IMPORTANT:
    Design Patterns Playlist: • What Are Design Patterns?
    📚 Materials/References:
    GitHub Code: github.com/Web...
    🧠 Concepts Covered:
    - What the facade pattern is
    - How to use the facade pattern
    - Why the facade pattern is important
    - Before/After comparison of the facade pattern
    🌎 Find Me Here:
    My Courses: courses.webdev...
    Patreon: / webdevsimplified
    Twitter: / devsimplified
    Discord: / discord
    GitHub: github.com/Web...
    CodePen: codepen.io/Web...
    #FacadePattern #WDS #DesignPatterns

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

  • @deroesch
    @deroesch 4 ปีที่แล้ว +70

    Greate job with these videos Kyle. I’ve been writing software since 1975 (no kidding) and I like coming here for quick, solid briefings on technologies I haven’t used yet. I’ve actually recommended your videos to team members in my professional circles. Keep it up!

    • @WebDevSimplified
      @WebDevSimplified  4 ปีที่แล้ว +13

      Thank you so much! I am really glad you find my videos useful as a form of informational nuggets since that is my goal with most of my videos.

  • @alexkarydis2270
    @alexkarydis2270 2 ปีที่แล้ว +23

    awesome! I have been using the facade pattern for years at my job's codebase to make api calls without even knowing that it was a pattern. It helps a lot to put things in context. Cheers mate

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

      ditto here, he just described what i have been doiong but didnt know the cool trendy name for it!!

  • @calebprenger3928
    @calebprenger3928 4 ปีที่แล้ว +35

    Your videos are awesome. No weird comedy, no lengthy talking about your life, just code

  • @ProgrammingwithPeter
    @ProgrammingwithPeter 4 ปีที่แล้ว +29

    I love the way how you showed how this looks instead of just talking.

    • @WebDevSimplified
      @WebDevSimplified  4 ปีที่แล้ว +5

      Thank you! I try my best to show while explaining since it is so much easier to see what is happening that way.

    • @slowbr600rr
      @slowbr600rr 3 ปีที่แล้ว +2

      @@WebDevSimplified i think i used to live across the street from you

  • @rnater7145
    @rnater7145 2 ปีที่แล้ว +5

    Great job as usual. Design patterns often arise automatically through experience without studying them or naming them. This is a perfect example, the original has almost the same code for each fetch, is verbose and appears more complex than it could be; it follows a *pattern* and a good developer will immediately see this and abstract it away.

  • @rustamergashev7278
    @rustamergashev7278 4 ปีที่แล้ว +7

    Turns out I always used this pattern and didn't even suspect. Maybe that's why it is so easy to understand. But your explanation is also really simplified. Thanks buddy, great job. Like, subscribe.

  • @szabolcsjobbagy30
    @szabolcsjobbagy30 7 หลายเดือนก่อน

    Thank you again, Kyle,
    you always stick to the point in 100% of your videos,
    no bullshitting, no unnecessary talks, and you use a very easy, understandable way to teach.
    In many other TH-cam channels 60-70% part of the video is unusable, we need to fast forward several times to skip the bullshit parts.
    Thank you again, this is the way to go,
    you set a high level standard for teaching programming!

  • @SXCRD
    @SXCRD 4 ปีที่แล้ว +9

    Videos aimed at helping you code cleaner/more efficient, brilliant idea and nice job! I didn't know this had a name.

  • @shankerm3959
    @shankerm3959 3 ปีที่แล้ว

    Never came across any tutorial that puts it so simply, truly, "Web dev simplified". Thank you

  • @ayushjain349
    @ayushjain349 4 ปีที่แล้ว +5

    hey loved this whole series. please add more patterns to it. like factory etc.

    • @WebDevSimplified
      @WebDevSimplified  4 ปีที่แล้ว +6

      I will do. I really want to get into the command pattern next.

  • @hiradr3857
    @hiradr3857 4 ปีที่แล้ว +106

    How can you not blink at all?!

    • @t4int3d0n3
      @t4int3d0n3 4 ปีที่แล้ว +18

      Don't worry, I'm sure Skynet will work out the kinks at some point. He's probably just a beta test.

    • @lonnekelommers3106
      @lonnekelommers3106 4 ปีที่แล้ว +1

      I know right?! I'm both equally confused and impressed.

    • @Gogolian
      @Gogolian 4 ปีที่แล้ว +1

      Look at "Builder Pattern" video
      The algorithm put missing blinks from this video into that one.

    • @stopPlannedObsolescence
      @stopPlannedObsolescence 3 ปีที่แล้ว

      Is sick and annoying

    • @Rohitsingh-vv3um
      @Rohitsingh-vv3um 2 ปีที่แล้ว

      He is super Human

  • @ebrahimkassem8939
    @ebrahimkassem8939 2 ปีที่แล้ว

    This is the best series for explaining design patterns, i have ever seen. I wish you complte it.

  • @justcurious1349
    @justcurious1349 3 ปีที่แล้ว

    I have been using this for a while but till now didn't know it's actually a design pattern. Thanks for making such good videos on these topics. Before watching your videos on design pattern and principles I used to ignore them.👌

  • @sheririchardson9245
    @sheririchardson9245 4 ปีที่แล้ว +2

    Thank you, this is very helpful. I really need to dive more into design patterns.

  • @siddheshkadam4231
    @siddheshkadam4231 3 ปีที่แล้ว

    The way u explained it... bravo my man !!!!

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

    Great stuff, even though JS is used this can be use with any language. Been doing this for years definitely a way to keep things things clean, keep the codebase flexible, and reduce time to market.

  • @thisissyedbasim
    @thisissyedbasim 3 ปีที่แล้ว

    Didn't know I use Facad pattern all the time. Love your videos!

  • @justinpaoletta1
    @justinpaoletta1 2 ปีที่แล้ว

    You explain things so simply. I love your videos and very much appreciate the effort you put into the explanations. Thank You!

  • @thefakedeal
    @thefakedeal 4 ปีที่แล้ว +9

    Damn, I use this pattern all the time.

  • @mhmdalharbi2370
    @mhmdalharbi2370 4 ปีที่แล้ว

    Thanks, Great vid.
    An alternative way to generate query string is by using URLSearchParams
    For example : new URLSearchParams(params).toString()

  • @ricardoigconsultancy4424
    @ricardoigconsultancy4424 9 หลายเดือนก่อน

    Very good job you done here!

  • @vik8860
    @vik8860 4 ปีที่แล้ว

    You have a soothing and calming voice.

  • @ardhiirfansyabani4921
    @ardhiirfansyabani4921 3 ปีที่แล้ว

    I like how you explain it, really Simplified as your channel name! keep up the great content! thanks.

  • @AlexTechie
    @AlexTechie 4 ปีที่แล้ว +3

    Hey Kyle, hope you're doing well. I just wanted to suggest a video idea for the future on calculating CSS Specificity. I was searching your channel and didn't see it, so I apologize if it's there. But if not, I think it'd be great since it's one of those things that many beginners gloss over, but it's really important. Take care.

    • @WebDevSimplified
      @WebDevSimplified  4 ปีที่แล้ว +2

      This is a great idea. I think I talk about it a bit in my Learn CSS in 20 Minutes video, but a full dedicated video would be best.

    • @AlexTechie
      @AlexTechie 4 ปีที่แล้ว

      @@WebDevSimplified Thank you for the consideration, Kyle! I actually went ahead and learned it, and it's not too complex. I think you can do it in under 3 minutes and I didn't find any video that explains it as well as the site I learned it from, so I think this would be a great video as you'd be one of the first to not only go into it, but to simplify it. FWIW, here's the site I learned it from: www.w3.org/TR/selectors-3/#specificity

  • @haythamdahri9321
    @haythamdahri9321 4 ปีที่แล้ว +1

    Thank you so much, i really like software engineering. Very enjoyable

  • @JM-jk9vz
    @JM-jk9vz 2 ปีที่แล้ว

    Awesome video as always. I have a question though. Do you ever blink bro?

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

    That was a quick and on the point video Great. I've learned something today 😍

  • @hashadhijayasinghe717
    @hashadhijayasinghe717 10 หลายเดือนก่อน

    well explained!

  • @zellaxoxo
    @zellaxoxo 3 ปีที่แล้ว

    Thank you I have an exam tomorrow, helped alot

  • @Pareshbpatel
    @Pareshbpatel 2 หลายเดือนก่อน

    The Facade Design Pattern, so well explained. Thanks, Kyle.
    {2024-07-01}

  • @tobiapioscivoletto3686
    @tobiapioscivoletto3686 2 ปีที่แล้ว

    thank you for this video

  • @klirmio21
    @klirmio21 10 หลายเดือนก่อน

    4 years ago man... time flies

  • @stannone7272
    @stannone7272 4 ปีที่แล้ว +1

    please do more videos about patterns

    • @WebDevSimplified
      @WebDevSimplified  4 ปีที่แล้ว +1

      I have a full playlist on them you can checkout.

  • @avilabiel
    @avilabiel 3 ปีที่แล้ว

    You are a great teacher 🙏🏻

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

    Excellent explanation 👌

  • @rhutikgiradkar
    @rhutikgiradkar 3 ปีที่แล้ว

    thank you

  • @KRIMAart
    @KRIMAart 4 ปีที่แล้ว +1

    Just found ur channel! I love it!

  • @bikramchettri9405
    @bikramchettri9405 4 ปีที่แล้ว

    Congrats on reaching 50k. You earned it.

    • @WebDevSimplified
      @WebDevSimplified  4 ปีที่แล้ว

      Thank you! It really snuck up on me and was quite the surprise. I am so thankful for all the amazing people who have subscribed to my channel.

    • @bikramchettri9405
      @bikramchettri9405 4 ปีที่แล้ว

      @@WebDevSimplified Your videos are very helpful that's why people are subscribing.

  • @anasamati
    @anasamati 4 ปีที่แล้ว

    very good

  • @alreadytakenindeed
    @alreadytakenindeed 2 ปีที่แล้ว

    Quality content as always, great work!

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

    Can't believe Kyle used to talk slowly, guess the was the Engineers beta test release of the Kyle Robot

  • @Sunwarul
    @Sunwarul 4 ปีที่แล้ว

    Thank you so much. Make more videos like this. Thanks again.

    • @WebDevSimplified
      @WebDevSimplified  4 ปีที่แล้ว

      I have a full playlist on design patterns and hope to update it more consistently than I have been.

  • @bharathten1249
    @bharathten1249 2 ปีที่แล้ว

    Appreciate , so well explained

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

    bro never blinks!

  • @khairnarshekhar
    @khairnarshekhar 4 ปีที่แล้ว

    Nice explanation..Keep up the good work.

  • @sillevl
    @sillevl 4 ปีที่แล้ว +4

    I didn't know the facade pattern, and I still don't know if I really understand it. Most of the time my code looks like the end result in the video, but I just keep DRY and SRP in mind. What's the difference between a facade and DRY/SRP? Or is a facade one of the means of achieving DRY/SRP?

    • @AlexTechie
      @AlexTechie 4 ปีที่แล้ว +1

      It's simple (from the description):
      >The idea of the facade pattern is to create your own API that hides away complex or repetitive code so that you are left with a clean and easy to use API.
      An API takes complicated / repetitive code and reduces it to just the info you need with minimal syntax, which is what Kyle did in this video. HTTP requests are a great example of this, since only the options change, so there's no need to repeat the code over and over for making a simple request.

    • @zhongzhongclock
      @zhongzhongclock 4 ปีที่แล้ว +1

      I did the similar work, but don't know its name is facade pattern

    • @danko95bgd
      @danko95bgd 4 ปีที่แล้ว +1

      jQuery api would be a facade over normal DOM operations and aimations etc for example.

    • @sillevl
      @sillevl 4 ปีที่แล้ว

      @@AlexTechie yes, I understand the definition, but I have learned that good organized code with SRP should be Transparent, Reasonable, Usable and Exemplary (aka TRUE). My experience is that when writing TRUE code, you also end up with abstractions that hide complex code, and keeping DRY in mind will prevent repetitive code. So what is the difference if you both end up with similar or equal implementation?

    • @WebDevSimplified
      @WebDevSimplified  4 ปีที่แล้ว +3

      There are some fine lines between clean code and the facade pattern. The main difference is that the facade pattern is about hiding a complex API and exposing a simple API. Generally a facade will be used in many places in your application while SRP and DRY code could be just for a single class/function. It doesn't really matter if something is technically a facade or not. What matters is that the code overall is clean.

  • @pastorfred2543
    @pastorfred2543 4 ปีที่แล้ว

    Wow.. This is amazing.. Thanks Sir.

  • @Ina_dahirr
    @Ina_dahirr 4 ปีที่แล้ว

    Ur so smooth keep it up bro

  • @pipertripp
    @pipertripp 4 ปีที่แล้ว

    Nice blinds BTW. I have the same ones in my office.

  • @gilbertovazdemoraes3093
    @gilbertovazdemoraes3093 2 ปีที่แล้ว

    awesome

  • @dean6046
    @dean6046 4 ปีที่แล้ว

    Thanks for this man!

  • @brunofilgueiras3518
    @brunofilgueiras3518 3 ปีที่แล้ว +1

    so the façade pattern is basically making a connection between complex and simple code... the complex part can be changed, the simpler code can be used everywhere throughout the rest of the project in a more general way avoiding repetition of hard-to-understand code. Am I correct?

  • @NoahNobody
    @NoahNobody 3 ปีที่แล้ว

    It's really interesting how these patterns and SOLID principles are relevant to JS. I never would have thought that.

  • @akn9699
    @akn9699 4 ปีที่แล้ว

    Great One ! Waiting for you to make a MongoDB or Firebase Database Video.

    • @WebDevSimplified
      @WebDevSimplified  4 ปีที่แล้ว +1

      I want to do MongoDB, but haven't had the time. I do have a SQL video though.

  • @VanPetersonKpoti
    @VanPetersonKpoti 4 ปีที่แล้ว

    Thank you a lot

  • @jamesbowring9528
    @jamesbowring9528 2 ปีที่แล้ว

    I always struggle with one thing when it comes to JS and that is the use of const. Coming from VB, C# and so on, I am used to a const being one value throughout the life of the application. Am I right in thinking, in JS, it means a constant type rather than value? So far so good on the design patterns, but this is throwing me.

  • @youcefkhalainou1420
    @youcefkhalainou1420 3 ปีที่แล้ว

    Thanks for this video, in the case when we have a setUser and setPost for exemple how we can refactoring that in getFetch function in order to get information after fetching?

  • @alienspro
    @alienspro 4 ปีที่แล้ว

    Thank's man

  • @dragonore2009
    @dragonore2009 2 ปีที่แล้ว

    Oh, didn't realize this was a pattern, I though something like this would simply be general refactoring.

  • @uplink-on-yt
    @uplink-on-yt 4 ปีที่แล้ว

    Missed opportunity to URLencode the query string.

  • @KallyanBRoy
    @KallyanBRoy 4 ปีที่แล้ว

    For knowledge: The pronouncation of `Facade` is (Fasade) or (Fakade)?

  • @vncntjms
    @vncntjms 2 ปีที่แล้ว

    Facade pattern is just like straight up refactoring

  • @usama57926
    @usama57926 4 ปีที่แล้ว +2

    sir can you make a detailed tutorial on JS....???

    • @WebDevSimplified
      @WebDevSimplified  4 ปีที่แล้ว +1

      This is something I have wanted to do for awhile, but just haven't found the time.

    • @usama57926
      @usama57926 4 ปีที่แล้ว +1

      @@WebDevSimplified Hmmmmmmmmmmm

  • @MrMarkgyuro
    @MrMarkgyuro 4 ปีที่แล้ว

    great video. why do we have to use body.json()?

  • @paliamite
    @paliamite 3 ปีที่แล้ว

    Great video, big thank you!
    So the Facade pattern basically means to extract the repetitive code/logic to a function and use it instead? Also, why do you map params and not just pass it inside the URL?

    • @Mikyye
      @Mikyye 3 ปีที่แล้ว +1

      No, Facade doesn't mean just to extract repetitive logic at all. Facade is for 'cutting' and presentation complex logic into simple interface.

    • @lauyuhin
      @lauyuhin 2 ปีที่แล้ว

      Mapping params means you can potentially construct the query string dynamically without spending too much time to join them which could introduce bug easily. if you would like the original getFetch() to be more fancy, you may also check if url should follow by "?" or "&", or if there is a need to append query string, etc.

  • @markangelogarcia2584
    @markangelogarcia2584 4 ปีที่แล้ว +1

    hi guys i'm an anspiring web dev currently studying html5/css3 so which languages should i learn next?
    (i was work as a technical support in a company but due to massive lay offs i was 1 of the unfortunate who got fired but due to family needs i seek urgent employment currently working as a pump attendant and now seeking to work as a freelancer(web dev) to provide a better future to my family)
    please help me any advice and tips would really help me.............thanks guys

    • @WebDevSimplified
      @WebDevSimplified  4 ปีที่แล้ว

      You should learn JS and then React. With JS skills and React skills you have the best chance of getting hired.

  • @ANNGUYEN-cw7lw
    @ANNGUYEN-cw7lw 4 ปีที่แล้ว

    Hello instructor, can you built a social network app by node js on youtube ?. Thank you instructor very much.

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

    Hi there. I'm looking for information about using the facade design pattern with UI libraries such as Bootstrap. Is this recommended (or common) in the professional world? Thanks

  • @SpencerDavis2000
    @SpencerDavis2000 4 ปีที่แล้ว

    great video. I would use the $http when doing AngularJS is axios similar ?

    • @WebDevSimplified
      @WebDevSimplified  4 ปีที่แล้ว

      I am not sure since I have not used Angular, but if $http is similar to fetch then yes.

  • @3ab9ari1
    @3ab9ari1 4 ปีที่แล้ว

    what is the diffrent between fetch and axios ? thank you

  • @m3rl1on
    @m3rl1on 4 ปีที่แล้ว

    dang if only i code like this from the beginning :(

  • @vitoroliveira6170
    @vitoroliveira6170 4 ปีที่แล้ว

    Is this pattern related to the Dependency Inversion principle?

  • @HologramJay
    @HologramJay 3 ปีที่แล้ว

    Should I add anything else besides the script tag for the cdn to index.html for axios to work? I keep getting an error that says axios isn't defined.

  • @utof
    @utof 2 หลายเดือนก่อน

    this feels like DRY concept to me, Is there any difference, what am i missing?

  • @baatar
    @baatar 4 ปีที่แล้ว

    So, is it basically an interface on top of an interface?

  • @rabbyhossain6150
    @rabbyhossain6150 2 ปีที่แล้ว

    Isn't it also the "DRY" principle?

  • @netbin
    @netbin 3 ปีที่แล้ว

    So de facto refactoring is facade pattern or what?

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

    Kyle talked so slowly back then. I can't tell if it's purposeful or if he's now speeding up the video.

  • @im-luke
    @im-luke 2 ปีที่แล้ว

    Very good vid with usefull examples but it seems to me more like a DRY principle than Facade Pattern. Isn't Facade Pattern more OOP related? When you have and object that hides a methods of a complex system and provides only necessary tools.

  • @kamranbashir4842
    @kamranbashir4842 3 ปีที่แล้ว

    So design pattern is basically common sense.

  • @FelipeCoralSasso
    @FelipeCoralSasso 2 ปีที่แล้ว +1

    3:30 Tell me you use VS Code without telling me you use VS Code

  • @koraytugay
    @koraytugay 4 ปีที่แล้ว

    why do you say git instead of get ?

  • @richienabuk
    @richienabuk 4 ปีที่แล้ว

    I use the pattern but didn't know the name.

  • @imanidiot2180
    @imanidiot2180 4 ปีที่แล้ว +2

    do you even blink bro

  • @Alexis-ei9ct
    @Alexis-ei9ct 2 ปีที่แล้ว

    That is not Facade Pattern. It is only a reusable function.

  • @Mikyye
    @Mikyye 3 ปีที่แล้ว

    To me, this video is an odd explanation of Facade pattern... Author just created function-helper to avoid repeating

  • @johnddonnet5151
    @johnddonnet5151 2 ปีที่แล้ว

    How about using ONE custom hook, this video is outdated

  • @ezeargen
    @ezeargen 4 ปีที่แล้ว

    Please blink!

  • @guy11827
    @guy11827 4 ปีที่แล้ว

    First

  • @dustinpoissant
    @dustinpoissant 4 ปีที่แล้ว

    This is called an alias

  • @Quynn-Oneal
    @Quynn-Oneal 2 ปีที่แล้ว

    I don't think your example can be called Facade pattern.

  • @julian_handpan
    @julian_handpan 2 ปีที่แล้ว +1

    That’s actually not then facadepattern… DRYing a little bit the code in a small reusable function it’s not facade my dude 🤣

  • @EthanG298
    @EthanG298 3 ปีที่แล้ว +1

    so the facade pattern is just using functions? lol

  • @massalkhii
    @massalkhii 7 หลายเดือนก่อน

    why does bro talk like a robot

  • @ahmedboutaraa8771
    @ahmedboutaraa8771 3 ปีที่แล้ว

    /////

  • @chesswithsalman3375
    @chesswithsalman3375 4 ปีที่แล้ว

    I need your assistance with something
    A very serious project I believe we can work on together

  • @andreaskarz
    @andreaskarz 2 ปีที่แล้ว

    Why do you make it so complicated with the parameters? Why don't you send the parameters with the URL? This way the facade also works for endpoints that don't expect parameters without a default value for params.