ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

What is OCP (Open Close Principle)? and how is it useful in software design?

Let Learn some basic concepts used in software design and development.

user-image
تم إضافة السؤال من قبل Mohammed Rizwan Afgani , Software Engineer, Team Lead , Prosoft e-Solutions (I) Pvt Ltd
تاريخ النشر: 2013/07/03
مستخدم محذوف‎
من قبل مستخدم محذوف‎

Open/Closed OOP Design Principle is one of the5 basic principles of OOP and Design presented in SOLID.
It implies that software entities such as Classes, Modules and Functions should be open for extension, but closed for modification.
e.g.
You can extend a class to add extra functionality, but without modifying the existing code.
I highly recommend reading the book "Head First - Design Patterns"

Zaid Rabab'a
من قبل Zaid Rabab'a , Technical Team Lead , ESKADENIA Software

The Open Close Principle is design and writing of the code should be done in a way that new functionality should be added with minimum changes in the existing code.
The design should be done in a way to allow the adding of new functionality as new classes, keeping as much as possible existing code unchanged.
The name Open/Closed Principle has been used in two ways.
Both ways use inheritance to resolve the apparent dilemma, but the goals, techniques, and results are different.

Farhad Bheekoo
من قبل Farhad Bheekoo , Senior Solution Architect , Woolworths NZ

This is the 'O' in 'S.O.L.I.D' principles .
It suggests that a class should only be Open for extension and Closed for modification.
This implies that when adding functionality to a class, that new functionaity should be added seamlessly without breaking or having to rewrite the class, in theory at least.
That being said, take a look at this article written by Jon Skeet - author of 'C# In Depth' - http://msmvps.com/blogs/jon_skeet/archive/2013/03/15/the-open-closed-principle-in-review.aspx

karim kamel
من قبل karim kamel , Developer Support Engineer , Microsoft

The Open Close Principle is design and writing of the code should be done in a way that new functionality should be added with minimum changes in the existing code.

المزيد من الأسئلة المماثلة