jeudi 2 mars 2017

A factory is a class that **creates** instances of another class. What is a class that **modifies** instances of another class?

A factory is a class that creates instances of another class. What is a class that modifies instances of another class?

For example a factory can look like this:

interface PenFactory {
    Pen createPen(Ink ink);
}

I have a class that looks like this:

   interface PenWhatToNameThis {
       Pen refillInk(Pen pen);
   }

Does this kind of class have a name similar to factory? I am considering something like mutator or modifier.


Further optional info

I am using these two classes for testing where I need to create and sometimes modify Pens. I could merge both classes into a single class called PenUtils but I like to be able to group all of my Pen creation methods together.

Aucun commentaire:

Enregistrer un commentaire