ICS 121: Style guides and analysis tools
Overview
- What are style guides?
- What are source code style analsyis tools?
What are style guides?
- Style guides are structured English documents that help the
development team catch common errors and work together with less
conflict.
- Style guides can be applied to many software development artifacts:
- Consistent coding style makes it easier for any developer
on a team to edit any code.
- Makes developers more sure of variable and method names:
size(), getSize(), get_size(), iGetSize(), sGetSize()
- Consistent indentation and expression spacing help make the
code look the same to all developers
- Consistency helps avoid apparent differences between versions
of source code. E.g., I changed one if-statement condition, but I
also re-indented the entire program, can you understand my change
in the version control log?
What are source code style analsyis tools?
- A source code style analyzer is a tool that reads source code and
checks whether it follows the coding style guidelines.
- Usually highly configurable to fit each team's style
- Produces a report of the lines that violate the style.
- Examples: Checkstyle, JLint (does more than just style)
What are source code formatters?
- A source code formatter is a tool that reads source code and
outputs the same source code with consistent indentation and
spacing.
- Usually highly configurable to fit each team's style
- Works well, so long as everyone is using the same tool.
- Many IDEs have this function built-in.
- Examples: jalopy,
Tidy, GNU
indent
sample use case templateexample test plan templateProject plan template