Wednesday, June 8, 2016

Some best use cases for Android UserManager.isUserAGoat()?

This appears to be an inside joke at Google. It's also featured in the Google Chrome task manager. It has no purpose, other than some engineers finding it amusing. Which is a purpose by itself, if you will.
  1. In Chrome, open the Task Manager with Shift+Esc.
  2. Right click to add the Goats Teleported column.
  3. Wonder.
There is even a huge Chromium bug report about too many teleported goats.
chrome
The following Chromium source code snippet is stolen from the HN comments.
int TaskManagerModel::GetGoatsTeleported(int index) const {
  int seed = goat_salt_ * (index + 1);
  return (seed >> 16) & 255;
}

#############################################################

Complementing the @djechlin answer (good answer by the way!), this function call could be alsoused as dummy code to hold a breakpoint in an IDE when you want to stop in some specific iteration or a particular recursive call, for example:
enter image description here
isUserAGoat() could be used instead of a dummy variable declaration that will be shown in the IDE as a warning and, in Eclipse particular case, will clog the breakpoint mark, making it difficult to enable/disable it. If the method is used as a convention, all the invocations could be later filtered by some script (during commit phase maybe?).
enter image description here
Google guys are heavy Eclipse users (they provide several of their projects as Eclipse plugins: Android SDK, GAE, etc), so the @djechlin answer and this complementary answer make a lot of sense (at least for me).

No comments:

Post a Comment