5 Design Patterns That Are ACTUALLY Used By Developers

  Рет қаралды 331,530

Alex Hyett

Alex Hyett

Күн бұрын

Пікірлер: 175
@professorfontanez
@professorfontanez 10 ай бұрын
I used the facade design pattern once to simplify this widget I created. When I generated the Javadoc, I blew my lead's mind as to how simple it was to use. I did not need to create any documentation because there were only a handful of exposed methods and the names of these methods were very explicit.
@btc-news
@btc-news 19 күн бұрын
whats the difference between facade and decorator pattern, they seem similar
@cirusa12
@cirusa12 11 ай бұрын
Just stumbled upon this channel and as a new dev, I'm loving the bite-sized videos that each explain a useful concept / topic!
@CuriousCyclist
@CuriousCyclist 11 ай бұрын
Thank you for taking the time to make this video. Much appreciated.
@uiscestudio
@uiscestudio 5 күн бұрын
Good video. Entertaining (not required, but engaging). And easy to understand as a primer.
@gx2244
@gx2244 9 ай бұрын
Thank you for making this. I'm very hands on and have definitely used these before without even realising what they were called.
@WiseCoderWhoLifts
@WiseCoderWhoLifts Ай бұрын
This channel is highly underrated. Good stuff, Mr. Hyett!
@maxbitran
@maxbitran Ай бұрын
I strongly believe that what you described as the Facade Pattern is the Adapter Pattern. The Facade Pattern implies the usage of many different classes encapsulated together to create a unified interface, in your example it could be having a Facade that encapsulates the Log, Health checks and Exception handling into one interface. I usually use it with APIs, to put together all the endpoints of different subdomains into a single API for the whole domain... that's how I see it.
@ryanqvincent144
@ryanqvincent144 11 ай бұрын
I agree with you completely about these commonly used patterns. They really are so useful in 'real programming life'. I also agree that it is well worth appreciating the other patterns as they really are useful in specific circumstances. Thanks for this. Appreciated.
@dutchgambit3416
@dutchgambit3416 Ай бұрын
Great content, thank you. Please change whichever light is causing the flickering in the video.
@f3rro_685
@f3rro_685 28 күн бұрын
Thx for effective and concise explanations .
@BangsarRia
@BangsarRia 8 ай бұрын
Design patterns intertwine throughout my code, mostly without me thinking about it. Dependency Injection is used everywhere and Factory structure is pretty generic, so starting points all have similar structure. I look at the core of each pattern and how they relate to each other. I see Builder in both Strategy and Observer. I see Strategy in Observer, with the relationship changed to one to many (iteration) and any number of "strategies" being active at a time. The Decorator vs Strategy choice is properties vs behavior. And so on.
@yurcchello
@yurcchello 11 ай бұрын
in singleton pattern example using Lazy is wrong, value field can be initialized in race conditions. for this scenario can be used static function LazyInitializer.EnsureInitialized(T, Func)
@user-tk2jy8xr8b
@user-tk2jy8xr8b 10 ай бұрын
Class init in .Net is thread-safe, so no issue there Even Lazy is not required unless you really need lazy init
@MrBlaDiBla68
@MrBlaDiBla68 10 ай бұрын
You managed to make the KZbin "please subscribe" message an integral part of your vid. Well done ;-) . And the rest of the vid too, of course, I'm a CS grad and have read this valueable book thoroughly...
@joseestebanjuarezvelazquez9894
@joseestebanjuarezvelazquez9894 2 ай бұрын
I think Adapter is excellent to handle reports or a file manager. This is the very first pattern that I learned and I love it.
@IvanToshkov
@IvanToshkov 11 ай бұрын
One very important aspect of the design patterns is that they depend on the language and its capabilities. This means that in higher-level languages you can implement some of the patterns as algorithms. In this sense, design patterns can be thought of as a relatively good way to go around limitations of your language. As an example, let's take the singleton pattern. It was introduced in book, because there's no way to make it as a library code in C++[1]. But for example in Java[2] you can use a dependency injection library and you can just annotate your class with @Singleton. The library will take care of the rest. Another example where the pattern all but disappears is the strategy pattern. Languages that support higher-order functions can just use them instead of the pattern. ---- [1] Or at least you couldn't at the time. I haven't been following recent C++ development. [2] I don't know enough C# to show similar example, sorry.
@MasterSergius
@MasterSergius 10 ай бұрын
But you need to know 100 design patterns at interview for a junior position
@Foxtrot6624
@Foxtrot6624 9 ай бұрын
@LearnAnyCoding-vg6up go read Design Patterns: Elements of Reusable Object-Oriented Software by the Gang of Four. This book is essentially where the idea of design patterns came from and is seen as the most important book in object oriented programming
@drewsarkisian9375
@drewsarkisian9375 8 ай бұрын
@LearnAnyCoding-vg6up I think he was pointing out that interviews select across a potentially huge number of design patterns.
@thatrandomperson3968
@thatrandomperson3968 8 ай бұрын
It's because most hands on coding are done by junior to mid devs. Senior above mostly just do code reviews. Tech lead above will focus more on the architecture and overall flow of the app. So these low level functional patterns and algorithms knowledge are expected to be lost for higher positions, but expected to be well known by junior to mid devs, and to some extent senior devs. You don't exactly need to memorize all of them but just remember common ones like these 5 and know them well that you know exactly when to implement them, or it just adds unnecessary complexity. Trust me, if you are not being interviewed by HR who has no idea what these are and are just checking for keywords, Tech leads and engineering managers will be already impressed. I do interviews myself and I rarely ask these trivial questions, I'd mostly ask situational questions where you can implement a common design pattern. I'm also more interested in how you work with a team and if you're just doing software engineering for money or software engineering is your passion. It's cliche but people who love what they do are less toxic and wouldn't try to do bare minimum then credit grab from colleagues.
@Foxtrot6624
@Foxtrot6624 8 ай бұрын
@@thatrandomperson3968 What in gods name are you talking about? I have not worked at a single company ever where junior devs do more coding than senior devs. And tech leads focusing on architecture? That’s what software architects do. Tech leads have next to nothing to do with the actual development process
@thatrandomperson3968
@thatrandomperson3968 8 ай бұрын
@@Foxtrot6624 lol where do you think software/tech/solutions architects come from? Hint they start off as junior engineers, after tech lead you branch off to management or architecture. I wonder what kind of industry where a higher position would focus on coding wtf, no wonder you guys are scared of AI, outsourcing and stuff. Being a code monkey is for lower level positions, all SE will eventually end up in architecture or management whether you like it or not, unless of course you're content with senior SE position for the rest of your career then you do you, or you're with a startup where there's only a handful of SE and everyone needs to code. When the org grows you hire more juniors and you will have less and less hands on coding. Even external resources such as senior tech consultants and managing consultants focus more on architecture and design, and handover coding to junior/senior SE. Why do senior devs code less than junior you say? Simply because SSE has much more responsibilities than junior SE 1st. As a senior you are involved in overall design and planning meetings and other shenanigans 2nd you have to do final reviews for mid, junior SE and other senior SE, this means you're reviewing codes of multiple SEs. Unless you just type "lgtm" merge the code and pray, this consumes a lot of your time. 3rd You have to assist other SE when there are issues or bugs it's your responsibility as Senior. With all of these how can an SSE code more than junior SE? When lower level SE just focus entirely on their own tickets and peer reviews. You must understand that the main difference between a junior and senior SE isn't coding proficiency alone, the higher position you are the less involved you are in coding sadly.
@0xKobby_dev
@0xKobby_dev Жыл бұрын
That cake and birthday party analogy was very good. Thanks for the video.
@alexhyettdev
@alexhyettdev Жыл бұрын
Thank you, I am glad! I wasn’t sure if it was a bit too abstract.
@adrianbilescu
@adrianbilescu 11 ай бұрын
@@alexhyettdev just perfect. I love it too
@Jollyprez
@Jollyprez 8 ай бұрын
Gee, I remember when objects had their own controllers and "polymorphism" was part of the object and you didn't need a completely separate abstraction to do the work. Yes, I have the "Gang of Four" black-white-and-blue book. They went overboard on abstractions and complicate the crap out of everything.
@developmentroselino
@developmentroselino 2 ай бұрын
oh wow, im using strategy + factory + facade pattern unknowingly when implementing AES cipher since its have ECB, GCM, and CBC
@JimmyRitter
@JimmyRitter 6 ай бұрын
Thanks Alex for such great content. It helped a lot to get a better understanding on what each of the 5 patterns is about. Keep it up!
@MikeBurke
@MikeBurke 3 ай бұрын
I use strategy pattern all the time. Such an important one for clean code.
@cntaasdd
@cntaasdd 11 ай бұрын
7:26 how about locking before the null check? Why would you duplicate the code and add more nesting, when you can simply lock before the if...
@galacticminx
@galacticminx 10 ай бұрын
If you do it that way, the lock will be performed every time GetInstance() is called. It will only be null once, so the way it's done in the video will require two locks at the most, probably just one.
@zo1dberg
@zo1dberg 9 ай бұрын
That's what I thought too. Don't need to check twice if one thread is being locked out whilst the other is creating the object.
@valekseev
@valekseev 6 ай бұрын
​@@zo1dbergit's a kind of optimization. Taking a lock is a heavy operation, checking for null before it helps us avoid taking lock every time when we need an instance
@zo1dberg
@zo1dberg 6 ай бұрын
​@@valekseevGood point
@ahmadtashfeen94
@ahmadtashfeen94 7 ай бұрын
the back to the future time machine configurations are so cool
@samis6182
@samis6182 6 ай бұрын
What a neat explanation about the singleton pattern!" Thank you
@sumant2000
@sumant2000 10 ай бұрын
background is awesome. purple color. nice. how much it all costed.
@yognirog
@yognirog Жыл бұрын
much helpful, and a nice explanatory video to start with zero knowledge of design patterns.
@alexhyettdev
@alexhyettdev Жыл бұрын
Glad it was helpful!
@levon9
@levon9 11 ай бұрын
Fantastic video -- thank you! I plan to check out your other videos, perhaps find more design pattern goodness. Subscribing either way.
@bundiderp5109
@bundiderp5109 Жыл бұрын
"Not actually my wife" got me good 🤣
@alexhyettdev
@alexhyettdev Жыл бұрын
🤣
@jonasoliveira8909
@jonasoliveira8909 11 ай бұрын
Amazing way explaining these patterns.
@TheSeaOfAsher
@TheSeaOfAsher 11 ай бұрын
I agree the bite-sized concept are well explained. I subscribed I hope to see more.
@hyperborean72
@hyperborean72 11 ай бұрын
So Strategy pattern is actually the same as programming in interfaces (or polymorphism)?
@karim_ghibli
@karim_ghibli Жыл бұрын
To people from JS/Python like me who were confused about the use-cases of the Strategy Pattern, the simple example shown here don't really fit these languages. In Python/JS it'd be more natural to simply map these functions to the variables or even map them to the methods/strategies names as keys in a dictionary (since JS/Python have functions as first class citizens). However, if these functions need to preserve state, or if they have a lot of shared data between them, then can be used coded as the Strategy Design Pattern.
@alexhyettdev
@alexhyettdev Жыл бұрын
Thanks for providing some context for Python/JS users. Yes all the examples shown are in C# and would probably be familiar for Java users but don't really work for non OOP languages.
@Arbiteroflife
@Arbiteroflife 11 ай бұрын
I’ve found that some OO patterns don’t really make sense in Python because of functions being first-class citizens allowing you to pass functions around like a variable, where as other languages are weaker and need these patterns because you can’t simply pass a function. Same thing with Abstract Factory in Python.
@Qewbicle
@Qewbicle 5 ай бұрын
Those languages are great because of flexibility. But if you want to enforce certain patterns, then it can be tricky. For JavaScript, try typescript, for python, try abstract base class (abc) library.
@tekforge
@tekforge 11 ай бұрын
I really like your metaphor at the beginning!
@alexhyettdev
@alexhyettdev 10 ай бұрын
Thank you! I am never 100% sure whether my metaphors are helpful
@Guardian1224
@Guardian1224 11 ай бұрын
Great video. As a Java developer I not only use the patterns you mentiond but also Visitor, Factory, Builder and Composite. I think they are very common too.
@zo1dberg
@zo1dberg 9 ай бұрын
You could say that the concept of a recipe is a design pattern. It's structured so that it has a list of ingredients, and the method for making the food.
@krccmsitp2884
@krccmsitp2884 11 ай бұрын
Builder and Template Method are two other patterns I use occasionally.
@Dipesh_Sol
@Dipesh_Sol 9 ай бұрын
God Damn It! Now I want all those cakes. Brings back memories of eating all of those in different parts of the world with friends and family Two mnemonics to remember: "Create Structures and Behave: Single Decorated Faces Observe Strategies" Create Structures and Behave: - Create reminds you of Creational patterns. - Structures points to Structural patterns. - Behave refers to Behavioral patterns. Single Decorated Faces Observe Strategies: - Single stands for Singleton (Creational). - Decorated for Decorator (Structural). - Faces for Facade (Structural). - Observe for Observer (Behavioral). - Strategies for Strategy (Behavioral). I like something more fun, so here we go "Crazy Squirrels Build Dens, Often Strategically" - Crazy hints at Creational patterns. - Squirrels Build Dens points to the Structural patterns. - Often Strategically suggests Behavioral patterns. Within each category: - Single (from Squirrels) for Singleton (Creational). - Build (Beginning of Build) for Decorator and Dens (D of Dens) for Facade (both Structural). - Often for Observer and Strategically for Strategy (both Behavioral).
@user-tk2jy8xr8b
@user-tk2jy8xr8b 10 ай бұрын
OOP: we identified a set of things called patterns so that you could... FP: JUST USE A FUNCTION FOR THAT (half-joking) Now seriously, to me the top used C# patterns are: - iterator (`foreach`) - factory method (a factory interface injected via DI to make you a factory interface to make you a...) - builder (hostBuilder.ConfigureLogging(...).ConfigureServices(...)....) - strategy (which most of the 2nd-order functions implement) - command (every closure is a command with Invoke method) - interpreter (DSLs are nice) I'm not mentioning singleton here because usually such scope is addressed by a DI-container
@airixxxx
@airixxxx Жыл бұрын
Great video. Never heard about the Facade pattern, when you started explaining it I thought it was the Adapter pattern, What's the difference between them?
@PixelThorn
@PixelThorn Жыл бұрын
An adapter can be a function, or class, which acts as a translator between one functions/class output and another's input Facade is more like a nice function, or class, that's easy to use and acts as the main interface/function which hides a lot of ugliness underneath to get things done A facade of a house hides all the details on the inside, but you get a basic idea on what the house is used for by checking it's exterior - it's facade - see a police building for example
@airixxxx
@airixxxx Жыл бұрын
@@PixelThorn Thanks!
@fifty-plus
@fifty-plus 11 ай бұрын
A facade doesn't have to be a nice abstraction on top of a mess. It could be you just want to abstract multiple types behind an interface so all types (usually of a third party) look the same, i.e. they have the same facade, to the consumer of them - otherwise the consumer would need to know each implementation. An adapater is about translating something into something else and acts like a middelware between the two things.
@RickGladwin
@RickGladwin 11 ай бұрын
@@fifty-plus 💯 That’s when I’ve used a facade pattern in the past - when our application needed to send messages and make calls to outside services, and we knew we’d be swapping out those services over the next few months. All our internal classes called simple, standardized methods on the facade, and we just updated the internals of the facade to handle the various API implementations of the external services. Kind of an adapter as well? But the reason why we did it was to keep things clean and stable over time.
@SharadmEngg
@SharadmEngg 2 ай бұрын
Thanks for the video. In .NET we have one extension method in service class to add single instance of the class(AddSingleton). Do we still need to use singleton design pattern?
@TurboBorsuk
@TurboBorsuk 9 ай бұрын
bringing alcohol to the party is a design pattern
@sinhue
@sinhue 8 ай бұрын
Amazing content bro 😎
@bahamutlightbringer486
@bahamutlightbringer486 5 ай бұрын
Hi, random question out of curiosity. Actually instead of implementing singleton in this way isn't it more common to register as a singleton service via Dependency Injection ? I think I have never encountered it yet being designed like this and maybe it's just me being exposed to the same style on the projects i work on.
@hyperborean72
@hyperborean72 11 ай бұрын
I'm sorry I still did not get it - the prerequisite for the decorator pattern is that one is obliged to use another implementation of the same interface - you just may expand it by putting your extra staff here and there?
@sowiemarkus
@sowiemarkus 10 ай бұрын
Yes, that's exactly how you use the pattern. An example would be a logger. The logger has a certain basic functionality that is the same throughout the entire project. In this example, however, you want to save/output the time and the component in which the message was logged for step A. In step B, the time should not be displayed in the log messages. Instead, the type of the log message (warning, error, info ...) should be displayed there. This behaviour can of course be implemented in many different ways. For example, you could add a timestamp attribute to a log message and specify a flag as to whether the date object should also be displayed. This approach works, of course. And in smaller projects, there is definitely no reason not to use such an approach. However, the more such requirements are added, the more complex the code of the class becomes. This means it is more difficult to extend / maintain / understand the code. With the decorator pattern, the logic required for the individual use cases can only be found in the special decorator. This keeps the basic functionality of the logger tidier and therefore easier to maintain. However, if more similar use cases are added, the Decorator pattern is of course an obstacle. Assuming you simply want to be able to switch the individual extras (time, type, location) on and off and you need each of the 2^3 cases in your project, this would mean that you would have to write 8 Decorators with similar functionality.
@omgmaw
@omgmaw Жыл бұрын
How about the Command Design Pattern. I use the pattern often
@Daniel3Levi
@Daniel3Levi 9 ай бұрын
Thank you ! amazing video
@diegojaraestivill5620
@diegojaraestivill5620 Ай бұрын
I think the only one I'm missing is the adapter pattern. I've seen it a lot, here's an example For example, many government APIs in my country use XML to send data, so in several cases we have been forced to create an adapter to read the data. When the APIs are old, we could be forced t
@9_vko
@9_vko 10 ай бұрын
So useful!
@alexhyettdev
@alexhyettdev 10 ай бұрын
Glad it was helpful!
@Enhakiel
@Enhakiel 9 ай бұрын
Hey... I'm a little confused about the decorator patern, what are the benefits over inheriting the class and overriding a virtual method?
@fariidev
@fariidev 8 ай бұрын
The good thing about a decorator is that it can extend any class. So you write a functionality once and plug it in any class that you want, without duplicating code. You can also use it while extending a class you can't access I think, so you can extend a class while not being able to change anything inside it (the open-closed principle he refers to)
@ratinhoembondeiro646
@ratinhoembondeiro646 Ай бұрын
I've used almost the same 5 except for Decorator which I've never used. Instead I've used more Template Method (a lot!) and Factory Method ( or maybe Abstract Factory as I tend to forget which one is the other). They seem to come over and over in backend code.
@mnemonicpie
@mnemonicpie 11 ай бұрын
Finally someone without stupid PewDiePie-style jokes and with good material
@NoahNobody
@NoahNobody Жыл бұрын
It makes sense to learn the top 5 design patterns first, thanks.
@alexhyettdev
@alexhyettdev Жыл бұрын
Yes there are so many of them, got to start somewhere. I am sure there are a few I have never used as well.
@fifty-plus
@fifty-plus 11 ай бұрын
While it's good to know about singletons, you genereally don't want to explicitly codify them. It's almost always best to let your DI container give you one.
@achrefnabil2463
@achrefnabil2463 Жыл бұрын
Man you deserve 1m subscribers ❤❤ can you make a node js DDD hexagonal archeticture CQRS Event sourcing course
@alexhyettdev
@alexhyettdev Жыл бұрын
Thank you! Yes I might be able to do a course on that in the future.
@khalidelgazzar
@khalidelgazzar Жыл бұрын
Great explanation. Thank you
@alexhyettdev
@alexhyettdev Жыл бұрын
Glad you liked it
@HasinthaWeragala
@HasinthaWeragala 11 ай бұрын
thanks for this most noble sire
@Pareshbpatel
@Pareshbpatel 7 ай бұрын
Thank you for a great introduction to Design Patterns. {2024-07-09} - Subscribed!
@QVMaster
@QVMaster 8 ай бұрын
Hi. What is the purpose of the default setter in the Value property of LazySingleton? {time => 7:43}
@daemetheus
@daemetheus 4 ай бұрын
I don't agree with how you described your Strategy pattern with the cakes (but I also don't think you displayed what "GetMethod()" was supposed to do). The example with Google Maps illustrated it well: The context being the various modes of travel, returning the strategy (method) of how to perform the action. To further elucidate, other modifiers to this context could be [additional stops, fastest route, avoid traffic, no tolls, no freeways, etc] which then returns a different, modified strategy (method) of how to get from A->B.
@AyeletKazantsev
@AyeletKazantsev 8 ай бұрын
Great video! Thanks
@felipefs106
@felipefs106 11 ай бұрын
I can see these being used for the backend, But for something like React I find it a bit difficult to adapt these
@cern1999sb
@cern1999sb 6 ай бұрын
In your singleton pattern, why wouldn't you just lock once and check whether the instance is null inside the mutex locked code block? What is the purpose of the instance == null check outside the lock?
@HarleyPebley
@HarleyPebley 6 ай бұрын
@cern1999sb This is called the Double-null check pattern. It eliminates the overhead of acquiring the lock on every method invocation when it's only really needed once.
@KoolakStudio
@KoolakStudio 8 ай бұрын
very nice ! thanks for sharing
@Lion_McLionhead
@Lion_McLionhead 10 ай бұрын
Lambda functions & closures became the big thing in the last 10 years & probably still are.
@cmartinez4727
@cmartinez4727 8 ай бұрын
No dependency injection pattern??
@thegooddoctor6719
@thegooddoctor6719 Жыл бұрын
Wow - Thanks for the great content.
@alexhyettdev
@alexhyettdev Жыл бұрын
You're welcome! Thanks for commenting
@long_codes
@long_codes 2 ай бұрын
interest in the decorator pattern part 4:40
@bereketmatiyos9740
@bereketmatiyos9740 5 ай бұрын
What about MVC
@eser-sahin
@eser-sahin Жыл бұрын
Great explanations thank you for your effort. Which color theme do you ise in Vs Code?
@alexhyettdev
@alexhyettdev Жыл бұрын
Thank you! It is the Atom One Dark theme: marketplace.visualstudio.com/items?itemName=akamud.vscode-theme-onedark
@Chr0nalis
@Chr0nalis 6 ай бұрын
My opinion: These contrived analogies, such as using cake really don't work when trying to explain something in software. You are explaining to technical developers, not children. In my experience these long winded analogies only distract me from what you are talking about, especially when showing B-roll of cutting very attractive looking cake. Really, only 40% of my attention is on what you are actually trying to say and most is focused on the sweetness, softness and taste of the cake, all of which are very strong distractors.
@d4eva4ce25
@d4eva4ce25 5 ай бұрын
So you are easily distracted?
@Voy2378
@Voy2378 8 ай бұрын
I prefer to remember decorator patern as ecorato pattern
@begajumayev
@begajumayev 5 ай бұрын
Are they 23 ? I count only 22. Am I missing something ?
@slowly-but-eventually
@slowly-but-eventually 5 ай бұрын
I don't get the first one, the Strategy Pattern. Isn't it just an Interface?
@Qewbicle
@Qewbicle 5 ай бұрын
Your objects would be arguments into a constructor public interface IOption {...} class OptionOne : IOption { // some implemention} class OptionTwo : IOption { // some implemention} class MyTool { private readonly _theAction; public MyTool(IOption theAction) { this._theAction = theAction } } Now you can create a tool and assign actions without needing to recompile MyTool toolOne = new MyTool(new OptionOne()); Of course you might add additional things, actions. Like which file formats, checks, reads, etc. Into the tool.
@Durassek
@Durassek 7 ай бұрын
isnt CQRS used widely as well?
@pmoneyish6869
@pmoneyish6869 6 ай бұрын
I use it in my current job, even though they just introduced it, but in my 25+ years of programming this is the first time I've ran across it.
@thygrrr
@thygrrr Жыл бұрын
How does Decorator differ from Facade tho...
@elramtv
@elramtv Жыл бұрын
Man you should put on a cake warning. Now I want some cake.
@alexhyettdev
@alexhyettdev Жыл бұрын
The cake is a lie
@DiogoScarmagnani
@DiogoScarmagnani 10 ай бұрын
Desde o vanilla JS eu já evito usar Node, sempre tento forçar Element. Por exemplo, ao invés de pegar o último filho de um elemento com element.lastChild (que inclui todos os Nodes), uso element.lastElementChild (que inclui somente HTMLElements), pois Node pode ser até mesmo os espaços em branco soltos no HTML (por mais que não apareça na tela).
@Zeero3846
@Zeero3846 Жыл бұрын
I have reservations against the singleton pattern. Functional style programming combined with immutability kind of makes it unnecessary. If your code doesn't actually care about the object's reference, only it's value, and that value can never change, the optimizations that result is effectively your singleton, and you didn't even have to write it.
@DonchoGunchev
@DonchoGunchev 10 ай бұрын
Singleton is the worst design pattern I have used. You do want to be able to create multiple DB connections, unit tests and all…
@HarleyPebley
@HarleyPebley 6 ай бұрын
Yes. It's called an anit-pattern for good reason.
@rosendo3219
@rosendo3219 11 ай бұрын
dude is that a 'back to the future' time panel? insta like and subscribe :)
@alexhyettdev
@alexhyettdev 10 ай бұрын
It is! I wish it was more than just a light. I might have to make a working one at some point.
@alexhyettdev
@alexhyettdev 10 ай бұрын
It here if you wanted on yourself: numskull.com/products/official-back-to-the-future-3d-desk-lamp-wall-light
@myWorldDiscover
@myWorldDiscover 6 ай бұрын
Some people argue that design patterns can lead to over-engineering. Do you agree?
@ml_serenity
@ml_serenity 6 ай бұрын
Builder? Used ALL over the .NET Core. Chain of Responsibility - same, plus all the different "Fluent"Something. Factory method - all of the IoC/DI are factories on steroids, Iterator - every collection in .NET...
@solace895
@solace895 11 ай бұрын
"Not actually my wife" 😂
@apt2001
@apt2001 10 ай бұрын
With modern dependency injection a Singleton pattern is very outdated. I personally haven't used it for over 5 years. Moreover, controlling an object lifetime by the object itself seems to conflict with a single responsible principle and would definitely mark a Singleton code down in a code review.
@TheIcecoldorange
@TheIcecoldorange 10 ай бұрын
I have only ever heard about singleton patterns discussed in theory. I have never seen that pattern actually be implemented in the wild. Closest thing is managing dependencies and calling addsingleton, addscoped, or addtransient. I think programmers need to get real about just saying things to look smart.
@wschdub
@wschdub 4 ай бұрын
Uniswap V4 uses singleton pattern.
@RohitChaurasiyalisten
@RohitChaurasiyalisten 7 ай бұрын
Bare Minimum these 6 pattern Singleton Factory Decorator Facade Observer Strategy
@hosseinse4079
@hosseinse4079 2 ай бұрын
not bad
@MikeBurke
@MikeBurke 3 ай бұрын
Singleton is an antipattern. It's a violation of SRP and makes unit testing unnecessarily difficult. If you need a singleton object, you should enforce that elsewhere in the code or use dependency injection.
@mauricibarth9503
@mauricibarth9503 8 ай бұрын
It is not easy to memorize all design patterns, nor their benefits
@ferroalloys594
@ferroalloys594 3 ай бұрын
The notion of so-called "design patterns" was inherent in even the most early functional languages, e,g. lisp, but they were called "expressions" whose function definitions might or might not contain other expressions! It's not rokit syance, and DEFINATELY not LATTER-DAY object-oriented pseudo-paradigm-ical mumbo-jumbo! Simples, as simple can be! (:-)
@jamesfanuel3601
@jamesfanuel3601 5 ай бұрын
What is ryan reynolds doing on this video ?
@alexhyettdev
@alexhyettdev 5 ай бұрын
I am flattered and should look into getting a Deadpool outfit for my next video 😂
@jamesfanuel3601
@jamesfanuel3601 5 ай бұрын
@@alexhyettdevyes, the multiverse needs you man 👊
@WhitbyStuff
@WhitbyStuff 6 күн бұрын
Adverts are fine but mid-sentence they are really distracting.
@Braneloc
@Braneloc 7 ай бұрын
For some strange reason I want cake now.
@alexhyettdev
@alexhyettdev 4 ай бұрын
It's always time for cake!
@ivandrofly
@ivandrofly Жыл бұрын
Nice
@ivandrofly
@ivandrofly Жыл бұрын
I'm surprised I know the def of all also how to implement them 😅
@matthewpulickottil6831
@matthewpulickottil6831 2 ай бұрын
Like many videos and books on design patterns, this videos also fails to meet the most desired objective - to help developers choose the right design pattern when certain situations are presented to them. The fancy names of the patterns and their explanation is great, but if developers are not able to analyze a problem and quickly "map" it to one of these patterns, then it isn't really useful.
@JordanEdmundsEECS
@JordanEdmundsEECS 11 ай бұрын
It’s interfaces all the way down 😂
@awesomecraftstudio
@awesomecraftstudio 8 ай бұрын
You didn't explain the strategy pattern. What you explained sounds like the visitor pattern
@S5Dic09
@S5Dic09 4 ай бұрын
Software engineer are not made on websites, you're more a developer, someone learning something very specific, taking a biology course doesn't make you a doctor, what a woke joke
@RyanJensenEE
@RyanJensenEE Жыл бұрын
skip to 2:45 to skip the preamble and get to the point.
@alexhyettdev
@alexhyettdev Жыл бұрын
That’s why I include time stamps in all my videos. Not everyone knows what design patterns are or wants to listen to my analogies 🤣
@eyesopen6110
@eyesopen6110 Ай бұрын
Different patterns for different types of software.. Don't overdo it.
@PhucNguyen-hr5ue
@PhucNguyen-hr5ue 8 ай бұрын
design patterns are way overrated, you don't need to know them well to become a good engineer
@loam
@loam 11 ай бұрын
According to whom I need to know, NASA?
Domain Driven Design: What You Need To Know
8:42
Alex Hyett
Рет қаралды 157 М.
7 Design Patterns EVERY Developer Should Know
23:09
ForrestKnight
Рет қаралды 302 М.
Леон киллер и Оля Полякова 😹
00:42
Канал Смеха
Рет қаралды 4,7 МЛН
Don’t Choose The Wrong Box 😱
00:41
Topper Guild
Рет қаралды 62 МЛН
Chain Game Strong ⛓️
00:21
Anwar Jibawi
Рет қаралды 41 МЛН
SOLID Principles: Do You Really Understand Them?
7:04
Alex Hyett
Рет қаралды 238 М.
How Senior Programmers ACTUALLY Write Code
13:37
Thriving Technologist
Рет қаралды 1,7 МЛН
Microservices with Databases can be challenging...
20:52
Software Developer Diaries
Рет қаралды 129 М.
The 3 Laws of Writing Readable Code
5:28
Kantan Coding
Рет қаралды 839 М.
8 Design Patterns EVERY Developer Should Know
9:47
NeetCode
Рет қаралды 1,1 МЛН
Real 10x Programmers Are SLOW To Write Code
14:51
Thriving Technologist
Рет қаралды 73 М.
8 Design Patterns | Prime Reacts
22:10
ThePrimeTime
Рет қаралды 459 М.
Decorator Pattern - Design Patterns (ep 3)
54:35
Christopher Okhravi
Рет қаралды 494 М.
How principled coders outperform the competition
11:11
Coderized
Рет қаралды 1,8 МЛН
Леон киллер и Оля Полякова 😹
00:42
Канал Смеха
Рет қаралды 4,7 МЛН