In preparation for a series of posts I’m about to do on Android Activities, I want to do a brief post on a recent standardization I’ve decided on. When doing user interfaces, there’s two things that I’m always doing: some initial configuration of elements (such as setting the color or font of a label) and then maybe multiple times changing the state of an element (such as setting the actual label text).
So from now on, I’m naming these:
_configureXYZ– a function / method for the one-time setup of an XYZ._updateXYZ– a function / method for changing the state of an XYZ, with the expectation this is going to be called multiple times.
Note that I don’t write one-function per UI element. It’s more like _updateButtons, _updateMaps, etc.
Note the underscore. Whenever I write a function that’s intended only for the use of the current object, I prefix with “_“.