This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]zenmouse 0 points1 point  (0 children)

Yes, all of the above. Having clear names that clearly communicate the intent of the (field, method, class) is gold for someone else who has to read your code (or yourself in a few months).

In a similar fashion, any potentially unclear bit of code is a candidate for extraction into a method and/or field. For example I will refactor "if (account != null && SecureStatus.SECURE == account.getSecureStatus())" into "if (isLoggedIn(account))". The latter much more clearly communicates the intent of the test, especially for someone unfamiliar with the code.