Strategy Design Pattern

  Рет қаралды 746,239

Derek Banas

Derek Banas

12 жыл бұрын

Code is Here: goo.gl/TqrMI
Best Design Patterns Book : goo.gl/W0wyie
MY UDEMY COURSES ARE 87.5% OFF TIL July 16th ($9.99)
www.udemy.com/
➡️ Python Data Science Series for $9.99 : Highest Rated & Largest Python Udemy Course + 56 Hrs + 200 Videos + Data Science bit.ly/Master_Python_35
➡️ New C++ Programming Bootcamp Series for $9.99 : Over 23 Hrs + 53 Videos + Quizzes + Graded Assignments + New Videos Every Month bit.ly/C_Course_35
I LIVESTREAM CODE HERE : / derekbanas
MY DISCORD : / discord ( Contact Me Anytime )
Here is my Strategy design patterns tutorial. You use this pattern if you need to dynamically change an algorithm used by an object at run time. Don't worry, just watch the video and you'll get it.
The pattern also allows you to eliminate code duplication. It separates behavior from super and subclasses. It is a super design pattern and is often the first one taught.

Пікірлер: 1 000
@derekbanas
@derekbanas 5 жыл бұрын
Learn in One Videos for Every Programming Language Subscribe to Bookmark them: bit.ly/2FWQZTx C++ : kzbin.info/www/bejne/iKbFXn2pn7Kbjbs Python : kzbin.info/www/bejne/hGXQdq18ec-kqqM Java : kzbin.info/www/bejne/pF7bcqSZd6iqqZY PHP : kzbin.info/www/bejne/bYWpYWOef65qbrs MySQL : kzbin.info/www/bejne/r4HYZ6SMasesq5Y JavaScript : kzbin.info/www/bejne/nJvYapyfbb6mfdU C# : kzbin.info/www/bejne/oprWmqqLj6-Lp7M HTML5 : kzbin.info/www/bejne/oXXce4FtprZ4iqM CSS3 : kzbin.info/www/bejne/eYbbeZKojLh8Z80 JQuery : kzbin.info/www/bejne/eIi7mJp4YrlkoLM TypeScript : kzbin.info/www/bejne/Y4G1kIunjJ59gLc ECMAScript : kzbin.info/www/bejne/gJLOoJxmfJ2feMk Swift : kzbin.info/www/bejne/mnzEoJ2Fj5KUsJo R : kzbin.info/www/bejne/qWSpoK2Mm8lqp5Y Haskell : kzbin.info/www/bejne/ZmPCeWaCn9aAqJo Handlebars : kzbin.info/www/bejne/annYcqGDa8dlmpo Bootstrap : kzbin.info/www/bejne/naKydqKLh5qFfsk Rust : kzbin.info/www/bejne/i2Kod5p5g7F3eJo Matlab : kzbin.info/www/bejne/hIS2hZ6hgLeUmKs Arduino : kzbin.info/www/bejne/h4DCe5-wZtajetk Crystal : kzbin.info/www/bejne/eqmpgWCNn9anqcU Emacs : kzbin.info/www/bejne/f5LKk6lvbJl6orM Clojure : kzbin.info/www/bejne/mZqqqnuhedqDd6c Shell : kzbin.info/www/bejne/nqjVn6CHqtKnhtk Perl : kzbin.info/www/bejne/jXbKmXyOqJ15bMU Perl6 : kzbin.info/www/bejne/omHdgaqenLyHna8 Elixir : kzbin.info/www/bejne/pnOxgJSsh9SBgpI D : kzbin.info/www/bejne/qKi9d4ekm56Verc Fortran : kzbin.info/www/bejne/lZCVhpp8g76anJo LaTeX : kzbin.info/www/bejne/jJnQnH-ohM9_qdk F# : kzbin.info/www/bejne/mWjIf3eAg5xobrc Kotlin : kzbin.info/www/bejne/fpDSeJxuqtp3pqM Erlang : kzbin.info/www/bejne/f3bLqJZoppatfZY Groovy : kzbin.info/www/bejne/eGqbm5Zuncmob8k Scala : kzbin.info/www/bejne/equppWOPoL-ibq8 Lua : kzbin.info/www/bejne/n37ElKuQhrKDjtU Ruby : kzbin.info/www/bejne/epvManSCeMyZpq8 Go : kzbin.info/www/bejne/eXechGeHj9qJaZI Objective C : kzbin.info/www/bejne/a5bWgqSQfq9rack Prolog : kzbin.info/www/bejne/iarOqYqme9yAfdU LISP : kzbin.info/www/bejne/r562ometfdekr7c Express : kzbin.info/www/bejne/rnWmfJaEd6umq6s Jade : kzbin.info/www/bejne/omakiZaOdrVnqJo Sass : kzbin.info/www/bejne/rauWnHiigcd4fqc
@neostarteon9718
@neostarteon9718 5 жыл бұрын
An example of this pattern with Dependency Injection would be great.
@MohammadMNajar
@MohammadMNajar 5 жыл бұрын
Can we get a tutorial on Spring Boot and Kafka?
@apoorvwatsky
@apoorvwatsky 4 жыл бұрын
jesus, what do you not know?
@Daedlues
@Daedlues 8 жыл бұрын
This video is amazing because 1.you supplied code 2.you tried a wrong approach first which made me think why using this design pattern is important and when to use it 3.learning by example and my diagram at one video 4.your teaching style is clear ( little face paced for a beginner like me ) thanks very much i really needed to learn patterns
@derekbanas
@derekbanas 8 жыл бұрын
+Daedlues Thank you for the nice compliments :) I'm glad it helped.
@topogigio10
@topogigio10 5 жыл бұрын
@@derekbanas Sos un fenomeno Derek!
@todarfclips
@todarfclips 5 жыл бұрын
For someone who's not a beginner like me, all those points hold true but his speed is amazing. It's exactly the right pace.
@DatzAdam
@DatzAdam 5 жыл бұрын
He also has magical powers by making a dog flies, amazing!
@Tomas970506
@Tomas970506 4 жыл бұрын
For my perspective and point of view. This tutorial is bad because he shows a bad way to code and then does everything on top of it. For a begginer it might be hard to grasp what is where.
@alex26toma
@alex26toma 9 жыл бұрын
I like how you explain the bad practice code before presenting the design pattern. This way we know when to use it.
@derekbanas
@derekbanas 9 жыл бұрын
Alex Toma Thank you :)
@derekbanas
@derekbanas 11 жыл бұрын
You're very welcome :) Yes it takes a while to learn how to properly use patterns. Eventually programming stops being a set of commands and rules and instead becomes an art form in my opinion. With a bit of practice you'll soon start making master pieces
@derekbanas
@derekbanas 11 жыл бұрын
Here are all my UML tutorials and codes in one place newthinktank. com/videos/uml-video-tutorial/ I hope you like it :)
@slidenerd
@slidenerd 9 жыл бұрын
i thought i would come revise my design patterns in java since its been quite some time and guess where I landed :D :D :D fantastic one mate,
@derekbanas
@derekbanas 9 жыл бұрын
slidenerd Thank you. Nice to see you :) Keep making those great videos!
@derekbanas
@derekbanas 11 жыл бұрын
Thank you very much :) In the refactoring tutorial I spend a good amount of time answering design pattern challenge questions. That was a lot of fun
@derekbanas
@derekbanas 11 жыл бұрын
Thank you very much :) I constantly do my best to improve them. I'm very happy that you enjoy them
@derekbanas
@derekbanas 12 жыл бұрын
Bog vas blagoslovi, kot dobro. Hvala
@vikashverma9
@vikashverma9 4 жыл бұрын
Where can I get PPT used in this video?
@derekbanas
@derekbanas 11 жыл бұрын
It is awesome to be able to help people all over the world :) Thank you for telling me you are watching!
@TheRunner94
@TheRunner94 11 жыл бұрын
These are by far the most helpful tutorials on KZbin for programmers. I am a first year computer science student and I have been spending hours in the library trying fully grasp structures of programs and object oriented programming. Great videos!
@derekbanas
@derekbanas 10 жыл бұрын
Yes you can often use an Enum in this situation, but it will limit flexibility which is normally what you aim for with most design patterns
@TheAdithya9
@TheAdithya9 7 жыл бұрын
Extremely helpful. Really well put, well designed and such a good example! At it's most basic level. Good editing too. I'm sure it must be hard to squeeze it all under 15 minutes.
@derekbanas
@derekbanas 7 жыл бұрын
Thank you for the compliments :) I'm glad you liked it
@brianlaudrupchannel
@brianlaudrupchannel 8 жыл бұрын
I realise how bad Uni lectures are. If i finish my Degree its because of KZbin.
@derekbanas
@derekbanas 8 жыл бұрын
+billyblackburn87 I'm glad I could help :)
@rodrigobautista3768
@rodrigobautista3768 8 жыл бұрын
I understand you men, I'm studying at ESCOM in México.
@todarfclips
@todarfclips 5 жыл бұрын
@@derekbanas Yeah seriously I'm using your videos right now to study for an exam, my teacher spent a 3 hour course on 3 design patterns but you went over one in 11 minutes and I understood better.
@user-hy5oe8zh6z
@user-hy5oe8zh6z 4 жыл бұрын
@@todarfclips vf
@ramiiii
@ramiiii 4 жыл бұрын
Have you finished your degree?
@derekbanas
@derekbanas 11 жыл бұрын
Thank you for telling me you like them and that they help PHP programmers. I always wondered how well they would translate for languages other then java, C# and C++. Im very happy that they've helped
@derekbanas
@derekbanas 11 жыл бұрын
Here is my UML Tutorial Playlist kzbin.info/www/bejne/hZymaHuBqc6NeZI I also have a Object Oriented Design Tutorial in which I show how I solve problems kzbin.info/www/bejne/nHu6Z2iNpJx8fqs Both are on my KZbin channel. I hope you find them useful :)
@1yanivyaron1
@1yanivyaron1 9 жыл бұрын
Hi Derek, Thanks a lot for your channel, it helped me a lot in my job interviewing process. I owe you one ;-)
@RVCata
@RVCata 10 жыл бұрын
Well...this playlist has helped me better understand design patterns than 2 years of college. You deserve many beers. Many many beers :D.
@derekbanas
@derekbanas 10 жыл бұрын
Thank you very much :) I'm happy that I could help.
@derekbanas
@derekbanas 11 жыл бұрын
Thank you :) I have a UML tutorial and I'm going to revisit these patterns again in my code refactoring tutorials that will start next week.
@derekbanas
@derekbanas 10 жыл бұрын
Thank you :) Yes, I tend to make videos for intermediate programmers. Most everyone else aims at beginners so I like to be different.
@jotaene764
@jotaene764 10 жыл бұрын
You have the teaching gift! God Bless you even more than you have been till now! Thank's for the charity with the humanity by giving away all that high quality high valuable knowledge of yours!
@derekbanas
@derekbanas 10 жыл бұрын
Thank you for the very kind message :) May God bless you as well.
@user-hy5oe8zh6z
@user-hy5oe8zh6z 4 жыл бұрын
@@derekbanas in Flow
@heradsinn
@heradsinn 5 жыл бұрын
Great video and great series. Two questions: 1. Would you care to elaborate about 2:49, "Avoid Interfaces that Just Force Action"? 2. What is the literature on design patterns in general? Perhaps what GoF published back in the days, or maybe there are newer and better books about the patterns? Hopefully you still read comments 7 years later ;)
@_timestamp
@_timestamp 2 жыл бұрын
Nope, he didn't read this comment
@richardrisner921
@richardrisner921 2 жыл бұрын
1. That means you should not add an interface which merely forces yourself to manually determine what every single animal will need to do with flying capabilities. An interface might be more appropriate for an action which would have a distinct implementation for each class.
@derekbanas
@derekbanas 11 жыл бұрын
Thank you very much :) I plan on doing a performance testing tutorial. I do that to a certain extent with the refactoring and algorithm tutorials. I talk about Big O notation and such
@derekbanas
@derekbanas 11 жыл бұрын
Yes you are correct. I wish I could have come up with a better example, but I wanted to keep everything as simple as possible
@abbos-alimirkhanov114
@abbos-alimirkhanov114 9 жыл бұрын
Hi Derek Banas! It was a bit difficult for me to understand this line of code 'public Flys flyingType;' on 5:31th minute. As I understand it is field variable, and first we have to declare visibility which is PUBLIC then type, which should be some type like integer, String.. or void. After that goes name which is Flys, however in your case it is first visibility which is PUBLIC, then name Flys and then type FLYINGTYPE (I still can't understand what type is it) This line of code is breaking my logic))) However, I have not read about COUPLING which you mentioned in video.
@derekbanas
@derekbanas 9 жыл бұрын
Abbos-Ali Mirkhanov By using composition to store flyingType I'm able to change capabilities at run time. We can then define the flyingType by passing it to setFlyingAbility and then tryToFly automatically executes the proper code without having to define anything at the beginning.
@fakkkkkk
@fakkkkkk 9 жыл бұрын
Flys is not name, its type in this case. There is an interface Flys, and the variable flyingType is of this interface's type - Flys. The name of the field variable is flyingType..
@KingMartinelli
@KingMartinelli 9 жыл бұрын
Flys is actually the type of the object and FlyingType is the name of the object. You said correctly, that it's a field variable, means there's nothing declared (no memory has been allocated). The point of this is, to define every class that extends from animal whether it can fly or not. Abbos-Ali Mirkhanov you should focus more on your programming understanding before you pay attention to design patterns mate
@voltaireestrada7384
@voltaireestrada7384 6 жыл бұрын
shouldnt flyingType be private? maybe that's what he meant?
@ronenfe
@ronenfe 7 жыл бұрын
I think the better way to implement it, is to create another subclass FlyingAnimal that inherits from Animal and let bird inherit from it instead of from animal.
@Alex-ht1oq
@Alex-ht1oq 7 жыл бұрын
ronenfe Can't have multiple inheritance in Java. Sorry lol .
@maximembabele
@maximembabele 6 жыл бұрын
ronenfe said "instead of Animal". so it is still single inheritance
@paulrybitskyi1737
@paulrybitskyi1737 6 жыл бұрын
On the Derek's "When to use strategy pattern" slide, there is a point called "When you need to use several behavior dynamically". Dynamically means at run-time. So, while you can create another subclass FlyingAnimal that inherits from Animal and let the bird inherit from it and dog inherit from Animal class, what happens when your dog, by some magical way, obtained wings and now can fly? If we went with your proposed way of doing things, then there is pretty much no way of telling the class that the dog can fly now. If we went with the strategy pattern as in the Derek's video, we could easily change the flying ability by passing another implementation. Although I admit that the example is a bit silly, the pattern definitely finds its uses in modern development.
@derekbanas
@derekbanas 11 жыл бұрын
Thank you very much :) I used to work as a software architect and part of my job was to train new hires and answer their questions. I'm basically doing here what I did with trainees. I'm not a professor
@derekbanas
@derekbanas 12 жыл бұрын
Thank you :) I did my best to make it understandable by looking at it from a bunch of angles.I'm glad you liked it
@jrumiak
@jrumiak 8 жыл бұрын
At 3:12 you state that super class change shouldn't affect subclasses but later you left flyingType uninitialised forcing every subclass cunstructor to set it's value. Shouldn't you just provide a default?
@matthewhartz9235
@matthewhartz9235 7 жыл бұрын
Yeah, i think this is a bad aspect of the pattern. If you, as a developer, were unaware that you need to initialize this, you won't get a compile time error. Or, if you provided a default, at least in this example, you might have flying dogs by accident in production.
@abhi4unme2002
@abhi4unme2002 6 жыл бұрын
Instead of having variable initialized by default, we must have explicit constructor for initializing all the strategy variables in the class, all such classes should not have default constructor for them , which has variables of interfaces in them.
@veganaiZe
@veganaiZe 6 жыл бұрын
I think that the Strategy Pattern has less to do with Super vs. Sub-classing and more to do with being able to change/substitute algorithms at runtime. In other words: It allows you to avoid hard-coding one particular algorithm (or implementing several and using conditionals to select between them) at compile-time and, instead, dynamically select the most appropriate at run-time. The Strategy Pattern basically lets you implement behavior (ie. an interface), where ever you find it most appropriate, and then it allows you to easily change that behavior. So for instance you can implement an I/O interface, which is initially text-only (all over), and then dynamically change it to a GUI interface; without re-compiling and without duplicating lots of code.
@StingJia
@StingJia 9 жыл бұрын
Following the whole tutorial and type each line code manually. If anyone need the the source code, I upload them to: github.com/jiapengjun/designPatterns
@TigasFMS
@TigasFMS 9 жыл бұрын
Sting Jia He has it in his website.
@sermilion_audio
@sermilion_audio 8 жыл бұрын
+Sting Jia cool, thanks a lot)
@derekbanas
@derekbanas 11 жыл бұрын
Thank you :) Yes programming to an interface is most always the best decision. I only use abstract classes when I must implement some nonabstract method
@derekbanas
@derekbanas 12 жыл бұрын
I'll cover that in future tutorials. The short answer is that it depends on the situation. The object oriented analysis tutorial is in the works. By the end I'll cover everything oop. Thanks for watching
@BogdanBadulescuBadulescu
@BogdanBadulescuBadulescu 8 жыл бұрын
it's : Flies ..
@xpopcornx1747
@xpopcornx1747 8 жыл бұрын
Seems like bad code when Dog is forced to set flying ability, a behaviour it shouldn't have.
@vnie1988
@vnie1988 8 жыл бұрын
+XPopCornX I was thinking the same thing. It seems to me that creating a FlyingType class and slotting it in between Bird and Animal in the inheritance chain would be better. Dog would never have to know about it.
@popuzin
@popuzin 8 жыл бұрын
+vnie1988 but then dog can't fly even if it takes jet pack =) or if dog will mutate in some crazy flying doggybird )).
@Gam3r979
@Gam3r979 8 жыл бұрын
+XPopCornX You could easily set the default flyingAbility to CantFlys to avoid this problem
8 жыл бұрын
+XPopCornX I was thinking that maybe the reason it's called strategy pattern is because you're going to define the different strategies in order to implement (achieve) the method. If I implement a Flying interface I guess a more understandable example would be that in the noFly strategy, the animal boards a plane. So in that way, the animal can achieve or implement the interface, but using a different strategy. And there are many other strategies that could be thought of to implement an interface. The real world scenario that I'm thinking about with what I learned here is: databases. There are databases that write to a file (like sqlite), but other databases behave differently. So maybe a strategy pattern would be an interface to store data. We want the same thing (to store data), but the strategies are different.
@l_u_c_k_y_7
@l_u_c_k_y_7 8 жыл бұрын
hahhahaha
@Jetisertes
@Jetisertes 2 жыл бұрын
I'm a junior dev, and I picked up a lot of intuition along my programming years. I haven't heard of this pattern before, and I realized that I just wrote a piece of code yesterday that follows this design pattern after not being satisfied with a more traditional polymorphic implementation. Nice. Thank you for your work as a KZbin educator, I really appreciate your videos. Cheers.
@derekbanas
@derekbanas 10 жыл бұрын
Thank you very much :) It is very nice to be able to help people understand this stuff. Many more videos are coming.
@derekbanas
@derekbanas 10 жыл бұрын
Thank you :) I do my best to make the videos fast and compact. I'm glad you liked it
@derekbanas
@derekbanas 11 жыл бұрын
Thank you for the kind words :) You have no idea how much I enjoy doing this. It is great to be able to help people!
@derekbanas
@derekbanas 11 жыл бұрын
You're very welcome :) If it helps make your code more understandable then do it. There is a misconception that there is only one way to use each pattern. Even the GOF book states that it is but a guide and the patterns should be adjusted based on need. I hope that helps
@derekbanas
@derekbanas 11 жыл бұрын
Sorry I go overboard every once in a while. Over the years you guys out there have taught me to always be on my toes and to not just flippantly provide answers to questions :) I'll see what I can do about covering the different unix shell versions and commands. I'd like to do it in an interesting way, which I can't think of at the moment
@derekbanas
@derekbanas 11 жыл бұрын
Thank you very much :) I do my best to constantly improve. Sometimes in doing so I make a bad video now and then, but I think it is worth it. I plan to eventually make a tablet app for every tutorial series that will provide a quiz and animations to improve the learning process. I have started doing that a bit in recent tutorials. Most of the money I make from these videos goes back into making better videos. Thanks for the nice comment!
@derekbanas
@derekbanas 11 жыл бұрын
You're very welcome :) Yes you can create an instance directly in the methods attribute. It is a little odd I know
@derekbanas
@derekbanas 11 жыл бұрын
Thank you very much for taking your time to show your appreciation :) You have no idea how much I appreciate that! I'm very happy to have been of help
@derekbanas
@derekbanas 12 жыл бұрын
You're very welcome :) Thank you for watching
@derekbanas
@derekbanas 11 жыл бұрын
Thank you very much :) I work hard to make the best tutorials I can. I'm glad you like them
@derekbanas
@derekbanas 10 жыл бұрын
Yes a java enum is often well suited for that.
@derekbanas
@derekbanas 10 жыл бұрын
Thank you :) I did my best to cover just about everything in one video. I'm always very appreciative of the kind compliments!
@derekbanas
@derekbanas 11 жыл бұрын
You're welcome :) I can't wait to cover C++ and the differences that occur with these patterns. They are very similar as you said, but there are slight differences. The same is true with C#. I'll get to it as soon as possible. i promise to cover C and C++ as completely as I have done with Java
@derekbanas
@derekbanas 11 жыл бұрын
Great! I'll get the last few up this week. I'm glad they are helping :)
@derekbanas
@derekbanas 11 жыл бұрын
I included the classes that implement flys on the same page as I created the flys interface. You'll see it if you look over the code on my website. Sorry about the confusion. I normally don't do that in tutorials
@derekbanas
@derekbanas 11 жыл бұрын
I'm very happy that so many people around the world seem to be able to understand me :) the funny thing is that in my country I was often used to speak with people from foreign countries. I could always understand them as well. I'm very happy to be able to help
@derekbanas
@derekbanas 11 жыл бұрын
You would use it with classes that are very similar. What you referred to is the skill one must develop after learning about patterns. Knowing when not to use a pattern is just as important as learning when to use them. I cover more on that in the refactoring tutorial.
@derekbanas
@derekbanas 12 жыл бұрын
Thank you very much :) I appreciate that. I planned on introducing UML along with this tutorial. The only problem is that I could easily make 20 videos on the subject. I can't guarantee it would be finished. Thank you for telling me there is interest in that tutorial though
@VIGNESHGOPAL
@VIGNESHGOPAL 11 жыл бұрын
Hey Derek, I would like to thank you to the core. I haven't seen any video tuts on youtube with code. So helpful. Really exiting after seeing your tuts. Thanks alot.!!!
@derekbanas
@derekbanas 10 жыл бұрын
Hi Vishal, Thank you :) I'm glad you found it useful. I record with Camtasia 2 and I edit with iMovie.
@derekbanas
@derekbanas 11 жыл бұрын
Thank you very much :) That is a much appreciated compliment. I do my best to present these topics in an interesting way
@derekbanas
@derekbanas 11 жыл бұрын
Thank you very much :) It is really amazing that techniques developed decades ago are still not used in many software companies?
@billytomlinson4590
@billytomlinson4590 11 жыл бұрын
Just want to say thank you soooo much for creating and uploading these amazing FREE tutorial videos. They are the best training vids I have probably seen ...paid or unpaid. I have been a Microsoft developer for over 15 years but this is the 1st time that I have truly understood patterns and their usage. After watching the patterns vids it was like an Epiphany...everything just became clear. I'd spent 10 years in the foggy wilderness and now I can see the light !!..Many, many Thanks !!
@derekbanas
@derekbanas 10 жыл бұрын
It is very nice for me to be able to reach people all over the world! I'm very happy that you're enjoying the videos :)
@nitin.cherian
@nitin.cherian 11 жыл бұрын
Hi Derek. One of the best tutorials I have ever seen. I would like to point out the things I liked most about the tutorials. 1. Your voice. It just glues me to the tutorial. 2. The tutorial is short, crisp and awesome. 3. Even your comments and replies here is constructive and clear. 4. The code is well documented and very understandable. Thank you so much. Hats off!!
@derekbanas
@derekbanas 12 жыл бұрын
Thank you :) I'll get another up as soon as possible
@derekbanas
@derekbanas 10 жыл бұрын
Thank you very much :) I already have the UML tutorial finished. I hope you like it
@derekbanas
@derekbanas 11 жыл бұрын
Thank you :) I did my best with it
@derekbanas
@derekbanas 11 жыл бұрын
Thank you very much :) Im very happy that you enjoy them.
@derekbanas
@derekbanas 11 жыл бұрын
I'm glad you found them useful :)
@derekbanas
@derekbanas 12 жыл бұрын
I know I've simplified it and in doing so assumed that viewers would understand that there normally would be more than 2 choices. I do that because I'm planning to provide concrete examples in the future on when and how to use these patterns. I hope that makes sense
@derekbanas
@derekbanas 11 жыл бұрын
Thank you for taking the time to write such a nice message :) I very much appreciate that.
@derekbanas
@derekbanas 12 жыл бұрын
It doesn't care that it is an interface. That is why the pattern is so great. The interface just does its job by allowing functionality to change dynamically while not effecting the super class. It may take some time to wrap your head around design patterns, but when you do you'll be able to write great code. It took me awhile as well
@Buuwelka666
@Buuwelka666 11 жыл бұрын
Thank you for these great videos. I'm a French student and I need to understand how design patterns work. I understand a lot more in your videos than in my university. Thanks again !
@maurobilotti
@maurobilotti 11 жыл бұрын
Derek, THANK YOU VERY MUCH!!... you have made an incredible job. The most important fact in my case, is your clarity to talk, i'm from argentina and as you know, this part of the world talks in spanish. I think that i have quite good english, but i saw a lot of tutorials where you barely understand what they are saying... however, your tutorials are excellent in this point. Congrats to you! Keep doing this job... all the developers in whole world are grateful with you.
@MrRaam030
@MrRaam030 10 жыл бұрын
Amazing tutorial, there is lot of stuff cramped in nicely into this short video, felt like completed 50 pages of reading in ease ... Thank u..
@derekbanas
@derekbanas 11 жыл бұрын
I do use setFlyingAbility in the code sparky.setFlyingAbility(new ItFlys()) Yes you could set flyingType as private. I didn't do that only because I wanted to show 2 ways to set that value. Sorry about the confusion
@chiligarden
@chiligarden 8 жыл бұрын
This is the easiest tutorial about design pattern that I have viewed. I can't wait to finish viewing/learning from your tutorials.
@derekbanas
@derekbanas 8 жыл бұрын
+chiligarden Great I'm happy that it helped :)
@derekbanas
@derekbanas 11 жыл бұрын
Yes it is halfway between a regular class and an interface
@MsPedroGomes
@MsPedroGomes 3 жыл бұрын
One marvellous from our times is that we can simply search for whatever input and quickly find a highly capable professor like you, explaining a fairly simple concept in a much simpler way, in just 11 minutes, with a clear enough voice to be understood at 2x speed. Many others would take a 60 min class, or even more to explain the same. Thanks!
@derekbanas
@derekbanas 3 жыл бұрын
Thank you for the nice compliment :) I appreciate it!
@derekbanas
@derekbanas 11 жыл бұрын
You're very welcome :) If you take a look at my OOD tutorials and the refactoring one you'll see that my number one goal is to write very easy to understand code. Very often we have to give up on some capabilities if we want to achieve that goal.
@derekbanas
@derekbanas 11 жыл бұрын
It is in the works. It will come out immediately after the design patterns tutorial. Then I'll cover oop analysis and UML. The refactoring will follow that
@Aglartur
@Aglartur 11 жыл бұрын
Thank you! I'm preparing for the midterm - videos are really helping me out!
@mostinho7
@mostinho7 3 жыл бұрын
Thanks this is the first video that made “favor composition over inheritance” click for me. I’ve always heard that phrase but now I see how it’s actually used.
@derekbanas
@derekbanas 11 жыл бұрын
Composition is a major part of most of the design patterns, so I can't really assign that just to the strategy pattern. Design patterns in general try to add flexibility through avoiding high coupling in many ways that are quite similar. Inheritance should be avoided if at all possible, but above all else understandable code is the goal
@Avarnus
@Avarnus 11 жыл бұрын
Thank you so much for those video on Design Pattern. As soon as I see it, I start looking at it and man, I realize I don;t understand in deeper concept even though I have completed projects in school using those concept.
@derekbanas
@derekbanas 11 жыл бұрын
You're very welcome :) I did my best to make the gof book make more sense
@bostonlights2749
@bostonlights2749 3 жыл бұрын
Old is Gold. Never imagined video from 2012 is still the best one out here
@brightshadow525
@brightshadow525 11 жыл бұрын
Thanks for this! Great pacing. Quick, but still thorough. One of the best educational videos I've seen, period!
@derekbanas
@derekbanas 10 жыл бұрын
Yes you can implement this in C++. You create a java like interface with a class that contains only virtual methods. Here is some information on abstract classes in Python python. org/dev/peps/pep-3119/
@derekbanas
@derekbanas 10 жыл бұрын
Thank you :) I'm glad to help
@derekbanas
@derekbanas 11 жыл бұрын
You're very welcome :) it is very gratifying to be able to help people all over the world
@sakhawathossen2104
@sakhawathossen2104 Жыл бұрын
it's 2022, Aug 1, I am watching this almost 10 years later . And it makes so much sanse. Thank you a lot for this video man. A true gem indeed.
@derekbanas
@derekbanas Жыл бұрын
Thank you :) I’m happy it is still helping people
@derekbanas
@derekbanas 11 жыл бұрын
Thank you :) I have a Design Pattern, Java, etc. playlist on my KZbin channel. Sorry, if everything is a bit confusing because I have so many videos. I try to aim for 10 to 15 minute videos. I feel that that is the sweet spot for completely covering topics. I know I'm the only person making videos that long. Actually my videos start out at 30 minutes before editing. I'm working to improve them all of the time. Thank you for your insight :)
@derekbanas
@derekbanas 12 жыл бұрын
Thank you :) Another one is coming to day
@saptarshimitra1267
@saptarshimitra1267 8 жыл бұрын
I have worked as a software engineer for 8 years and then went back to school & started doing Machine Learning. But when I wanted to revise my old stuff , your videos were the best option. Thanks for the effort and yes! UML tutorial will be great as well.
@derekbanas
@derekbanas 8 жыл бұрын
+Saptarshi Mitra Thank you for the very nice compliment :) Here is my UML tutorial kzbin.info/www/bejne/hZymaHuBqc6NeZI
@derekbanas
@derekbanas 10 жыл бұрын
Thank you :) Technically Fly should be an interface because in the real world Fly wouldn't be considered an object. I stick with that idea when writing code, but you may find a reason to use an abstract class that I haven't thought of.
@Peter-jy9rk
@Peter-jy9rk 5 жыл бұрын
After this third video of the design patterns series I can't wait to watch the rest! Fantastic explanations, thank you!
@derekbanas
@derekbanas 5 жыл бұрын
Thank you for the nice compliment :)
@jubinjuneja3135
@jubinjuneja3135 10 жыл бұрын
Its simple straight and clear. I have just listen only a few of them. I am in progress of listening more of deisgn principles session. Will recommend everyone who wants to learn design pattern... Thanks Derek
@derekbanas
@derekbanas 10 жыл бұрын
Thank you for the kind message :)
@derekbanas
@derekbanas 11 жыл бұрын
Yes that should work. You may want to give it a different descriptive name other than fly though
@MrSaikrishna534
@MrSaikrishna534 9 жыл бұрын
Thank you Derek for posting these series of videos
@derekbanas
@derekbanas 9 жыл бұрын
Saikrishna Boggavarapu You're very welcome :)
@derekbanas
@derekbanas 10 жыл бұрын
Thank you :) That is just about the perfect thing you could say!
@SpiritsofCreativity
@SpiritsofCreativity 11 жыл бұрын
Wow, I had totally skipped these tutorials for some reason when your first created them,. Now I just watch the first design pattern and I am just completly amazed! (why did I skip these videos!!)
@derekbanas
@derekbanas 11 жыл бұрын
I should have explained myself better in the tutorial. I now realize that it can sometimes be confusing when I show multiple ways to do the same thing in a tutorial. I'm very happy that you enjoy the videos :)
@shouketali5631
@shouketali5631 11 жыл бұрын
wonderful tutorials and wonderful code examples. It saved me the trouble of studying many hours for the same purpose.
Observer Design Pattern
22:27
Derek Banas
Рет қаралды 660 М.
Decorator Design Pattern
12:57
Derek Banas
Рет қаралды 422 М.
Smart Sigma Kid #funny #sigma #comedy
00:25
CRAZY GREAPA
Рет қаралды 10 МЛН
The child was abused by the clown#Short #Officer Rabbit #angel
00:55
兔子警官
Рет қаралды 22 МЛН
ROCK PAPER SCISSOR! (55 MLN SUBS!) feat @PANDAGIRLOFFICIAL #shorts
00:31
The Strategy Pattern: Write BETTER PYTHON CODE Part 3
15:31
ArjanCodes
Рет қаралды 110 М.
Strategy Pattern - Design Patterns (ep 1)
35:11
Christopher Okhravi
Рет қаралды 1,4 МЛН
5 Design Patterns Every Engineer Should Know
11:51
Traversy Media
Рет қаралды 933 М.
the TRUTH about C++ (is it worth your time?)
3:17
Low Level Learning
Рет қаралды 629 М.
5 Design Patterns That Are ACTUALLY Used By Developers
9:27
Alex Hyett
Рет қаралды 200 М.
10 Design Patterns Explained in 10 Minutes
11:04
Fireship
Рет қаралды 2,2 МЛН
Dependency Injection, The Best Pattern
13:16
CodeAesthetic
Рет қаралды 757 М.
Object-Oriented Programming is Embarrassing: 4 Short Examples
28:03
Premature Optimization
12:39
CodeAesthetic
Рет қаралды 767 М.
8 Design Patterns EVERY Developer Should Know
9:47
NeetCode
Рет қаралды 1 МЛН
Smart Sigma Kid #funny #sigma #comedy
00:25
CRAZY GREAPA
Рет қаралды 10 МЛН