rico
rico

Reputation: 61

What is the name of a method whose output is only dependent of input and the state of the object?

I know the term "pure function" that describes a function whose output is only dependent on the input.

Is there a similar name for a method (function of an object) whose output is dependent only of the input and the state of the object?

Upvotes: 3

Views: 167

Answers (2)

fredoverflow
fredoverflow

Reputation: 263220

Bertrand Meyer, inventor of the Eiffel programming language and author of the book Object-oriented software construction, calls them "query methods".

Upvotes: 1

dantuch
dantuch

Reputation: 9293

I would call it state-dependent method

depending on State (design-pattern) instance of object is in, you get different result (not only output) or extension

Upvotes: 0

Related Questions