(no title)
cattown | 2 years ago
I'm sure there are rare cases where these techniques are useful. Like creating developer tools or making your own object persistence layer or winning a code golf contest. But if you're an app developer for goodness sake just write a few extra lines of code. Do whatever it is you're doing the verbose and clear way, not the slightly shorter and super obtuse way.
Stuffing method definitions into classes at runtime, monkey patching, dynamically generating method calls with .send. These will all be very puzzling for any future developer that works on your code, senior or junior. And come with bunches of technical pitfalls. Writing clear and maintainable code is a higher calling for us than reducing LOC and showcasing neat tricks. Even if you call yourself a Rubyist. Speaking from experience.
unknown|2 years ago
[deleted]
goatlover|2 years ago
lacrimacida|2 years ago
KerrAvon|2 years ago
sho|2 years ago
"Your honey, I admit to killing him, and I'm sorry, but in my defense, he monkey patched a core method"
"Case dismissed!"