Note that there are some explanatory texts on larger screens.

plurals
  1. POMonkey-patching Vs. S.O.L.I.D. principles?
    primarykey
    data
    text
    <p>I'm slowly moving from PHP5 to Python on some personal projects, and I'm currently loving the experience. Before choosing to go down the Python route I looked at Ruby. What I did notice from the ruby community was that monkey-patching was both common and highly-regarded. I also came across a <strong>lot</strong> of horror stories regarding the trials of debugging ruby s/w because someone included a relatively harmless library to do a little job but which patched some heavily used core object without telling anyone. </p> <p>I chose Python for (among other reasons) its cleaner syntax and the fact that it could do everything Ruby can. Python is making OO click much better than PHP ever has, and I'm reading more and more on OO principles to enhance this better understanding.</p> <p>This evening I've been reading about <a href="http://butunclebob.com/ArticleS.UncleBob.PrinciplesOfOod" rel="nofollow noreferrer">Robert Martin's SOLID</a> principles:</p> <ul> <li><strong>S</strong>ingle responsibility principle,</li> <li><strong>O</strong>pen/closed principle,</li> <li><strong>L</strong>iskov substitution principle,</li> <li><strong>I</strong>nterface segregation principle, and</li> <li><strong>D</strong>ependency inversion principle</li> </ul> <p>I'm currently up to <strong>O</strong>: <em>SOFTWARE ENTITIES (CLASSES, MODULES, FUNCTIONS, ETC.) SHOULD BE OPEN FOR EXTENSION, BUT CLOSED FOR MODIFICATION</em>. </p> <p>My head's in a spin over the conflict between ensuring consistency in OO design and the whole monkey-patching thing. I understand that its possible to do monkey-patching in Python. I also understand that being "pythonic" is to follow common, well-tested, oop best-practices &amp; principles.</p> <p><strong>What I'd like to know is the community's opinion on the two opposing subjects;</strong> how they interoperate, when its best to use one over the other, whether the monkey-patching should be done at all... hopefully you can provide a resolution to the matter for me.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload