concept

Method Missing

Method Missing is a dynamic programming concept in object-oriented languages where a class can intercept and handle calls to undefined methods at runtime. It allows developers to define custom behavior when a non-existent method is invoked, often used for implementing flexible APIs, proxies, or domain-specific languages. This feature is commonly found in languages like Ruby, Python, and Smalltalk, enabling metaprogramming and runtime method resolution.

Also known as: method_missing, method-missing, __getattr__, no such method, undefined method handler
🧊Why learn Method Missing?

Developers should learn Method Missing when building dynamic systems that require flexible method handling, such as creating DSLs (Domain-Specific Languages), implementing proxy objects, or handling unknown API calls gracefully. It's particularly useful in Ruby for ActiveRecord's dynamic finders or in Python for attribute access hooks, allowing code to adapt to varying inputs without predefining every method.

Compare Method Missing

Learning Resources

Related Tools

Alternatives to Method Missing