Three Approaches to Achieve OCP
- Parameters (Procedural Programming)
- Inheritance / Template Method Pattern
- Composition / Strategy Pattern
Allow client to control behavior specifics via a parameter
Combined with delegates/lambad, can be very powerful approach
2. Inheritance / Template Method Pattern
Child types override behavior of a base class (or interface)
3. Composition / Strategy Pattern
Client code depends on abstraction
Provides a "plug in" model
Implementations utilize inheritance; Client utilizes Composition
Read the blog:
http://code.tutsplus.com/tutorials/solid-part-2-the-openclosed-principle--net-36600
http://www.objectmentor.com/resources/articles/ocp.pdf
http://stackoverflow.com/questions/59016/the-open-closed-principle
A friend told me that he subscribes
https://www.pluralsight.com/
So, Julia subscribed code school first starting this Dec. 2015, and later pluralsight.com. Two schools are different.
Video watch:
https://www.youtube.com/watch?v=MvyG_ODng3w
Code School Live: JavaScript Best Practices Q&A
https://www.youtube.com/watch?v=k9xwJoprEMYPrinciples of Object Oriented Design (2 - The Open-Closed Principle) 28 minutes
https://www.youtube.com/watch?v=qP6MroshYvM&index=8&list=PLD4GnSXHpkQ2_eKG5fKzszXs5hYcEsft7I Learned HTML and CSS, Now What?
http://blog.codeschool.io/2014/09/30/learned-html-css-now/http://support.pluralsight.com/knowledgebase/articles/491274-what-s-offered-at-code-school-vs-pluralsight
No comments:
Post a Comment