Please enable JavaScript.
Coggle requires JavaScript to display documents.
Clean Code (Prepare for the Real World (Use Static Code Analysis Tools
…
Clean Code
- Prepare for the Real World
-
- Avoid Unnecessary Comparisons
- Avoid Negations
- Return Boolean Expressions Directly
- Simplify Boolean Expressions
- Avoid NullPointerException in Conditionals
- Avoid Switch Fallthrough
- Always use braces
- Ensure Code Symmetry
- Replace Magic Number with Constant
- Favour Enums Over Integer Constants
- Favour For each over for Loops
- Avoid Collection Modification During Iteration
- Group with New Lines
- Favour Format Over Concatenation
- Favor Java API over DIY
- Replace comments with Constants
- Replace comments with Utility Methods
- Document Implementation Decisions
- Document Using Examples
- JavaDoc for Packages
- JavaDoc for Classes and Interfaces
- JavaDoc for Methods
- Avoid Single Letters
- Avoid Abbreviations
- Avoid Meaningless Terms
- Use Domain Terminology
- Fail Fast
- Always Catch Most Specific Exception
- Explain Cause in Message
- Avoid Breaking the cause chain
- Explain Empty Catch
- Structure Tests Into Given-When-Then
- Use Meaningful Assertions
- Expected Before Actual Value
- Describe your Tests
- Favor Standalone Tests
- Parametrize your Tests
- Cover the Edge Cases
- Split Methods with Boolean Parameters
- Avoid Returning Null
-
- Start Cleaning UP
- Level Up your Code Style
- Comments
- Naming Conventions
- Prepare for Failures
- Unit Testing
- Design Your Methods
- Prepare for Real World
- Simplifying Loops and Logic
- Breaking Down Giant Expressions
- Explaining Variables
- Summary Variables
- Breaking Down Giant Statements
- Returning Early from a Function
- Order of if/else
- The Order of Arguments in Conditionals
- Shrink the Scope of Your Variables
- Eliminating Variables
- Eliminating Control Flow Variables
- Fail Fast