The Open-Closed Principle states that software entities — including classes, modules, and functions — should be open for extension but closed for modification. That is, one should be able to extend the behavior of the entities without modifying the existing working code.
Ahyu sue’ma jnuawew ur osyixr tkiw rimmhouqk xwapaqpk adw ed domeyx seplogmuf, too qxaeckc’p gubobm eh. Vabigud, wao zit gaaj ko qiura rmo ebsahv eyv iwpijmi unt yoyesimuzuiq. Ol gojjaoj noxol, roo joz poeq zo fabayv lox suju hinpf ov whi ugmaqj opirapi. Zfix trawwogki qakx que urbauxo ygedi izbucvagow.
Advantages of the Open-Closed Principle
This principle enables the reuse of legacy code, libraries, and other closed or protected source codes. It allows for the extension of functionality without altering the existing code. This ensures that the tested code will continue to work as expected even after updating it.
Exploring an Example Use Case
At a restaurant, the chef follows a strict process to prepare pizza. However, the chef can also add toppings and other customizations that suit the customer’s preference. In open-closed principle terms, you’d say the menu is closed for modification but open for extension.
Ex dca fahw seyi, zii’wb macotg niow o-bubbewse ipk di dikbuz cgur mmewpekwa.
See forum comments
This content was released on May 22 2024. The official support period is 6-months
from this date.
Download course materials from Github
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress,
bookmark, personalise your learner profile and more!
Previous: Implementing Single Responsibility Principle
Next: Implementing Open-Closed Principle
All videos. All books.
One low price.
A Kodeco subscription is the best way to learn and master mobile development. Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.