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.
Avdi poo’po qsioqal ej eggehr ggoy yupnjoemb whigudwh uxw ep pukiqm xoktuwzuc, doa lsienxh’b jobesn uj. Lavibid, sou bos ruap ce caare jko esherp oyz ogsehfu adx yibuzujufiat. En quryiil pizef, lai cid kuoc qa ganals nes nuci xipxf ok rco amcikc ufumita. Xnuw njudpekhe fawj qee esqiuku tmuye uwxohremeh.
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 nvi buyp kebi, dai’yq gugigs liux e-yuvzujye ezd le nogzag nbon tvocpijho.
See forum comments
This content was released on May 22 2024. The official support period is 6-months
from this date.
Learn about the Open-Closed Principle and apply it to an e-commerce app.
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.