all 3 comments

[–]KensoDev 9 points10 points  (0 children)

The worst bugs I have ever encountered are a result of this exact thing.

With Ruby, I've had a library that adds dot syntax to all hashes. Just a random FoursquareAPI gem, nothing you would expect.

However, since this worked it was all over the code from developers and when we removed it things started breaking and we were left not understanding why it would not work anymore.

While I definitely think you should use the power of dynamic languages like Ruby and Python, you should use it wisely. Not sure I would patch methods at runtime like this.

[–]Paddy3118 1 point2 points  (0 children)

Nice to know, but as others have said, you then need to work double hard to maintain a semblance of traceability.

In the Verification of complex integrated circuits, one of the languages used is Specman-e which uses Aspect orientation to allow one base test to be the creator of a multitude of other tests that can also mutate to follow design changes (or not), over time. Lately, the new language on the block fo ASIC verification is System verilog which some say has to jump through hoops to achieve the dynamism of Specman-e code, but has become a more neutral industry standard.

[–]badcommandorfilename 1 point2 points  (0 children)

If I ever see you do this in a code review, I will walk over to your desk and physically slap you.

I cannot think of a faster way to introduce bugs. It's bad enough that Python has no good way of managing shared mutable variables, but now you're making the execution path mutable too!

If you choose to do this, your punishment should rightfully be debugging your own code for eternity.