PHP - Encapsulation & Abstraction - Full PHP 8 Tutorial

  Рет қаралды 32,224

Program With Gio

Program With Gio

Күн бұрын

Пікірлер: 99
@federicobau8651
@federicobau8651 2 жыл бұрын
Best PHP and complete course. Better than many paid bootcamps and best quality
@GYEONGSUGIM
@GYEONGSUGIM 6 ай бұрын
This is one of the best course I've ever seen... Not just how to write php code, but it also explain how to write idiomatic code.
@ProgramWithGio
@ProgramWithGio 5 ай бұрын
Thank you
@Ab-cj6gl
@Ab-cj6gl 3 жыл бұрын
Dammann I'm glad I found this channel
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
I'm glad as well 🙌
@stepanmutsikivsky8987
@stepanmutsikivsky8987 Жыл бұрын
It's not my first time learning OOP concepts, but the first time, when someone clearly say that using simplest getter and setter with private property isn't encapsulation at all! It doesn't change a thing! The property is still absolutely accessible, but with more text to type in and read! I always understand this, but thought that maybe... I don't understand something?.. Gio the best!
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Heh, yup. It's usually misunderstood. Thank you 🙏
@channel-gi3nd
@channel-gi3nd 3 жыл бұрын
The best USEFUL ADVANCED php series on the youtube 👑❤ ... Thanks for that trick
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
You're welcome and thank you 🙌
@petruciucur
@petruciucur 2 жыл бұрын
Only This course gave me confidence that I can reach the advanced php level. Brilliant ! Thanks !
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Great to hear, thank you
@phixphixation7261
@phixphixation7261 2 жыл бұрын
I am really enjoying all of your lessons, you explain things in depth while keeping it understandable for most people. Even advanced developers can learn something new here. I have been writing PHP applications until 2 years ago when I stopped, I follow your lessons to get back into the game, and it's working! Thanks for all the effort you put into making them.
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Thank you so much, that means alot 💙
@levani7851
@levani7851 3 жыл бұрын
that last bonus trick at the end was amazing, my mind is blown... great job, another amazing video!!
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
Thank you 🙌
@ДалирХужамурадов
@ДалирХужамурадов Жыл бұрын
Just wanted to let you know, that your tutorials are awesome
@ProgramWithGio
@ProgramWithGio Жыл бұрын
I appreciate it, thank you 🙌
@PascalxSome
@PascalxSome 2 жыл бұрын
Your Tutorial is the best! Easy to learn interactively (don't learn PHP programming without a editor and browser ready). Way better than any page I found. I started making my own MVC in PHP with little to no knowledge about OOP. As a sysadmin, Bash and Python are quite familiar in a functional way. Getting my head around OOP was hard at first, but now things are coming together as I learn more essential stuff.
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
That's awesome, thank you 💙💙
@ДухДмитро
@ДухДмитро 3 жыл бұрын
best php tutorial on youtube
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
Thank you 🙌
@ayenewyihune
@ayenewyihune 2 жыл бұрын
4:00 this was what I have always wondered about. Thanks for answering.
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
That's awesome
@bracoyote96
@bracoyote96 10 ай бұрын
I already knew about public and private properties and methods but I didn't know about those two ways of accessing private properties. Why do those things exist? Doesn't it defeat the purpose of having private stuff in the first place? By the way, I LOVE these videos. Thank you so much for taking the time to make this guide. I feels like something I should have to pay for.
@ProgramWithGio
@ProgramWithGio 10 ай бұрын
Thank you, appreciate it. Language supports a lot of things, doesn't mean everything should be used by everyone. Some of those things can be useful for libraries, packages, and some edge case scenarios.
@ינוןאלבז-כ1ז
@ינוןאלבז-כ1ז 2 жыл бұрын
Again, great lecture
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Thank you 🙌
@Vitalii-m6r
@Vitalii-m6r Жыл бұрын
I used to confuse Abstraction and Encapsulation. Thanks for the explanation!
@ProgramWithGio
@ProgramWithGio Жыл бұрын
You're welcome
@WhiteSiroi
@WhiteSiroi 2 жыл бұрын
loving your vids, GOAT ty
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Thank you 💙
@Zubbee
@Zubbee 2 жыл бұрын
Great lesson, I followed. Also heard when you said we may have to listen again, I will do well to do that tomorrow. Thanks Gio.
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Great to hear, thank you
@kickass1179
@kickass1179 3 жыл бұрын
great explanation...I'm loving this series...I am making my own document to sum up my PHP knowledge, and this series is HELPING ALOT!! Thanks!!
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
That's great to hear, thank you 🙏
@kiranugale88
@kiranugale88 Жыл бұрын
Extemly superb teaching
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Thank you 💙
@kunalkharidia1
@kunalkharidia1 Ай бұрын
Thanks a lot for such a great tutorial. Watching your videos seems like watching a excellent quality Web Series which keeps the viewer engaged and curious of what the next episode is going to bring up. Guess what!!!!!!. The next episode exceeds the expectations and the bar for viewers expectations rises to next level. It is quite addicting to watch Ur content. It feels like I finish all the episodes at one go. Also I am expecting what the Movie Director has to come up next. Seeing to the in-depth knowledge over the subject and great presentation skills i would suggest if you could bring up a series on "DESIGN PATTERNS - THE GIO's way" would be an ideal candidate for future releases!!!!
@ProgramWithGio
@ProgramWithGio Ай бұрын
Thank you for this feedback, happy to hear 💙💙
@lairotuT-Tutorial
@lairotuT-Tutorial Ай бұрын
I want to give a double thumbs up!
@ProgramWithGio
@ProgramWithGio Ай бұрын
💙💙
@dipuchundradey
@dipuchundradey 3 жыл бұрын
Your videos are really beautiful and easy to learn.💗💗💞💞
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
Thank you so much, glad you like them ❤️❤️
@dipuchundradey
@dipuchundradey 3 жыл бұрын
@@ProgramWithGio Make some videos in Design pattern.
@binarybuilder111
@binarybuilder111 Жыл бұрын
Thank you so much! Your lessons are pure gold!
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Glad you like them, thank you
@smurffronda2951
@smurffronda2951 2 жыл бұрын
Thank you
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
You're welcome
@steelmantv
@steelmantv Жыл бұрын
Thank you for all this awesome instruction!
@ProgramWithGio
@ProgramWithGio Жыл бұрын
You're welcome 💙
@gerardorebolledo3385
@gerardorebolledo3385 Жыл бұрын
These videos are really enjoyable, good job buddy
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Glad you like them, thank you 🙌
@deniskonvisar6079
@deniskonvisar6079 Жыл бұрын
fantastic explanation, thank you a lot!
@ProgramWithGio
@ProgramWithGio Жыл бұрын
You are welcome 🙌
@securecodingdevelopment5023
@securecodingdevelopment5023 3 жыл бұрын
Excellent ! Thanks!
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
Glad you liked it!
@memack101
@memack101 2 жыл бұрын
Thank you.
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
You're welcome 💙
@aleck156
@aleck156 3 жыл бұрын
5:45 - that's an idea similar to the concept of immutability of an object, where you're not allowed to modify an already existing object. The only way of making changes is by creating a new instance with new/updated properties.
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
Yup that is right
@ilya_123__
@ilya_123__ Жыл бұрын
thank you!
@ProgramWithGio
@ProgramWithGio Жыл бұрын
You're welcome
@sujanmiya4514
@sujanmiya4514 2 жыл бұрын
Nice tutorial
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Thank you 💙
@rustem6388
@rustem6388 Жыл бұрын
Thank you!!!
@ProgramWithGio
@ProgramWithGio Жыл бұрын
You're welcome!
@badevent
@badevent Жыл бұрын
Awesome! I love, mate!
@ProgramWithGio
@ProgramWithGio Жыл бұрын
💙💙
@JohnnyBigodes
@JohnnyBigodes 3 жыл бұрын
Getters and Setters are not that bad... They are not only made because of encapsulation, but you have better control about what can be written to that private property. In your case it shouldnt be a big problem, because your property is properly defined as a float, but with older code wihtout types this could be a problem. You could define $transaction->amount = 'Hello There' instead of a float number. With a proper Setter you could easily throw an exception if the value is not an int or float.
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
Definitely. I mentioned that in the video as well. There are use cases for Getters and Setters outside of simple encapsulation implementation, they are not just for encapsulation. As mentioned in the video sometimes they can break encapsulation instead of fixing it. You brought up a good example with the types, that is also correct, if one doesn't use strict types then definitely setter is good to enforce the type and have proper "validation".
@JohnnyBigodes
@JohnnyBigodes 3 жыл бұрын
@@ProgramWithGio Yes, I was also thinking about legacy code, where not every type is available.
@KenGabiola
@KenGabiola 8 ай бұрын
What compiler do you use? like that, that has live server web extension that easily refresh code changes
@ProgramWithGio
@ProgramWithGio 8 ай бұрын
I don't use any compiler or extensions, its just my IDE phpstorm but I refresh the page manually, I just sometimes cut things out during editing
@kingus66
@kingus66 Жыл бұрын
Thank you so much for this course, the content is great, but those popping-up subscribe banners even for users who already subscribed to your channel are a bit annoying. Please, could you do something about it? Thanks again.
@ProgramWithGio
@ProgramWithGio Жыл бұрын
They pop up only a couple of times, I don't think is a big deal 🙂. I also put them in places where not much is going on so it doesn't block anything important.
@ItsDigiUtime
@ItsDigiUtime Жыл бұрын
I read in a book's intro about design patterns where Abstraction was mentioned in OOP's context and the explanation was that abstraction means that objects only model attributes and behaviors of real objects in a specific context. It kind of does not seem to fit with the way you described abstraction or am I missing/misinterpreting something? The example in the book was about a plane, how in the context of a flight simulator, we would care about certain physical aspects that would matter in simulating a flight realistically, but in a booking application we would only care about seats, their availability. I am assuming that abstraction is a broader topic and that both you and the author in the book just provided a small fragment of the same topic? In the book it was just a couple paragraphs before moving on to the next topic. Book for reference is "Dive Into Design Patterns" by Alexander Shvets
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Yea I think we both are talking about the same thing, though the definition in book may be a bit more fancier. Abstraction is simply where the implementation details are sort of hidden away (abstracted away) from you, so in your example in the context of booking, the user does not care how the booking system is implemented, all the user cares about is to click a button & confirm the flight. To translate that into code, you might have a class called Booking with a method called book. As the user/developer who wants to consume that API & create a booking, all you need to do is instantiate a new Booking class & call the book method, you don't care what happens inside the book method or how its implemented, no other setup is needed by you, all you care about is that booking is created after you call the book method. That's what abstraction is in simpler terms.
@ItsDigiUtime
@ItsDigiUtime Жыл бұрын
​@@ProgramWithGio Appreciate the detailed response, thank you for clarifying that
@hakeamgureh2441
@hakeamgureh2441 3 жыл бұрын
Is ReflectionProperty php class/php api built in or does it require installation via a composer sort of?. Great tip/trick at the end. Thanks for being awesome
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
It's part of PHP. We'll cover Reflection in more detail soon in third section of the series.
@hakeamgureh2441
@hakeamgureh2441 3 жыл бұрын
@@ProgramWithGio thanks Gio. When is part 3 by the way?
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
Should be able to start next week I think. Been super busy recently
@fraidoonhu9284
@fraidoonhu9284 Жыл бұрын
Exposing the setter method is not like making the property public, because with setter u have control to check and manipulate the value. u can have criteria to check the value if it meets the criteria or not. In future if u change the rules for the value, u can just change it in one place in setter. Setter method makes it more secure and under control.
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Sure, but it still gives ability to change the state of your class. It has it's use case though, don't get me wrong.
@Operaatoors
@Operaatoors 2 жыл бұрын
I am working to get my php code compitable with PHP8.1, and static analyze tools found that I had classes, where some arguments in constructor with default values were before values without default fallback. In tottal it accepts 5-10 values in constructor) Now I found that this class is called in about 10 files. I had to rearrange those arguments, change values in those files. Properties were all public. No setters. Does this means that somebody who wrote this class was not following best encapsulation practices, right? But basically, it is simple DTO, with two methods to check it state, and another method to get another object based information from this class. What would be the better approach? Just use chain setters? Or couple some information pieces together in another smaller DTOs, so it the main DTO would have only 3 arguments in constructor? But I see that it is usually used to fill array value, and it would increase indentation. But now, PHPstorm is even struggling showing all the argument names :D
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Having public properties means that it can be written to outside of the class. So inevitably it has conflict with encapsulation. If you don't want those properties to be editable you can use readonly keyword for the properties and keep them public. DTOs should be immutable anyways so readonly properties should work
@truthteachers
@truthteachers 2 жыл бұрын
Hi Bro, your courses are comprehensive unfortunately many of the newbies to PHP in our developer group in the region gave up on your courses. The reason they say is the "rambling on" effect of your presentation. I have mentioned this before. My recommendation is to redo these videos and provide detail explanation. Of course, your effort needs to be rewarded as well. Suggestion is to launch the course in Udemy. Also suggest you timestamp the video as well especially when you cover many topics/concepts in one video. Like this one, i dont know where abstraction starts when i come back later for reference. I hope you do not take these as negative comment but instead use it positively. Tq bro.
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Hello. Thank you for the feedback. I agree on couple of parts like having timestamps & on previous videos I speak too fast due to editing errors & the way I speak. That being said though, whoever thinks I am "rambling" can go and watch something else, I've got no problems with that. I am not going to redo these videos into an Udemy course. Also I'm not sure what you mean by "provide detail explanation", all of my videos are very detail oriented, it doesn't get any more detailed than that, that's why this series has almost 100 videos in it & is not a "Learn PHP in 3 hours" crash course because it's very detail oriented. You can even see that based on the feedback from the comments on every single video on how detailed it is. I'll try adding timestamps on future videos. P.S. If they don't understand something or have any specific questions they can always reach out & post comments themselves, I'll be happy to assist & clarify things that may be confusing to them.
@truthteachers
@truthteachers 2 жыл бұрын
@@ProgramWithGio Bro, no one said it is garbage. Perhaps the course is not meant for absolute newbies to PHP. Anyway that is their feedback. Take or drop is your choice. Please dont shoot the pigeon. I am conveying their views and also to avoid 100s of dislikes for all your good effort. Anyway, my apology for upsetting you emotionally.
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
@@truthteachers I'm not upset and I appreciate the feedback. As I said they can ask me questions directly if something was confusing and I'd be happy to help. I've helped many. I'm not afraid of dislikes either. I just care about this stuff because if something is confusing I want to know specifically what and improve on it and also help the person who is confused. Someone just saying "rambling" is not helpful, if they were to say specifically what was confusing or what they didn't understand I would be happy to help. Either way, thank you 💙
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Nothing against you btw :). I understand you are just conveying their views and I appreciate that. There are many complete beginners who took this course and had no issues, so I think it can work for complete beginners. Some things certainly can be confusing and that's why I offer my help to those who need it.
@ZeppGoesPro
@ZeppGoesPro 2 жыл бұрын
Seems like php changes occurred. At 4:25, when i tried to pass setAmount function it results in: Fatal error: Uncaught TypeError: App\PaymentGateway\Paddle\Transaction::setAmount(): Return value must be of type float, none returned. Expected type 'float'. Found 'void'.intelephense(1006). public function setAmount(float $amount): float # setter function for changing the private (encapsulated) property { return $this->amount = $amount; } The way it start working for me.
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Don't think anything changed related to that. You just need to return the proper type. If you do $this->amount = $amount then you need to return $this->amount.
@RedZambala
@RedZambala Жыл бұрын
I had the same type error, and return $amount; helped; In Gio video there is no Return;
@johongirrahimov2343
@johongirrahimov2343 3 жыл бұрын
Clients don't need to know how car operaters, all they have to know is to drive
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
That is true, but it also depends on what kind of car you give to the client. If you give it a well-designed & functional car, the client will be safer. If you give them a car that malfunctions then it's not so safe. So, in the end, it's correct that the client doesn't care how a car operates but they do care that their car is fully functional & operational
@johongirrahimov2343
@johongirrahimov2343 3 жыл бұрын
@@ProgramWithGio Yeah totally agree. Thank you for reply though
@udayan285
@udayan285 Жыл бұрын
Thank you.
@ProgramWithGio
@ProgramWithGio Жыл бұрын
You're welcome
PHP - Inheritance Explained - Is Inheritance Good? -  Full PHP 8 Tutorial
25:09
PHP Traits - How They Work & Drawbacks - Full PHP 8 Tutorial
31:41
Program With Gio
Рет қаралды 33 М.
I tricked MrBeast into giving me his channel
00:58
Jesser
Рет қаралды 29 МЛН
Osman Kalyoncu Sonu Üzücü Saddest Videos Dream Engine 275 #shorts
00:29
Amazing remote control#devil  #lilith #funny #shorts
00:30
Devil Lilith
Рет қаралды 14 МЛН
Php Encapsulation (Object Oriented Php 2021)
12:33
Zak H.
Рет қаралды 3,1 М.
What Are PHP Magic Methods & How They Work - Full PHP 8 Tutorial
16:55
Program With Gio
Рет қаралды 30 М.
What Is Late Static Binding & How It Works In PHP - Full PHP 8 Tutorial
9:58