News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Freek Lijten's Blog:
SOLID - The O is for Open Closed Principle
May 07, 2012 @ 10:45:37

Freek Lijten has posted the second part of his series looking at the SOLID development methodology. In this latest post his looks at the second letter in the acronym - "O" for "Open Closed Principle."

Software that requires an enormous amount of changes to implement one new feature or fix a bug is unstable and should be considered as "bad". Software should be designed so, that in case of a new feature, no existing classes should have to change. In other words: it is closed for modification. Existing software may be extended to achieve new features however.

He starts off with a "What" section explaining a bit more about what this open/closed means for your code and gets into an example showing it in a more practical way. He shows how to take the principle and refactor an API connector class to pass in the object it needs (Bike) and use that to get information (rather than just passing in the data). He uses a Factory to get the object type he needs based on the Bike type.

0 comments voice your opinion now!
solid development principles open closed principle


blog comments powered by Disqus

Similar Posts

Sara Goleman's Blog: A yodeler falls silent. (Andrei Zmievski's Move from Yahoo)

Brandon Savage's Blog: Why Great Development Tools Donít Seem To Be Written In PHP

Bogdan Albei's Blog: Create your perfect virtualised PHP development environment

Qandidate.com Blog: How we manage our development process at Qandidate.com

NetTuts.com: SOLID: Part 1 - The Single Responsibility Principle


Community Events





Don't see your event here?
Let us know!


symfony library deployment list release package framework language interview tips api laravel podcast bugfix community introduction opinion install series voicesoftheelephpant

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework