Created
July 5, 2016 10:55
-
-
Save tkfx/cc74e99e42886c87589ed186bdad7dcf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Bad. | |
| // - Line breaks are arbitrary. | |
| // - Scanning the code makes it difficult to piece the message together. | |
| throw new IllegalStateException("Failed to process request" + request.getId() | |
| + " for user " + user.getId() + " query: '" + query.getText() | |
| + "'"); | |
| // Good. | |
| // - Each component of the message is separate and self-contained. | |
| // - Adding or removing a component of the message requires minimal reformatting. | |
| throw new IllegalStateException("Failed to process" | |
| + " request " + request.getId() | |
| + " for user " + user.getId() | |
| + " query: '" + query.getText() + "'"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment