Hey folks!👋 Want to have hands-on practice on these concepts? 🤓 Try out CodeCrafters.io we have partnered and you can get 40% off 💸with this link: app.codecrafters.io/join?via=DevStory They have great hands-on tutorials and easy to get up to speed with complex systems. Check them out!
And because is not another annoying Indian accent that makes your brain omelette, so instead of focusing to understand the point you try to slow down the fast bad English accent of the presenter and you are missing the point.
I was trying to find a starting point to digest all this information but kept running into content that over explained and brought in new terms without context. Your vid was the perfect place to begin understanding these new concepts. Great examples and explanations without going too high level. Thank you!
I have an interview tomorrow, and I just wanted to quickly revise some of the common topics. This is one of the best video I have found to understand SOLID principles. Thank you for this clear and concise video. 👍
Lot of novice interviewer always ask methodology name rather than saying about challenges and asking solution . Always ask tell in your challenges and then I give solutions then 90% interviewer has no answer 😂😂😂
I would separate the vehicle into automatic vs manual, because there are also automatic combustion vehicles. Electric cars have a gear box similar to automatic cars, but specialized. Otherwise, great and concise explanation of the principles :) I had difficulty with understanding the liskov principle, but you've explained it well and now I get it.
Glad it was useful! That was part of my idea originally. You can check the playlist for other topics that are common in technical interviews. And BTW good luck in your interview!
SOLID programming means abstracting your code, having classes depend on abstractions (like interfaces), and not other classes. The best code is simple and de-coupled, easy to modify without breaking everything, and easy to read. Single responsibility: Each class should have a single responsibility. Open/closed: Classes should be built to extend and be closed for modification. Liskov substitution: Changing instances with sub-types shouldn't break your code. Interface segregation: Delegate functionality to interface classes. Too many interfaces > too few. Dependency inversion: High-level classes should rely on abstractions (like interfaces) rather than on lower-level classes. You're inverting their dependency.
Very clear and to the point, thank you Christian! 🙏 The examples with the diagrams really made it clear, going to apply these in Python. Love to see more about these principles and design patterns. Liked and subscribed ✅
I don't think I understand what open closed principle REALLY means... Like how can a class be closed for modification? I think it's talking about using immutable objects and stateless classes, because it's the state of the class that can change. Open for extension on the other hand is saying you should use interfaces to swap out implementations, I don't think using inheritance is a good idea because you're tied to that base class, especially if the class is part of an Api. Basically you should program to interfaces so your implementations can be swapped out for different ones and your existing code doesn't change, new code is added. This is what open closed principle really means. What do you think?
Yeah the principles can be confusing. And the specific naming of the open/closed one it's tricky. I'd say the main idea is that in case you need to add behavior to a program/class, instead of adding the behavior to the class, make it easier to replace or extend the behavior of it. Not necessarily with inheritance I'd say. Here's an article that I think explains it very well. medium.com/@alexandre.malavasi/why-is-the-open-closed-principle-so-important-bed2f2a0d4c7 Let me know if it helped :)
Hi there , I really like these videos as it one of the best videos which explains about lot of important concepts required to be better dev and which is not found in the sea of UA-cam videos … I would also like to know if there are any books that you would recommend for becoming a advanced java programmer starting from the basics .. you may recommend like for beginner this is best and after that this book is best … Thanks in advance ! Appreciate your hard work in creating such a quality contents with loads of essential stuffs in them for being a good and better dev … love your videos ! 💕
Oh thanks for the compliments 😀 regarding books on design patterns check out the description. Regarding java beginner java books I would recommend (though I haven't read) Head First Java , and Effective Java (this for all levels and it's quite nice).
Applying the Interface principle 4:43 wouldn’t this break the Leskov principle because you can replace vehicle with combustion since it has another method not used?
Nope, because you are specializing the classes. That's perfectly ok. What is not ok (according to Liskov) is if Vehicle has methods that can't be implemented by either Electric or Combustion (for example, shift() method). Hope is clearer :)
It's always so easy with those examples like Cars and Animals, but then in real life projects those principles are extremely hard to use. And almost nobody does, at least in huge projects.
In my experience they are used extensively in any maintainable project. The thing is that it depends a lot on the domain so the examples would be way more specific in that sense. But factories, singletons, decorators, adapters, proxies, and observers are probably some of the most used ones.
On 5:13 these open arrows mean "is-a" right? But then it says on the bottom a Bike is a Tire and a Car is a Tire, what am I seeing wrong here? Thanks for the helpful video tho, just don't understand this last thing. Exam tomorrow... ahaha
What I’ve never been able to understand tho is how do we know what engine and tyre refers to what car though if they are not stored within the same class? Do I have a common id between classes or should I store the engine and tyre classes as properties of the specific instantiated car object and provide methods from the car object which target thr internal class ?
It depends, if your class relies directly on a specific behavior of an implementation then you need to include that one. For example: A Toyota Camry requires engine X. But sometimes you might even generalize it and say: a Toyota Camry has an engine. The constructor for ToyotaCamryCass only needs to recieve an object of type "engine" and doesn't care which specific engine it is.
Lot of researcher to show they given new concept it is biggest stupidity. Main thing is missing what are problems and to solve what are possible solution then we can say this methodology solve this way . Lot of novice interviewer always ask methodology name rather than saying about challenges and asking solution .
what I hate when coding and there are injected interfaces, it is hard to find which class will be injected when interface is implemented by few classes. I have to debug then - not readable code, I cannot tell just by looking at the code. I see good programmers not using interfaces everywhere so this makes me doubt readlly that this is useful thing to do.
It depends. Using interfaces allows for better code decoupling, easier testability and better maintenance. Having said that, in many cases you end up with code that depends on interfaces where there will "always" be only one implementation, or that it isn't expected to change "almost ever" (i.e. you don't expect a dependency injection framework to dynamically inject other dependencies, don't expect polimorphism). This, tied with the capacity of more recent testing frameworks like Mockito that allows to mock concrete classes, doesn't require to have explicit interfaces. Code complexity by having interfaces shouldn't be greater either, and most modern IDEs (if not all) allow to easily navigate through the interfaces and specific implementations.
@@ADevStory at least PHP storm - if I click on dependency which is injected using intereface, it moves me to interface. And then can navigate to classes implementing the intereface. Ide suggests those classes but it does not know which one is being injected. So I only can find by debugging.
open closed principle - I have seen such in codebase when there is abstaract class and you have to implement methods. But I do not see its benefit. I have needed for example add parameter to the method of child class. So I have to add parameter to parent class so the method definition would be same. At least in php, otherwise you get error. But this parameter is not needed for other child classes, so solution is to have unused parameters in function. Now I think another solution could be to pass some objects implementing some interface and they could have one interface but completely different amount of parameters.
Yeah you are right :) and that's great that you have experienced this. There are different things to take here: - Code is not supposed to be static. It will change overtime. If you notice part of the code that is always changing while other parts are always static, then that dynamic part is candidate for extraction (like you said, with interfaces). So the Open/Closed principle is not so much about "writing once and not touching ever" as it is more about keeping the things that don't change or are common in one place while allowing for extending that behavior elsewhere. - IMO SOLID principles shouldn't be seen in isolation from one another. In this case Open/Close Principle relates a lot with others like Single Responsibility principle. If a class has it's responsibility well defined and is implemented according to that, any extension to the responsibility elsewhere should be done outside that class. And of course, if the responsibility of your class changes (requires new params, calculations changes, etc) then the responsibility of your class must change accordingly. Hope it's clearer :)
Yes, these are hard concepts that takes years to understand... Unfortunatly, it can be understood with experience or some one explainning it face to face...
why single responsiblity is not called like high cohesion principle instead? that would be real name, because single is a lie then, at least from what I see people doing.
Well is not only about cohesion but actual responsibility. If I understand your point correctly in this case a "single responsibility" is a subset of "high cohesion". You could have high cohesion with multiple responsibilities and that's not the purpose of the principle.
@@ADevStory but I never practically see single responsibility. For exmaple most controllers have methods like this: create, update, delete, list. How this is single? 1 create, 2 update, 3 delete, 4 list. For responsibilities.
That part gets philosophical sometimes. You could split each of those operations in different classes too. The important thing is to have the responsibility clearly scoped. For example, if it's UserController: responsible for handling user registration.
So sorry but your explanation is not clear. I can read powerPoint presentations as well. The examples given in this video are not useful. Keep improving.
Hey folks!👋 Want to have hands-on practice on these concepts? 🤓
Try out CodeCrafters.io we have partnered and you can get 40% off 💸with this link: app.codecrafters.io/join?via=DevStory
They have great hands-on tutorials and easy to get up to speed with complex systems. Check them out!
I picked this video to watch not because it's the best, I don't know that, but because it's short. :-)
Nice! Yeah I'm trying to make them fairly short, though I keep failing to make them < 5 minutes AND useful :)
And because is not another annoying Indian accent that makes your brain omelette, so instead of focusing to understand the point you try to slow down the fast bad English accent of the presenter and you are missing the point.
Yes. Too many lectures in this industry
@@johnnyxp64 lol. Loser.
I was trying to find a starting point to digest all this information but kept running into content that over explained and brought in new terms without context. Your vid was the perfect place to begin understanding these new concepts. Great examples and explanations without going too high level. Thank you!
Glad you enjoyed it and thanks for the feedback! Any other topic that you may want to learn about?
I have an interview tomorrow, and I just wanted to quickly revise some of the common topics. This is one of the best video I have found to understand SOLID principles. Thank you for this clear and concise video. 👍
Thank you for the feedback! Glad it was useful and good luck in the interview!
Lot of novice interviewer always ask methodology name rather than saying about challenges and asking solution .
Always ask tell in your challenges and then I give solutions then 90% interviewer has no answer 😂😂😂
This is a great and short on how SOLID principles works. It really helps me understand the basic of it .
Thanks! Glad it was useful!
I would separate the vehicle into automatic vs manual, because there are also automatic combustion vehicles.
Electric cars have a gear box similar to automatic cars, but specialized.
Otherwise, great and concise explanation of the principles :)
I had difficulty with understanding the liskov principle, but you've explained it well and now I get it.
Glad it helped!
Wow, I just understood all this under 7 mins , thanks kind Sir.
Nice! Glad it was useful!
This was short and very easy to understand with the practical examples. Thanks!
Glad you enjoyed it!
preparing for an interview and you made this concept way easier for me,thanks
Glad it was useful! That was part of my idea originally. You can check the playlist for other topics that are common in technical interviews.
And BTW good luck in your interview!
Thank you!!1 I have like 11-12 years of experience but just now I actually understood what SOLID means! Thanks again :D
Amazing! Glad it was useful!
Awesome video for when I need to remind myself of these principles.
Glad it is useful for you!
A good, brief summary, thank you for taking the time to make the video 🙌
Thanks! Glad you liked it!
Wow thank you for this wonderful, im beginner teaching myself it very hard to find clear and concise materials on OOP. ;-)
Glad it was useful!
SOLID programming means abstracting your code, having classes depend on abstractions (like interfaces), and not other classes. The best code is simple and de-coupled, easy to modify without breaking everything, and easy to read.
Single responsibility: Each class should have a single responsibility.
Open/closed: Classes should be built to extend and be closed for modification.
Liskov substitution: Changing instances with sub-types shouldn't break your code.
Interface segregation: Delegate functionality to interface classes. Too many interfaces > too few.
Dependency inversion: High-level classes should rely on abstractions (like interfaces) rather than on lower-level classes. You're inverting their dependency.
Great explanation,🔥
Thanks you! Glad you liked it!
Good video, best and most concise I've seen
Glad to hear that!
Great explanation thank you
Thank you! Glad you enjoyed it!
Very clear and to the point, thank you Christian! 🙏
The examples with the diagrams really made it clear, going to apply these in Python.
Love to see more about these principles and design patterns.
Liked and subscribed ✅
Oh so nice it was useful for you. Will make a few more on design patterns. Thanks!
@@ADevStory🥳I'm looking forward to them, thanks! 😀
I don't think I understand what open closed principle REALLY means... Like how can a class be closed for modification? I think it's talking about using immutable objects and stateless classes, because it's the state of the class that can change. Open for extension on the other hand is saying you should use interfaces to swap out implementations, I don't think using inheritance is a good idea because you're tied to that base class, especially if the class is part of an Api. Basically you should program to interfaces so your implementations can be swapped out for different ones and your existing code doesn't change, new code is added. This is what open closed principle really means. What do you think?
Yeah the principles can be confusing. And the specific naming of the open/closed one it's tricky.
I'd say the main idea is that in case you need to add behavior to a program/class, instead of adding the behavior to the class, make it easier to replace or extend the behavior of it. Not necessarily with inheritance I'd say.
Here's an article that I think explains it very well. medium.com/@alexandre.malavasi/why-is-the-open-closed-principle-so-important-bed2f2a0d4c7
Let me know if it helped :)
Thank you! This has been useful.
Awesome! Thank you! Glad you liked it!
Really well put. Thanks a lot for this.
Thank you! Glad you liked it!
Thank you, I really like the fact that this video was kept small.
Topic was nice....but your explanation was not very clear. I appreciate you tried to explain this hard topic in a concise manner.
Thanks for your feedback! What can I do to make it clearer in the future?
Great explanation, clear examples :)
Thanks! Glad you enjoyed it!
The examples threw me off COMPLETELY because I didn't know that electric cars don't have transmissions.
Sorry for that. On the bright side you now know about cars and object orientation 😅
Great summary bud!
Thank you very much!
Thank You! Helped a lot!
Thank you!
Great video! Congrats, keep rocking!
Thank you mate! :)
another banger! thanks again!
Glad you enjoyed it!
Subbed. Succinct and perfect refresher!
Glad you liked it!
Hi there , I really like these videos as it one of the best videos which explains about lot of important concepts required to be better dev and which is not found in the sea of UA-cam videos … I would also like to know if there are any books that you would recommend for becoming a advanced java programmer starting from the basics ..
you may recommend like for beginner this is best and after that this book is best …
Thanks in advance ! Appreciate your hard work in creating such a quality contents with loads of essential stuffs in them for being a good and better dev … love your videos ! 💕
Oh thanks for the compliments 😀 regarding books on design patterns check out the description. Regarding java beginner java books I would recommend (though I haven't read) Head First Java , and Effective Java (this for all levels and it's quite nice).
Good stuff, thanks for posting.
Thank you for watching! If you feel it can be useful to someone else please share and also if you want me to cover other topics, let me know :)
great explanation, thanks!!!
Applying the Interface principle 4:43 wouldn’t this break the Leskov principle because you can replace vehicle with combustion since it has another method not used?
Nope, because you are specializing the classes. That's perfectly ok. What is not ok (according to Liskov) is if Vehicle has methods that can't be implemented by either Electric or Combustion (for example, shift() method). Hope is clearer :)
1:40 seems like a good way to use a façade pattern, the engine class can be the top level class with the other subclasses underneath,
I'm not sure I follow what you mean. At that time I'm talking about vehicle, engine and tire. Engine can't be a façade for those two 🤔
I wonder on min 5:11 where there is an composition drawn between Vehicle and Tire, shouldn't the owning (filled diamond) be on the Vehicle side?
Wow, thank you so much for sharing the information... Very clear :)
Glad you enjoyed it!
Great content and easy to follow. Can you also make videos on gang of 4 creation design patterns?
I did already :) ua-cam.com/video/aiSAO2AXa9g/v-deo.html
@@ADevStory I saw those also. Very easy to understand. Never knew so many benefits of builder pattern.
Glad you enjoyed them!
Good keep going 👍
It's always so easy with those examples like Cars and Animals, but then in real life projects those principles are extremely hard to use. And almost nobody does, at least in huge projects.
In my experience they are used extensively in any maintainable project. The thing is that it depends a lot on the domain so the examples would be way more specific in that sense. But factories, singletons, decorators, adapters, proxies, and observers are probably some of the most used ones.
On 5:13 these open arrows mean "is-a" right? But then it says on the bottom a Bike is a Tire and a Car is a Tire, what am I seeing wrong here? Thanks for the helpful video tho, just don't understand this last thing. Exam tomorrow... ahaha
Yeah the arrows mean "is-a" and sadly by being lazy the diagram is wrong: I meant a "BikeTire" and a "CarTire" are both tires
What I’ve never been able to understand tho is how do we know what engine and tyre refers to what car though if they are not stored within the same class? Do I have a common id between classes or should I store the engine and tyre classes as properties of the specific instantiated car object and provide methods from the car object which target thr internal class ?
It depends, if your class relies directly on a specific behavior of an implementation then you need to include that one. For example: A Toyota Camry requires engine X. But sometimes you might even generalize it and say: a Toyota Camry has an engine.
The constructor for ToyotaCamryCass only needs to recieve an object of type "engine" and doesn't care which specific engine it is.
Hope it makes sense
Fantastic explanation, just missing code examples, on git.
I can create some and paste them later. I'm intentionally trying not to show code in my videos, and focus more on the concepts.
Lot of researcher to show they given new concept it is biggest stupidity.
Main thing is missing what are problems and to solve what are possible solution then we can say this methodology solve this way .
Lot of novice interviewer always ask methodology name rather than saying about challenges and asking solution .
Good one!
Thanks! :)
thank you so much
You Are very welcome!
Thank you!!!!!
You're welcome! (With Maui's voice) 😁
what I hate when coding and there are injected interfaces, it is hard to find which class will be injected when interface is implemented by few classes. I have to debug then - not readable code, I cannot tell just by looking at the code. I see good programmers not using interfaces everywhere so this makes me doubt readlly that this is useful thing to do.
It depends. Using interfaces allows for better code decoupling, easier testability and better maintenance. Having said that, in many cases you end up with code that depends on interfaces where there will "always" be only one implementation, or that it isn't expected to change "almost ever" (i.e. you don't expect a dependency injection framework to dynamically inject other dependencies, don't expect polimorphism). This, tied with the capacity of more recent testing frameworks like Mockito that allows to mock concrete classes, doesn't require to have explicit interfaces.
Code complexity by having interfaces shouldn't be greater either, and most modern IDEs (if not all) allow to easily navigate through the interfaces and specific implementations.
@@ADevStory at least PHP storm - if I click on dependency which is injected using intereface, it moves me to interface. And then can navigate to classes implementing the intereface. Ide suggests those classes but it does not know which one is being injected. So I only can find by debugging.
Oh I see. I think in that case it's more about how easy is to understand the framework dependency injection configuration than about using interfaces.
open closed principle - I have seen such in codebase when there is abstaract class and you have to implement methods. But I do not see its benefit. I have needed for example add parameter to the method of child class. So I have to add parameter to parent class so the method definition would be same. At least in php, otherwise you get error. But this parameter is not needed for other child classes, so solution is to have unused parameters in function. Now I think another solution could be to pass some objects implementing some interface and they could have one interface but completely different amount of parameters.
Yeah you are right :) and that's great that you have experienced this. There are different things to take here:
- Code is not supposed to be static. It will change overtime. If you notice part of the code that is always changing while other parts are always static, then that dynamic part is candidate for extraction (like you said, with interfaces). So the Open/Closed principle is not so much about "writing once and not touching ever" as it is more about keeping the things that don't change or are common in one place while allowing for extending that behavior elsewhere.
- IMO SOLID principles shouldn't be seen in isolation from one another. In this case Open/Close Principle relates a lot with others like Single Responsibility principle. If a class has it's responsibility well defined and is implemented according to that, any extension to the responsibility elsewhere should be done outside that class. And of course, if the responsibility of your class changes (requires new params, calculations changes, etc) then the responsibility of your class must change accordingly.
Hope it's clearer :)
Dependency inversion seems to be similary with interface segregation
They all relate but are different :)
Thanks
You are welcome!
Nice , please add subtitles
Will add!
I lost everything after the Single responsibility :p lol i must be so stupid
What did you miss? Is it clearer now?
Yes, these are hard concepts that takes years to understand... Unfortunatly, it can be understood with experience or some one explainning it face to face...
@@ADevStory oooooo9oooooooooooooooooooooooooooooooooooooooooOooooooooooooooooooooooooooooo
3:01 Java code inside Visual Studio... LMAO 🤣
Haha you noticed!
Why is that funny?
why single responsiblity is not called like high cohesion principle instead? that would be real name, because single is a lie then, at least from what I see people doing.
Well is not only about cohesion but actual responsibility. If I understand your point correctly in this case a "single responsibility" is a subset of "high cohesion". You could have high cohesion with multiple responsibilities and that's not the purpose of the principle.
@@ADevStory but I never practically see single responsibility. For exmaple most controllers have methods like this: create, update, delete, list. How this is single? 1 create, 2 update, 3 delete, 4 list. For responsibilities.
That part gets philosophical sometimes. You could split each of those operations in different classes too. The important thing is to have the responsibility clearly scoped. For example, if it's UserController: responsible for handling user registration.
gj bro, thanks
TOO BAD
Bro, buy a good mic.
I did! Checkout my newer videos :)
I hate studying for this boring as programming crap
Maa
weird
can't understand your accent
Sorry about that. Did you try the English subtitles?
So sorry but your explanation is not clear. I can read powerPoint presentations as well. The examples given in this video are not useful. Keep improving.
Sorry to hear that. How would it be more useful?