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 - Наука та технологія
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!
Thank you! That's what I'm trying to do!
Plus, these two windows make a beautiful, live background! Wonderful! Let others stick with dull color gradient lights...
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!
great series, looking forward to the rest of the episodes!
wow, most of the content available online covered patterns using classes, loved that you covered functional aspect. thanks Jack!
This one was very informative. Thanks for your wisdom, and the art to teach it in such a great format. ✌️
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!
Great stuff. Looking forward to this series! 👌
I have been waiting for this serie... Thank you soo much 🙏
Design Patterns with TypeScript is all i need for now. Thanks!
Love the content! Keep up the great work
Absolutely love these "no BS" based videos - only (very subjective) improvement I would like to see is zooming out a little on the IDE!
I don't know what to say, thank you so much for these videos.
Great! thanks for sharing those pattern with us. I like so much the factory pattern, i love it!
Fantastic! Stick around for more patterns coming soon!
As always awesome content
Great video... purchased the book to support this series
Thank you so much!
haha please keep the books coming I loved the module federation one and im sure that I will like this one as well
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?
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.
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 👏🏼
You rock man!
Thank you for this tutorial was very 👍
I put a like on your video before it has started
I won’t tell anybody. 😂
Love the pattern of your shirt 😊
Oooooh yeah, finally something about design patterns 😍
And much more on the way.
@@jherr can't wait
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.
Thanks a lot jack
I am a fan of the content of this channel, buying the book is a great investment ... click...click... buy!
Thank you!
Super!!!
Getting the book TODAY!!!
Thank you!!!
Hi , Jack Congrats for the book,
Thanks. I'm hoping that it helps folks get more out of the series.
Wow design patterns BS TS. Didnt saw that coming.
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.
Very true!
nice
I came for the Typescript and GoF Design Patters but am staying for Uchuu Senkan Yamato! Nice!
Hahah! You are the first person ever to notice that!
please make a playlist for thisssss
Didnt know that Kevin De Bruyne knows TS and design patterns :D. Just kidding ofc, great content ;)
Any plans to continue this series? Thanks for the videos
yo ho. I should watch this.
Great video! Thank you.
Have you considered releasing a hardcover version of the No BS TS Book when all tutorials are released?
Maybe, I could sell it through O'Reilly or something. :)
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 ?
Yai 🥳🥳🥳🥳
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 🧐
Please, what VS Code theme is Jack using?
Hello, I'm new to design patterns. Just wondering if design patterns are used in real world codebases?
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 🤨
Is it that breaking down classes to functionalities such that it can be reusable in different contexts is builder pattern?
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.
I don't know, but hearing him speak alone is soothing.. You have no choice but to understand what he's teaching, loool..
Ey Jack!, This first episode and the 5th of the Series 2 are not included in your No BS TS Playlist
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...
Yes. These can absolutely be used with react, angular or vue.
I am having some issues with TS and rest calls. Is this covered in no BSTS?
In series 1 we cover react and rest calls.
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()
Why wouldn't you want a reader for JSON and a reader for text?
Is the book a pdf or it is compatible kindle and apple book ? To resize font etc
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.
@@jherr will I get the ePub file if you manage to create it later if I purchase the pdf now ?
@@sebmonti5904 Yep.
@@jherr getting the book now ;)
@@sebmonti5904 You rock!
You forgot to put in No BS TS list
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?
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.
Also, the second and third look a lot like the Strategy pattern. :) Lots of these patterns are closely related.
@@jherr Thanks for clarification👍
I look forward to seeing your next videos.
Where do you live ? the view from your window is awesome..
Oregon. And that actually is my office window, though it's a plate so that I can do the green screen stuff.
Isn't it an anti pattern not implementing debug and info for ProductionLogger?
No, they are implemented as stubs.
@@jherr Thanks for the reply and awesome content. I don't know...having just stubs feels dirty to me.
@@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.
@@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.
@@PS-dp8yg So the factory would return IDevelopmentLogger | IProductionLogger? I'm confused.