Student Reviews
( 5 Of 5 )
1 review
Video of Open Closed Principle in SOLID Principles course by kudvenkat channel, video No. 4 free certified online
In this video we will learn
1. Open Closed Principle
2. Implementation guidelines of Open closed Principle
3. And will implement this Principle with a simple example
Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help.
https://www.youtube.com/channel/UC7sEwIXM_YfAMyonQCrGfWA/?sub_confirmation1
In the first video of SOLID Introduction we have understood that O in the SOLID is acronym for “Open/Closed Principle” also known as OCP
Definition: In object-oriented programming, the open/closed principle states that "software entities such as classes, modules, functions, etc. should be open for extension, but closed for modification"
1. Which means, any new functionality should be implemented by adding new classes, attributes and methods, instead of changing the current ones or existing ones.
2. Bertrand Meyer is generally credited for having originated the term open/closed principle and This Principle is considered by Bob Martin as “the most important principle of object-oriented design”.
Implementation guidelines
1. The simplest way to apply OCP is to implement the new functionality on new derived (sub) classes that inherit the original class implementation.
2. Another way is to allow client to access the original class with an abstract interface,
3. So, at any given point of time when there is a requirement change instead of touching the existing functionality it’s always suggested to create new classes and leave the original implementation untouched.
Pit falls of Not following OCP
What if I do not follow Open closed principle during a requirement enhancement in the development process.
In that case, we end up with the following disadvantages
1. If a class or a function always allows the addition of new logic, as a developer we end up testing the entire functionality along with the requirement.
2. Also, as a developer we need to ensure to communicate the scope of the changes to the Quality Assurance team in advance so that they can gear up for enhanced regression testing along with the feature testing.
3. Step 2 above is a costly process to adapt for any organization
4. Not following the Open Closed Principle breaks the SRP since the class or function might end up doing multiple tasks.
5. Also, if the changes are implemented on the same class, Maintenance of the class becomes difficult since the code of the class increases by thousands of unorganized lines.
Hope the above counter facts helps in understanding on why we need to follow the open closed principle.
You can find the code used in the demo at the following link
http://csharp-video-tutorials.blogspot.com/2018/01/open-closed-principle.html
Also, we strongly recommend you to refer to our design pattern tutorial for more details on creational design patterns
I believe this session has given you a good idea on how we can implement Open closed principle.
In the next session we will focus on Liskov substitution principle. Till then, thank you and have a great day
Text version of the video
http://csharp-video-tutorials.blogspot.com/2018/01/open-closed-principle.html
Slides
http://csharp-video-tutorials.blogspot.com/2018/01/open-closed-principle-slides.html
SOLID Design Principles Tutorial
https://www.youtube.com/watch?vHLFbeC78YlU&listPL6n9fhu94yhXjG1w2blMXUzyDrZ_eyOme
SOLID Design Principles Text Articles & Slides
http://csharp-video-tutorials.blogspot.com/2018/01/solid-design-principles.html
All Dot Net and SQL Server Tutorials in English
https://www.youtube.com/user/kudvenkat/playlists?view1&sortdd
All Dot Net and SQL Server Tutorials in Arabic
https://www.youtube.com/c/KudvenkatArabic/playlists