Topic: Inspector ?? Mutator ?? - Definition


Author: qhsmiwi@aom.ericsson.se (Mike Wilson)
Date: 3 Dec 1994 16:27:45 GMT
Raw View
In article E0K@lcpd2.SanDiegoCA.NCR.COM, swf@elsegundoca.ncr.com (Stan Friesen) writes:
>In article <3art8b$b4@pavan.india.hp.com>, uday@india.hp.com (Udayan) writes:
>|> ==============================================================================
>|>  Q: What is an `inspector'?  What is a `mutator'?
>|> ==============================================================================
>An inspector is a method that reads a value from an instance of a class.
>A mutator is a method that changes a value in an instance of a class.

[Not mentioned in the question, but anyway...]
Some people say `accessor' instead of `inspector'.

---
Mike

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 "The future, as we recall it, has ceased to exist."







Author: uday@india.hp.com (Udayan)
Date: 22 Nov 1994 04:49:15 GMT
Raw View
Hi Everybody,
             This is a question from me and my friend Ms Manjula Latha

             We have picked up the following question from a C++ FAQ.

   The question listed below was of particular interest .
   We  were not able to get to the point !!
   The question and the answer is repeated below.
==============================================================================
 Q: What is an `inspector'?  What is a `mutator'?
 A: We did get the answer ,
 An inspector inspects and a mutator mutates.  These different categories of
 member fns are distinguished by whether the member fn is `const' or not.

==============================================================================

 The doubts we have at this point are :

 1. What are the definition of these terms ?
 2. When and What does the inspector inspect and mutator mutate?
    Please give Specific instance of usage in the  application ?
 3. Are these terms specific to any OO Language or
     Is it a sort of jargon that we already know ???

==============================================================================


  Any replies will be much appreciated.

  Thanking you in anticipation

  Cordially
  Udayan           ----------     uday@india.hp.com





Author: swf@elsegundoca.ncr.com (Stan Friesen)
Date: Tue, 22 Nov 1994 18:11:41 GMT
Raw View
In article <3art8b$b4@pavan.india.hp.com>, uday@india.hp.com (Udayan) writes:
|> ==============================================================================
|>  Q: What is an `inspector'?  What is a `mutator'?
|> ==============================================================================
|>
|>  The doubts we have at this point are :
|>
|>  1. What are the definition of these terms ?

An inspector is a method that reads a value from an instance of a class.

A mutator is a method that changes a value in an instance of a class.

The basic idea behind this terminology is too make a design seperation
between these two categories of method - with no method doing both.
That is it is held to be "bad" for a method to be *both* an inspector
and a mutator.

|>  2. When and What does the inspector inspect and mutator mutate?

They act when a meessage requesting the action is recieved.

|>     Please give Specific instance of usage in the  application ?

Basically any read-only member function in C++ is an inspector,
and any member function that modifies any data members is a mutator.

|>  3. Are these terms specific to any OO Language or
|>      Is it a sort of jargon that we already know ???
|>
I think the jargon may have originated in the Smalltalk community,
but it is not really specific to any particular language.

--
swf@elsegundoca.ncr.com  sarima@netcom.com

The peace of God be with you.