|
|
|
|
|
by lacampbell
3536 days ago
|
|
It would probably look exactly like setName(newName). For me a better question is - why is the name being changed?
What high level goal are you trying to accomplish that truly needs you to to directly mutate internal fields, after the object has already been created? Could the object - or system of objects - have been designed with a higher level interface, so that the outside world didn't have to concern itself with such things? |
|
Consider a trivial to-do list. You can click on the 'completed' checkbox. So the 'completed' field has chaged.
Or, you can say ooops I mistyped the label. So you change the label.
Is there anything wrong with that?