Skip to content
aipatterns.dev

Category

Simplifying Method Calls

Techniques that clean up method signatures, names, parameters and error signaling so interfaces are hard to call incorrectly.

What these techniques solve

A method's signature is its contract with every caller. Unclear names, long or redundant parameter lists, methods that both return a value and change state, setters on objects that should be fixed, and error codes returned as numbers all invite misuse of that contract. These techniques change the interface rather than the body.

Signature changes touch every caller. Find them all first, and keep the old signature as a forwarding wrapper until the last one is migrated if the method is public.

Members

How to choose within this category

In this category

See also

Original writing and examples. Topic coverage follows Refactoring.Guru, which explains this topic with its own illustrations.