Covariance & Contravariance in PHP - Full PHP 8 Tutorial

  Рет қаралды 11,764

Program With Gio

Program With Gio

Күн бұрын

Пікірлер
@papinzazyan115
@papinzazyan115 2 жыл бұрын
I have been watching these series of videos since the beginning and there are lots of new things I learned as a senior PHP developer. Thank you so much for such a great job!!! I am leaving a comment here because I really would like to see SOLID principles explained by you. If that is possible, please do.
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Thank you. That is on my list, not sure when I will be able to get to it but its on my list :)
@vitaliksw4997
@vitaliksw4997 3 жыл бұрын
Thank you for this one! Video about SOLID principles would be great...
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
You're welcome. Yea have that in my queue to work on 👍
@ЧеловекДумающий-й6т
@ЧеловекДумающий-й6т Жыл бұрын
hi! you could start by reading of uncles' Bob "clean architecture". This book almost starts (part 3 chapter 7) from breaking down of what does SOLID mean.
@stephen.cabreros
@stephen.cabreros Жыл бұрын
Well I got confuse at first for contravairance why they making it a vice versa of covariance return type and then I realized at the end of the video when you explained about Liskov Substitution Principle that children class must have a general parameter type so we can pass any type of class less specific to the base parameter type. Thanks Gio.
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Awesome, you're welcome
@Zubbee
@Zubbee 2 жыл бұрын
The names seemed scary lol but you explained the principles so well Gio. Watched it twice already. They are straight forward. These series are exposing me to a lot or php features and programing principles too. This course is a literal answer to prayer I must confess. Thanks Gio.
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Great to hear, thank you & great job following through each video 💙
@Armando-px8hi
@Armando-px8hi Жыл бұрын
Another wonderful video about PHP thing that I have not noticed anywhere else. Just wanted to let you know that the appearence when you added Note,Summary, Remember parts it was so nice and helpful I have added all the Summary thing on my notebook so that when I read about Covaiance and Contravariance I can remember what you told. That's some improvement that I needed. Thanks a lot :)
@ProgramWithGio
@ProgramWithGio Жыл бұрын
That's awesome, happy to hear it. Thank you
@guillermofernandez2247
@guillermofernandez2247 2 жыл бұрын
Yes, videos about SOLID would be great, there are a lot with examples and exercises to do in JAVA (fuc..... JAVA). Design Patterns after that also would be awesome.
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Noted, thank you 💙
@mehdi-vl5nn
@mehdi-vl5nn 4 ай бұрын
I've commented a couple of times here and on Twitter! You're a legend! Please make a video series on SOLID too-no one seems to have asked for it, but that's their loss for sure (though I didn't check, to be honest)! I saw your video series on Laravel and I was like, yessssssss! 😁😁
@ProgramWithGio
@ProgramWithGio 4 ай бұрын
Thank you 💙
@leeroy11
@leeroy11 3 жыл бұрын
you are a god's sent, Keep it up. You deserve every bit of recognition
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
Thank you 💙💙
@momohhassan8087
@momohhassan8087 2 жыл бұрын
welcome back, PHP the right way, thank you so much
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Thank you 🙌
@alexios4392
@alexios4392 2 жыл бұрын
Great! I love your explanations and the fact that you raise interesting topics. More advanced PHP please :D
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
More to come! Thank you
@aleksandrkanygin2672
@aleksandrkanygin2672 2 жыл бұрын
Great lesson as always 👍👍👍. At first it wasn't clear for me why return type covariance doesn't break the lsp, but after making a few examples with covariance myself and unsuccessfuly trying to break the code it perfectly makes sence now.
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Awesome 👍. Thank you 🙌
@yuriymiroshnychenko5446
@yuriymiroshnychenko5446 2 жыл бұрын
Thanks for the helpful and informative video! A video about SOLID principles with such good examples would be great too 😉!
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
You're welcome 🙌
@emekatimothyiloba699
@emekatimothyiloba699 Жыл бұрын
Thank you gio. Interested in the SOLID principles explanation
@ProgramWithGio
@ProgramWithGio Жыл бұрын
🙌🙌
@Yazan_Majdalawi
@Yazan_Majdalawi Ай бұрын
Yes please, I would love to learn SOLID from you!
@ProgramWithGio
@ProgramWithGio Ай бұрын
👍👍
@mwaas
@mwaas Жыл бұрын
another great content; the new animation super cool😁
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Thank you, I had help with this one 🙌
@odonatojunior
@odonatojunior 3 жыл бұрын
Amazing content as always 👏👏👏👏👏
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
Thank you 🙌
@restless_moon
@restless_moon Жыл бұрын
yes. please make separate video on SOLID principles
@ProgramWithGio
@ProgramWithGio Жыл бұрын
👍👍
@memack101
@memack101 2 жыл бұрын
Thank you and I would appreciate a video series on the solid principles.
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Noted, thank you
@benderbg
@benderbg 4 ай бұрын
11:09 I think you wanted to say for Union types that its contravariant going from more specific to less specific and for intersection types its covariant going from less specific to more specific.
@ProgramWithGio
@ProgramWithGio 4 ай бұрын
No, when a type is removed in union type it's going from less specific to more specific, it's covariant. When type is added to intersection type it's also going from less specific to more specific. Remember union is same as "or" and intersection is same as "and". So A or B is less specific and if you remove a type and just set to A then u are being more specific.
@benderbg
@benderbg 4 ай бұрын
@@ProgramWithGio You are right. I rewatched that section of the video and consulted with the AI buddy. I got confused because of the switched places of union and intersection types (one is in parent class, other is in child class). I disregarded the fact that intersecting (AND operation) two types like C&D makes them more specific than just type C. For the union example it's the opposite since we are going from C|D (OR operation) to C so it makes types less specific. So its covariant in both cases 😇 Thanks for reading all the comments and replying is such a short notice. You are the best!!
@expresscoding3525
@expresscoding3525 Жыл бұрын
Yes sir, we want SOLID principles playlist, it's necessary for us, also design patterns using PHP. would make sense. Waiting for that course, sir.
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Thanks 👍
@DanFletcher90
@DanFletcher90 3 жыл бұрын
Great job with this one Gio!
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
Thank you 💙
@mamdouhzaq
@mamdouhzaq 3 жыл бұрын
Thanks for the lesson, we've missed u already
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
💙💙
@Mariia-lr4vx
@Mariia-lr4vx 9 ай бұрын
Thank you, very helpful!
@ProgramWithGio
@ProgramWithGio 9 ай бұрын
You're welcome!
@santvar380
@santvar380 2 жыл бұрын
Great explanation, please consider to add SOLID tutorials
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Maybe in future, thank you 💙
@AlirezaSalehi-xz3ch
@AlirezaSalehi-xz3ch 3 жыл бұрын
Your videos are so great , hope u make more👏👌♥️
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
Thank you 🙌
@josephadorboe8745
@josephadorboe8745 2 жыл бұрын
i would like a series on the solid principles
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Noted, thanks for the feedback
@omaryahia
@omaryahia Жыл бұрын
YES SOLID principles please!🌟❤✅
@ProgramWithGio
@ProgramWithGio Жыл бұрын
👍👍
@josephadorboe8745
@josephadorboe8745 2 жыл бұрын
good work thanks
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Thank you
@ziat1988
@ziat1988 Жыл бұрын
Solid principle with PHP will be cool please. and some design pattern :))
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Thank you for suggestions 🙌
@aruppaul1468
@aruppaul1468 3 жыл бұрын
amazing
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
💙💙
@AlirezaSalehi-xz3ch
@AlirezaSalehi-xz3ch 3 жыл бұрын
Awesome
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
💙💙
@JRCSalter
@JRCSalter Жыл бұрын
Sorry, I'm not understanding this. Surely, if anything, you would want your parameters to be more specific with the child classes. For example, you could have DogFood which extends AnimalFood which extends Food. And then for the eat method on the Dog class, you can pass in the DogFood type as a parameter. Makes much more sense to me. Why would you want the parameter to be less specific?
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Then you would be limiting your Dog class to only eat DogFood but Dog can eat human food too right? That's the idea behind it, it allows you to pass a less specific type of argument, hence, creating more flexibility. it also supports substitution principle, a Dog instance, which can eat any food, is still valid in any context where an Animal that eats AnimalFood is expected.
@JRCSalter
@JRCSalter Жыл бұрын
@@ProgramWithGio If that's the case, why limit the parent class? Why not pass in Food, rather than AnimalFood?
@ProgramWithGio
@ProgramWithGio Жыл бұрын
@@JRCSalter you could do that, it depends on how you are structuring your app, then your child class can't be any more specific than Food so reduces some flexibility
@JRCSalter
@JRCSalter Жыл бұрын
@@ProgramWithGio And that's why I don't understand this. It just seems like a restriction rather than anything helpful. As you say, the parent class could use Food, which means you can't be more specific with the child class, but the whole point of allowing the child class to be less specific is to give the child class more flexibility. So why would you care about whether the child class can't be more specific? It just seems to me that allowing the programmer to choose the specificity either way is far more flexible than restricting them.
@ProgramWithGio
@ProgramWithGio Жыл бұрын
@@JRCSalter it would violate liskov's substitution principle that way. I would read up on that for more context and why it's important
PHP Attributes - Simple Router With Attributes - Full PHP 8 Tutorial
22:59
My scorpion was taken away from me 😢
00:55
TyphoonFast 5
Рет қаралды 2,7 МЛН
PHP - Encapsulation & Abstraction -  Full PHP 8 Tutorial
15:23
Program With Gio
Рет қаралды 33 М.
What Is Late Static Binding & How It Works In PHP - Full PHP 8 Tutorial
9:58
PHP Enums With Practical Examples - Full PHP 8 Tutorial
28:13
Program With Gio
Рет қаралды 27 М.
Data Transfer Objects - What Are DTOs - Full PHP 8 Tutorial
13:03
Program With Gio
Рет қаралды 43 М.
Hardy's Integral
13:47
Michael Penn
Рет қаралды 14 М.
My scorpion was taken away from me 😢
00:55
TyphoonFast 5
Рет қаралды 2,7 МЛН