Code quality is one of the most important criteria for assessment and development of a software engineer. To be able to improve, it’s important to follow clear guidelines on how to improve our coding, specifically in:
- Code Reuse
- Naming
- Methods
- Comments
- QA
I. Code Reuse
Good:
– Loose coupling
– Generic
– Modular
– Simple
– Easy to use
Poor:
– Tightly coupled
– Complex
– Verbose
– Redundant code
II. Naming
Good:
– Self documenting
– Consistent
– Explains what the method does
– Unambiguous
Poor:
– Inconsistent
– Inaccurate
– Does not explain the method
– Ambiguous
III. Methods
Good:
– Naming – Name clearly explains what the method does
– Short – No more than 40 lines for most
– Simple
– SRP – Does one specific task
Poor:
– Poor naming
– Long
– Complex
– Does too much – One large logical block that performs multiple operations, could be easily broken to smaller reusable methods
IV. Comments
Good:
– Short
– Explains why
– Sparse only explains complex logic that is not self evident
– Accurate
Poor:
– Verbose
– Duplicates explaining what is already self evident in code
– Too much commenting breaking code readability
– Inaccurate
– Redundant comments
V. QA
Good:
– Clearly identifies cause of issue
– Able to replicate and verify fix
– Thourough testing in development, especially obvious use and edge cases
– Short QA <-> Dev cycle, 2-3 passes
Poor:
– Does not identify cause of issue
– Unable to account for fix
– Insufficient testing in development, does not test edge cases
– Caught up in long periods of QA <-> Dev cycles, 4+ passes