Comment

Comment by joshd

"I use method_missing()to remove duplication ... On the other hand, I usually think twice about using method_missing() for cosmetic reasons, like getting cool method names such as find_by_name_and_address()."

That seems backwards to me. I use magic methods to define methods that can only be defined at run time, like his example of creating methods based on schema introspection.

Using magic methods breaks a lot of tools: IDE code completion, reflection, documentation generation so I always explicitly define methods unless it's not possible.

parent joshd 16 years ago

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton