Skip to content

Instantly share code, notes, and snippets.

@MinCha
Created February 14, 2014 02:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MinCha/8995058 to your computer and use it in GitHub Desktop.
Save MinCha/8995058 to your computer and use it in GitHub Desktop.
Tell, Don`t Ask #2
public class ReadOnlyNotifier {
private List<String> getRelatedServices() {
//
}
public void notifyToRelatedServicesIfItNeeds(StopMessage stopMessage) {
if (getRelatedServices().size() > 0) {
if (notifyToRelatedServices(stopMessage) == false) {
throw new FailedReadOnlyNotificationException();
}
}
}
}
readOnlyNotifier.notifyToRelatedServicesIfItNeeds(stopMessage);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment