TypeScript Factory Patterns (No BS TS Series 2 Episode 1)

Поділитися
Вставка
  • Опубліковано 19 вер 2021
  • No BS TS is back! With the first in an all new series where we cover all the patterns in the original Design Patterns book (and more). This time we are looking at the factory patterns; Abstract Factory, Builder and Factory Method. All of these patterns help you build reusable well architected code.
    No BS TS Book: no-bs-ts.myshopify.com/
    Code: github.com/jherr/no-bs-ts/tre...
    👉 What's my theme? Night Wolf [black]
    👉 What's that font? MonoLisa
    👉 Jack is also on the React Round Up podcast: devchat.tv/podcasts/react-rou...
    👉 Don't forget to subscribe to this channel for more updates: bit.ly/2E7drfJ
    👉 Discord server signup: / discord
    Thank you for watching this video, click the "SUBSCRIBE" button to stay connected with this channel.
    #typescript #nobsTS
  • Наука та технологія

КОМЕНТАРІ • 90

  • @mrdeurknopp
    @mrdeurknopp 2 роки тому +31

    Jack, your content is such a breath of fresh air, most tutorials are aimed at complete beginners which is fine of course but it's nigh impossible to find good tutorials dealing with more advanced concepts, especially when it comes to web development. Cheers man, keep up the good work!

    • @jherr
      @jherr  2 роки тому +5

      Thank you! That's what I'm trying to do!

    • @aram5642
      @aram5642 2 роки тому +1

      Plus, these two windows make a beautiful, live background! Wonderful! Let others stick with dull color gradient lights...

  • @Nonsense116
    @Nonsense116 2 роки тому +2

    I'm so excited! I've been digging into a lot of the content you make lately and it has been challenging me to start writing code where I could describe the implementation in a meaningful, decisive, way. The quality and maintainability of code I write has been dramatically changed from these videos! Thank you so much!

  • @chrisjames278
    @chrisjames278 2 роки тому +4

    great series, looking forward to the rest of the episodes!

  • @Messirobben047
    @Messirobben047 2 роки тому +2

    wow, most of the content available online covered patterns using classes, loved that you covered functional aspect. thanks Jack!

  • @abhisheksharma9796
    @abhisheksharma9796 2 роки тому +3

    This one was very informative. Thanks for your wisdom, and the art to teach it in such a great format. ✌️

  • @lawrencejones51
    @lawrencejones51 Рік тому +2

    I appreciate concrete implementations of design patterns in Typescript. And I really appreciate seeing *both* a class-based approach and a functional approach. It broadens my mind about the capabilities of TypeScript. Thanks!

  • @Billiam112
    @Billiam112 2 роки тому +1

    Great stuff. Looking forward to this series! 👌

  • @iamilyes
    @iamilyes 2 роки тому +1

    I have been waiting for this serie... Thank you soo much 🙏

  • @dianrahmaji
    @dianrahmaji 2 роки тому +1

    Design Patterns with TypeScript is all i need for now. Thanks!

  • @Cowglow
    @Cowglow 2 роки тому +1

    Love the content! Keep up the great work

  • @richwatts9546
    @richwatts9546 2 роки тому +4

    Absolutely love these "no BS" based videos - only (very subjective) improvement I would like to see is zooming out a little on the IDE!

  • @shashikaxp1
    @shashikaxp1 2 роки тому +2

    I don't know what to say, thank you so much for these videos.

  • @buchdev
    @buchdev 2 роки тому +1

    Great! thanks for sharing those pattern with us. I like so much the factory pattern, i love it!

    • @jherr
      @jherr  2 роки тому +1

      Fantastic! Stick around for more patterns coming soon!

  • @saideepesh6036
    @saideepesh6036 2 роки тому +1

    As always awesome content

  • @MK_AU
    @MK_AU 2 роки тому +2

    Great video... purchased the book to support this series

    • @jherr
      @jherr  2 роки тому

      Thank you so much!

  • @vitormalencar
    @vitormalencar 2 роки тому +2

    haha please keep the books coming I loved the module federation one and im sure that I will like this one as well

  • @ngneerin
    @ngneerin 2 роки тому +22

    Can you make a tic tac toe or snakes and ladder game using TS with patterns to get actual demonstration of patterns in real world problems?

  • @DiegoBM
    @DiegoBM Рік тому +3

    Fantastic content Jack! I reckon this has the potential to be a fantastic reference series for most TS developers, but I believe that it could be even more useful if, before jumping into your actual implementations, you could spend a minute or two explaining (and maybe showing the GoF diagram of) the generic pattern, and then, as you're doing, show your example implementation applied to a practical case. That would probably make it perfect.

  • @Luxcium
    @Luxcium Рік тому +1

    Also in agreement with the other comments on this video we need more tutorials that are made such that beginners can figure out by themselves but where intermediate level script kiddies and other advanced programmers can have fun learning new stuff without having to learn how to install VSCode or NodeJS for the thousandth time 😅😅😅🎉 Jack is great at doing just that, Awesome 👏🏼

  • @ryanjensen4232
    @ryanjensen4232 Рік тому +1

    You rock man!

  • @yaserghananwi
    @yaserghananwi 2 роки тому +2

    Thank you for this tutorial was very 👍

  • @jonasboardwalker
    @jonasboardwalker 2 роки тому +2

    I put a like on your video before it has started

    • @jherr
      @jherr  2 роки тому

      I won’t tell anybody. 😂

  • @tomross4599
    @tomross4599 2 роки тому +1

    Love the pattern of your shirt 😊

  • @oumardicko5593
    @oumardicko5593 2 роки тому +2

    Oooooh yeah, finally something about design patterns 😍

    • @jherr
      @jherr  2 роки тому +2

      And much more on the way.

    • @oumardicko5593
      @oumardicko5593 2 роки тому

      @@jherr can't wait

  • @cas818028
    @cas818028 2 роки тому +1

    You knocked it out of the park Jack with demonstrating both the oop based versions along with the functional. That was lacking in many tutorials. Also I am still trying to hire you! Reach out if interested.

  • @sagarreddy7461
    @sagarreddy7461 2 роки тому +1

    Thanks a lot jack

  • @iuliancarnaru954
    @iuliancarnaru954 2 роки тому +1

    I am a fan of the content of this channel, buying the book is a great investment ... click...click... buy!

    • @jherr
      @jherr  2 роки тому

      Thank you!

  • @alexchernenko4901
    @alexchernenko4901 2 роки тому +1

    Super!!!

  • @babyboie20
    @babyboie20 2 роки тому +1

    Getting the book TODAY!!!

    • @jherr
      @jherr  2 роки тому

      Thank you!!!

  • @farouktouil5036
    @farouktouil5036 2 роки тому +2

    Hi , Jack Congrats for the book,

    • @jherr
      @jherr  2 роки тому +1

      Thanks. I'm hoping that it helps folks get more out of the series.

  • @technikhil314
    @technikhil314 2 роки тому +1

    Wow design patterns BS TS. Didnt saw that coming.

  • @yourplayer5
    @yourplayer5 2 роки тому +1

    Another use case for the builder pattern that I like to use is to improve readability of
    A) functions with many parameters or
    B) complex instantiations of objects.

    • @jherr
      @jherr  2 роки тому

      Very true!

  • @bafian
    @bafian Рік тому +1

    nice

  • @ChrisJarzynka
    @ChrisJarzynka 2 роки тому +1

    I came for the Typescript and GoF Design Patters but am staying for Uchuu Senkan Yamato! Nice!

    • @jherr
      @jherr  2 роки тому +1

      Hahah! You are the first person ever to notice that!

  • @bonuocdua
    @bonuocdua Рік тому +1

    please make a playlist for thisssss

  • @piotrzajas9014
    @piotrzajas9014 Рік тому

    Didnt know that Kevin De Bruyne knows TS and design patterns :D. Just kidding ofc, great content ;)

  • @bonsayeb9620
    @bonsayeb9620 13 днів тому

    Any plans to continue this series? Thanks for the videos

  • @techworld3043
    @techworld3043 2 роки тому +2

    yo ho. I should watch this.

  • @JulioDx3480
    @JulioDx3480 2 роки тому

    Great video! Thank you.
    Have you considered releasing a hardcover version of the No BS TS Book when all tutorials are released?

    • @jherr
      @jherr  2 роки тому

      Maybe, I could sell it through O'Reilly or something. :)

  • @bachirseghir9952
    @bachirseghir9952 8 місяців тому

    Jack , I think you used Template pattern in the directory Scrapper when you transformed it from Builder pattern to Factory pattern , using abstract class and overriding it throught inheritance to include the missing methods isJSONFile , readText and readJSON , isn't it ?

  • @sairaj5660
    @sairaj5660 2 роки тому +1

    Yai 🥳🥳🥳🥳

  • @Luxcium
    @Luxcium Рік тому

    I don’t know if UA-cam has a way to link to a playlist inside of the individual videos but some time I see the next video in my suggested next video (in other context or from other UA-camrs when I am not in the playlist of a series)… I don’t get suggested videos in this series though so I am just curious 🧐

  • @MartinStarosta
    @MartinStarosta 2 роки тому

    Please, what VS Code theme is Jack using?

  • @henrykhosasih8781
    @henrykhosasih8781 11 місяців тому

    Hello, I'm new to design patterns. Just wondering if design patterns are used in real world codebases?

  • @vijayshankar5250
    @vijayshankar5250 11 місяців тому

    Hey dude I've been confused about typescript and zod which one i prefer for my application.typescript offers development experience.but zod offers runtime type checking 🤨

  • @ngneerin
    @ngneerin 2 роки тому +1

    Is it that breaking down classes to functionalities such that it can be reusable in different contexts is builder pattern?

    • @jherr
      @jherr  2 роки тому

      It's that you are loosening the coupling between the code that creates significant output from the code that figures out whether it should be created. In the case of builder the pattern is that you are passing the building code to the function or class that does the computing or parsing work. You can see this pattern in things like parsing libraries. So you have the parser that goes through the data, and then the builder that gets callbacks when the parser finds important thing and builds the right output.

  • @frederickobeng-nyarko2868
    @frederickobeng-nyarko2868 2 роки тому +1

    I don't know, but hearing him speak alone is soothing.. You have no choice but to understand what he's teaching, loool..

  • @jrs_devs
    @jrs_devs 2 роки тому

    Ey Jack!, This first episode and the 5th of the Series 2 are not included in your No BS TS Playlist

  • @alvarobyrne
    @alvarobyrne 2 роки тому +1

    Can these/those design patterns be applied/used in react development- I'm just starting to see the chapter and I hear "functional version" so I bet that YES they can... Let´s see...

    • @jherr
      @jherr  2 роки тому +1

      Yes. These can absolutely be used with react, angular or vue.

  • @nyambe
    @nyambe 2 роки тому

    I am having some issues with TS and rest calls. Is this covered in no BSTS?

    • @jherr
      @jherr  2 роки тому

      In series 1 we cover react and rest calls.

  • @brunodepaula5293
    @brunodepaula5293 3 місяці тому

    Great content! A feedback..The builder example was not that good. Because we sshould not have a file reader that do both json and text.
    But I understand the idea was to show the builder pattern...
    A better example could be an OrderBuilder, in which you have functions to add item, add delivery address, ...
    And then return the builder object on these functions.
    And then you can fluid create the object like:
    orderBuilder
    .addItem("item 1")
    .addItem("itrm 2")
    .setDeliveryAddress("address")
    .build()

    • @jherr
      @jherr  3 місяці тому

      Why wouldn't you want a reader for JSON and a reader for text?

  • @sebmonti5904
    @sebmonti5904 2 роки тому +1

    Is the book a pdf or it is compatible kindle and apple book ? To resize font etc

    • @jherr
      @jherr  2 роки тому +1

      It's just in PDF currently. I tried to render it as an ePUB but the formatting was badly mangled. I'll keep working on it though. I do want it to be available in multiple forms.

    • @sebmonti5904
      @sebmonti5904 2 роки тому +1

      @@jherr will I get the ePub file if you manage to create it later if I purchase the pdf now ?

    • @jherr
      @jherr  2 роки тому +1

      @@sebmonti5904 Yep.

    • @sebmonti5904
      @sebmonti5904 2 роки тому +1

      @@jherr getting the book now ;)

    • @jherr
      @jherr  2 роки тому

      @@sebmonti5904 You rock!

  • @vungocduyet1193
    @vungocduyet1193 2 роки тому +1

    You forgot to put in No BS TS list

  • @Boris1990ua
    @Boris1990ua 2 роки тому +1

    Great video, but I am a little bit confused 🤔 third example Factory Method looks to me more like Template Method, DirectoryScraper delegates implementation of specific behavior to FileReader, not object creation, why it's a factory?

    • @jherr
      @jherr  2 роки тому +1

      Because the creation of the objects is delegated to abstract "factory" methods. Let's take a database reading class. If it reads from the list of customers and then creates customer objects for each one, then there is a tight coupling there. If it delegates the chore of creating the customer objects to a method, then those can be overridden to create different types of customer objects.

    • @jherr
      @jherr  2 роки тому +2

      Also, the second and third look a lot like the Strategy pattern. :) Lots of these patterns are closely related.

    • @Boris1990ua
      @Boris1990ua 2 роки тому

      @@jherr Thanks for clarification👍
      I look forward to seeing your next videos.

  • @TheNsn666
    @TheNsn666 2 роки тому +1

    Where do you live ? the view from your window is awesome..

    • @jherr
      @jherr  2 роки тому

      Oregon. And that actually is my office window, though it's a plate so that I can do the green screen stuff.

  • @PS-dp8yg
    @PS-dp8yg 2 роки тому +1

    Isn't it an anti pattern not implementing debug and info for ProductionLogger?

    • @jherr
      @jherr  2 роки тому

      No, they are implemented as stubs.

    • @PS-dp8yg
      @PS-dp8yg 2 роки тому +1

      @@jherr Thanks for the reply and awesome content. I don't know...having just stubs feels dirty to me.

    • @jherr
      @jherr  2 роки тому

      @@PS-dp8yg Fair, but if you don't have them you'd have to do logger.log?.() all over the place and if you miss one... boom goes the dynamite.

    • @PS-dp8yg
      @PS-dp8yg 2 роки тому

      @@jherr LOL...fair enough, but what if we create separate interfaces for each consoles and have the clients (DevelopLogger and ProductionLogger) implement what they needed. In this case, DevelopLogger implements all 4 interfaces and have ProductionLogger implements the only 2 interfaces.

    • @jherr
      @jherr  2 роки тому

      @@PS-dp8yg So the factory would return IDevelopmentLogger | IProductionLogger? I'm confused.