He randomly came back after three years! Tak! Good to see you again.
@rafael.aloizio1769
6 ай бұрын
Yessssss I'm glad he is back man, I've learned so many things important on my career because of his videos
@danielszlicht2633
6 ай бұрын
Love him, jest super
@pulkitprajapat7862
6 ай бұрын
OMG I can't believe this, I asked him last week on Twitter when he is coming back..and here he is. 🐐
@mr_archanger
6 ай бұрын
What are the chances he’ll stay with us for some time now 😅
@pabloescobarparis6586
6 ай бұрын
@@mr_archangerdepends if project manager leaves him alone
@أحمدعمارنقودي
6 ай бұрын
Finally he remembered his password
@ChristopherOkhravi
6 ай бұрын
🤣🤣
@paultapping9510
6 ай бұрын
called it!! 😂
@himanshuyadav6672
6 ай бұрын
Where you were?, will you make video contunue now@@ChristopherOkhravi
@madyogi6164
6 ай бұрын
This must have been some variation in data.
@mohamedsayed8697
6 ай бұрын
Oh my god. I used to watch your videos when I started learning programming in 2021. Right now, I have an interview with Google scheduled next week. You don't know how happy I am to see you back. Thanks for coming and welcome back :)
@ChristopherOkhravi
6 ай бұрын
Glad to hear 😊 Best of luck on your interview!
@EmpySoul
5 ай бұрын
Once again, you enlightened me about something that might seen implicitly known and simple but in reality a truly good software engineer needs to be absolute aware of.
@r1konTheAutomator
6 ай бұрын
WHOA! i started watching your pattern videos like a week ago, binging them while at the gym, while taking walks, etc. i was like "eh it's been a long time since hes posted...he was a good teacher" and then here you are!!
@chirayumishra1185
6 ай бұрын
Welcome back Christopher. Good to see you back 😊 Keep up the good work and make learning fun and easy. All power and good wishes ❤
@PbPomper
6 ай бұрын
I've really missed these talks. Welcome back!
@no-name2031
6 ай бұрын
The man, the legend, welcome back
@Michaeljamieson10
6 ай бұрын
please continue have been rewatching your old stuff so glad to see this
@Jeff-xh4sy
6 ай бұрын
I used your design pattern videos to pass my cs class last term and here you are again lol
@kofranek
6 ай бұрын
That's precisely the problem I'm facing now. I created a model of hemodynamics in the Modelica language. I want to use this model to model different types of disorders - (left ventricular systolic failure, aortic stenosis, mitral insufficiency...) - everything is solved by setting the parameters of the model - that is, by setting different data values with which I change the behavior. So Hemodynamics
@ChristopherOkhravi
6 ай бұрын
I know way too little about that domain to provide any insightful response 😅 But I’m very happy to hear that the content is relatable 😊😊
@JeffJennings82
6 ай бұрын
I am determined to watch this video as many times as it takes to understand what he is talking about. 10 times later, maybe I should watch a refresher on polymorphism.
@rammehar5531
6 ай бұрын
Thanks bro for saying "differences in behaviour not data". It changed my approach towards polymorphism. Thanks again
@pattferraggi
6 ай бұрын
I was trying to quit watching KZitem but now I know it's not gonna happen. I am so happy you are back 😅
@JeevanNayal-f5c
6 ай бұрын
Great to see you back OOPS master. Waiting for a series on UML and class diagrams from 3 years 😛
@marekmeyer1200
Ай бұрын
I have never subscribed faster! What a treat that vid has been.
@CouchProgrammer
5 ай бұрын
The +/= example is brilliant. It's like the Liskov substitution principle and "The Square Hole".
@overholted
6 ай бұрын
What about when you are modeling two entities, people and organizations. You have different people types that require different fields for each type and different organization types that require different fields for each type. For people, say you have employees and customers. An employee can also be a customer. For organizations you have vendors and dealers. Vendors cannot be dealers. People can also act as organizations in the case of customers, who can be sole proprietors of their own small business, which may or may not have multiple people. I have been trying to figure out if this requires polymorphism or if it can be accomplished with a more normalized relational data structure. I know this is a complicated question for a KZitem comment section. Just throwing it out there. I'm fairly new to programming.
@alinapostol2230
6 ай бұрын
We've been waiting for you to come back! - so WELCOME BACK ^^!
@ZedanMohamed99
6 ай бұрын
my man still alive, good to see you again
@Rhyrkon
6 ай бұрын
Damn you're back! Thank you very much for the content!
@UnTizioACaso1
6 ай бұрын
I missed your videos, thanks for coming back!
@xusoft206
6 ай бұрын
OMG what a surprise having you back! I still paying my bills thanks to you man ❣
@mrshahram7
6 ай бұрын
I'm really happy that you're back ❤️♥️
@dani2500d
6 ай бұрын
Finally you are back! I enjoyed so much your design patterns playlist.
@gregridd
6 ай бұрын
Glad to see you again, really like your teaching style
@Indigo00757
6 ай бұрын
No way!!! You are back! Glad to see!
@wassimmehanna4402
6 ай бұрын
Christopher! I was waiting for you come back like the messiah! Happy to see you again man!
@robertpiosik93
6 ай бұрын
I don't believe to be here in 48 minutes from publication. Been thinking about you lately
@multiHappyHacker
6 ай бұрын
You teach OO programming? Interesting! What do you think of the architecture of the C++ standard library that prefers free functions and presumes classes are abstractions and abstractions should be useful? The short version is Klaus Iglberger's book and C++ conference talks.
@tom-kz9pb
6 ай бұрын
Polymorphism is a mixed bag. It can to some degree "simplify" C++ code, but it can also create deceiving "chameleon code" (as I refer to it) that is difficult to follow and debug, making it confusing to locate the real incarnation of a method that is being called.
@2005kpboy
6 ай бұрын
Good to have you back Chris ❤❤
@kpbmx
6 ай бұрын
Welcome back dude, we missed you
@observable-compositions-1996
6 ай бұрын
Thanks for coming back man
@FritsvanDoorn
6 ай бұрын
Hej, you are back. I have mist your videos, they have helped me so very much. Thank you for another interesting and great video.
@mick2386
6 ай бұрын
It's so good to have you back. Thank you 😊
@disdroid
4 ай бұрын
typing is about behaviour, not data. also scratch and thunderbold aren't subtypes of attack - they're instances. subtypes might include melee attack, range attack, etc. since you've only got one method "use" that gets overridden then an embedded dispatch (or function vector) would be the same as an override.
@atomic.rabbit
6 ай бұрын
Good to have you back!
@kodplanet
6 ай бұрын
Happy to see you back Christopher :)
@hamzabenarfa7425
6 ай бұрын
Thank you bro for coming back
@akashcastelino6056
6 ай бұрын
You're a fantastic teacher. Welcome back !!!
@sivaram7115
6 ай бұрын
A video after 3 years. Waiting for many more
@carnicer78
6 ай бұрын
Very nice and insightful video. I'm sick of maintaining code that uses subtype polymorphism when it's not required. This code of course contains awful conditions regarding the different subtypes, because some subtypes have some properties that other don't. There is even conditional compilation. Indeed, this criterium of using data vs behaviour sounds really good. However, I think the 3rd example (IMove class) is not the most ideal one. I believe that supposedly behavioural difference can also be modelled as a class, assuming the the base class is instantiated with the operation to do (substract / reset) to some custome values. Anyhow, thanks for the insightful video.
@hesperauxyo
6 ай бұрын
Wonderful presentation. I would like to ask a followup question. In this design (at the end), you would have to construct a variety of moves in the calling code, maybe using some factory or something. How does one limit the size of that factory? I am imagining, say, 250 kinds of attacks, all objects of class Attack : IMove. Say we are dealing with magic the gathering cards. How would you handle the complexity of generating said objects, or at that point would you consider a different design pattern that is data driven or something along those lines? New subscriber here. I'm a lead software engineer and love this kinda content. I hope to learn more from you in the future.
@user-sl6gn1ss8p
6 ай бұрын
My bet is data driven. I know the early Pokémon games are seen as buggy and whatnot, but they did have around that many moves (and pokémon) in a game running on a game boy. Also, just think of the joy in the modder's eyes (and of your designers) if you expose this data : )
@hesperauxyo
6 ай бұрын
@@user-sl6gn1ss8p good points
@duomgnotfound9517
6 ай бұрын
in the second example wouldn't you still want subtype polymorphism in case true behavioral variation is added later
@2005bgva
6 ай бұрын
Heyyyy it is fantastic see you again in your channel, please you don´t let alone again!
@elhaambasheerch7058
4 ай бұрын
One of my favourite resources to learn OOP.
@itsvanuatu5970
6 ай бұрын
Welcome back, 🙏. I loved your style of teaching, sub for ramdajs series.
@bronxandbrenx
6 ай бұрын
There are wrong data in the presentation :)). But it made me think.. Like heal, what does armor have to do while healing. Maybe it may take longer to heal because he needs to take it off?
@jerlabor2518
6 ай бұрын
Thank you again for your time creating this great content ❤
@elsartesano
6 ай бұрын
Long time no see you! I'm so glad to see new content from the one channel I recommend to all my juniors, thanks for the new video, very interesting. However, it brings a question: What if we have a variable data structure? For example, if we take your example of "attack", we might have this 3 structures: Attack: - name: string (E.G.: sword cut) - damage: int Attack: - name: string (E.G.: crossbow shoot) - damage: int - reloadTime: float - arrowConsumption: int (most likely 1) Attack: - name: string (E.G.: fireball) - damage: int - magika: int - castTime: int In this example, we have different types of attacks sharing some sort of base properties (or getters), and having some specific properties for each of the different attacks. Would this be a good use case for polymorphism, or you'd rather add an extra property containing the additional data if it applies (E.G.: metadata: List)? And if none, which approach would you recommend using here? Thank you very much for the content, it's always helpful to learn new techniques
@silberwolfSR71
6 ай бұрын
Polymorphism makes sense when you have some common denominator, a certain lens through which all your implementations can be seen. For example, you might imagine that you define an interface IAttack with a single method: bool attack(IDamageable target), which tries to apply some damage to the target and if successful returns true. Your three attack templates would each implement this interface. So e.g. your "crossbow shoot" might check whether its reload time has passed and whether there are enough arrows left before applying the damage. Or the "fireball" might start a timer and return true if it has enough magika and only actually apply the damage after the timer has ran for a duration of castTime. Both would also update their internal state accordingly, which is (from the perspective of simply applying an attack) an implementation detail that a consumer of IAttack might not care about. I think polymorphism makes sense for your example, given that you have some common interface that the Attacks all share and which is useful in the context of your problem domain. Crucially in the context of this video, there is an implied variation in behavior (illustrated by the example implementations I sketched out above) which justifies employing polymorphism. Generally I would advise to stay away from constructs like metadata: List where possible, since they are cumbersome and error-prone to work with.
@elsartesano
6 ай бұрын
@@silberwolfSR71 thank you very much for the answer, it's well explained and makes a lot of sense! However, I think the problem was me miss explaining: I was thinking of this without considering methods, maybe in the context of a DTO that represents the same thing (an attack in this example, or rather a type of attack), but with different data structures. Given your answer, would these attacks be considered different types of data instead of the same with different structures? What do you think? Thank you again for the answer, it's really a good one
@TedFanat
Ай бұрын
What I still don't understand is how can you replace conditionals with polymorphism if all that it just does is move conditionals to some kind of factory that creates an object that is later used polymorphically. Is that the whole point?
@MrNidnan
6 ай бұрын
The goat of OOO is back! Happy day to be alive!
@yonishachar1887
6 ай бұрын
While essentially the video is about 'configurational' subtyping(usually done by novice-intermediate programmers to shorten the amount of parameters the parent constructor takes), I disagree that the second example is wrong to use. The fact that both classes reduce a variable is an *implementation detail* - What if in a few months you'd want to have a third implementation that does something different? If we're talking about moves in a game... it's very likely. To address the issue at hand: I would have used the IMove interface, along with a concrete class DamagingMove whose constructor takes the amount of damage to inflict.
@silberwolfSR71
6 ай бұрын
I feel called out with the 'configurational' subtyping part, although I wouldn't say it's done solely for shortening constructor argument lists. For me it's more along the lines of "this specific configuration of my type has a referent in the domain", that is, for whatever we're trying to model, there exists some distinction between the configured type and generic instantiations of the supertype, _even if_ currently (or in the foreseeable future) there is no behavioral distinction. This example is a bit contrived, but say we're modelling a traffic sim. For the sim, we have car entities. These can be configured in a number of ways, including outer appearance. Say we want to model a taxi. We could do so by using a generic car instance, configured appropriately (specific pain job, perhaps a service number printed on the side, an availability light etc.), but this is a pain, especially if we need to create taxi instances in more than one place. In addition, the semantics of "this is a taxi" get lost. The "annoying to configure" part can (and arguably better so) be solved by use of a factory. So in some ways, "configurational" subtyping functions a bit like a "poor man's factory" for me. I'd be curious what alternative (if any) you would suggest for this "configurational" subtyping antipattern. I don't know if I can justify the semantic advantage of having a dedicated type. It just _feels_ to me like it makes sense to represent the type that exists in the domain, even if it has no behavioral differentiation. Perhaps an even more contrived addendum to my example above, say we're debugging the application and we see many more taxis than we expect. If we have a dedicated taxi type, we might spin up our debugger, look at the car instances and discover that half of the "taxi"s are in fact "normal" cars that were produced by a randomizing car factory that just so happens to configure a large percentage of the cars to _look like_ taxis. Granted, this does feel like grasping at straws.
@brtk7
6 ай бұрын
Great to see you back 😊
@neirenoir
6 ай бұрын
I don't think the second example is fundamentally different from the third one (other than the more general IMove name). For example, Thunderbolt could have a chance of inflicting Paralysis. To me, in traditional OOP, it would make sense to make the inheritance tree only one level deep and have the Attack (or Move, your choice) resolve everything on the target by itself. There is nothing to gain from changing to the Move architecture where Attack is a class with a damage param constructor and a Heal class when we could just blackbox ot all and let every Attack/Move just perform arbitrary operations over the target.
Is it still valid to use a superclass when the only use for it is to share properties across subclasses? For example: take a superclass of File with property Filename, and two subclasses of Image and Video. Image might have an ExifData property while Video might have a Duration property. Both Video and Image have a shared Filename (and other shared properties) so to my understanding these shared properties should be moved into a base class which is inherited by both subclasses. Is this valid or nonsense?
@rathinkumar8031
6 ай бұрын
good to see you back!
@salomaos
6 ай бұрын
Nice to see you back
@AriobarxanLiyan
6 ай бұрын
You came back finally.
@dripcode2600
6 ай бұрын
Love this! Great explanation.
@roblacksnail8615
6 ай бұрын
Long time no see❤
@bilza2023
6 ай бұрын
This was beautiful at poetic level
@youssef-attai
6 ай бұрын
I am happy. Welcome back.
@manojpanachikal2239
6 ай бұрын
Thank you, happy to see you :)
@jason_v12345
6 ай бұрын
Really well explained!
@anarkali_217
6 ай бұрын
Hey good to cu again after so long
@yahiashawky2173
6 ай бұрын
Welocme back LEGEND!
@SegnorRoboto
6 ай бұрын
Finally, the phoenix rose from the ashes.
@MedOussafi
6 ай бұрын
hi dear welcome back! 😊
@JuanLuisCasanova-d4l
6 ай бұрын
Welcome back! 🎉
@1over137
6 ай бұрын
Now go and play in C where you can have "polymorphic data structures" by using the union keyword.
@gracy2826
6 ай бұрын
HE IS BACKK!!
@Igoryan481
6 ай бұрын
oh my god... he's back, guys!
@markmsmh
6 ай бұрын
Yes, we can use subtype polymorphism avoid conditionals, but why ONLY? Differentiation based on data vs. Behavior us good, but there are many cases where sharing common part is good choice even when it goes for data difference.
@markmsmh
6 ай бұрын
But perhaps I am driven by specifics and special cases. I write libraries and you can trade less strict design for easier usage.
@ChristopherOkhravi
6 ай бұрын
Sometimes it makes sense to create a subtype that merely calls super in the constructor with some specific arguments. I would agree. Then the purpose is to occupy the name to make the API easier. I agree. I was probably being a bit too broad in the video. 😊😊
@Bobec1998
6 ай бұрын
Great content! Keep going! 💪
@dhruvgupta745
6 ай бұрын
Glad to see you again!
@AndreViannaRJ
6 ай бұрын
Welcome back.😃
@matan9577
6 ай бұрын
All of these anthropocentrically inspired design patterns of object hierarchies will only cause trouble unless the programming language has generics and api to get the type at runtime which are baked in and not sprinkled 10 years into the language's lifecycle with more limitations than features. It's just a fashion for organizing code to match one's primitive notions of hierarchies of shower ducks if you ask me, if the type information doesn't follow through to runtime or generics are a half-working hack really not worth it in complex modelling challenges. Unless there's very good reason to model state and data together or mimic a real-world object with actions, they can do more harm than good.
@fotios4902
6 ай бұрын
10:26 But if the player is using a heal move, then he would use it upon itself! Of course right?! You would not want to heal your enemy. Unless we're all very very kind. Which we should be! But that's besides the point. 😄 Oh bro you got me laughing so much... Thanks and welcome back!
@yapayzeka
6 ай бұрын
omg. dude you are alive ❤
@aleksandr2245
6 ай бұрын
wow, you're back!
@aj.arunkumar
4 ай бұрын
beutiful video... thanks bro for making this
@duaabraik9745
6 ай бұрын
Welcome back!! 😁
@BristlyBright
6 ай бұрын
Äntligen tillbaka! ❤
@mexhitasllani9309
6 ай бұрын
Welcome back!
@whitenigga2929
6 ай бұрын
It's been a long time. Welcome back!
@otmaneer-ragragui4458
6 ай бұрын
Welcome baaaack 🎉
@Pawemie
6 ай бұрын
I like to think, that you got so annoyed by someone at work using subtype polymorphism the wrong way, that it brought you back here ;)
@ChristopherOkhravi
6 ай бұрын
I teach at a university so I read a lot of student code 😉
@tony2351992
6 ай бұрын
in which university do you teach I need to attend there, you're a CS legend @@ChristopherOkhravi
@BANANAS2011
5 ай бұрын
I wish more people in your team do things in wrong way that you make more videos to teach others 😂
@arminium56
6 ай бұрын
Man, your notification popping up is the best thing happened in months❤, please don't disappear again :)
@andreaskonomis3
6 ай бұрын
Have been watching your Design Patterns series and the code walks videos and was always thinking if I ever wanted to have a youtube channel it would have been of this style. If only he was back. Wish granted, welcome back, so happy to see notifications from you! :DDDD
@EricFreedmanMusic
6 ай бұрын
literally just watched your design patten playlist, thinking why hasn't he posted for 3 years. perfect timing
@williamcory4689
6 ай бұрын
Welcome back! Got a huge amount of value out of this channel in my early days of becoming a dev
@TazG2000
6 ай бұрын
I would add a point that "variations in behavior" can also come from _outside_ the class - a class can just be a data type, without being responsible for all the ways the data will be used. Imagine an Attack subtype, EnergyAttack, which has an additional property EnergyType. Now Scratch is a base Attack instance, and Thunderbolt is an EnergyAttack (with EnergyType = Lightning). Looking at just the class definitions, you could say this is a data-only variation, but it makes sense because the change is in the data structure (an additional property), not just values. These subclasses may or may not implement variations in behavior themselves, but _allow for_ external variations by being different types: We may have many general functions that work with the Attack type, as well as some functions that accept EnergyAttack specifically and work with the EnergyType property.
@kiranmahajan9067
6 ай бұрын
Your teaching is the greatest and simpler....❤
@CarlRoa
6 ай бұрын
Awesome to see you back Chris! I’ve learned a lot from your videos, and have always enjoyed hearing your perspective on things. 😎👍
@wBkSlayer
6 ай бұрын
Holy shit. You're back. And the beard is ever so magnificent. Don't you dare disappear for such a long time again.
Пікірлер: 674