Episode 2 of the free Java Clean Code Training Series.
In this tutorial I show you how to download and install the static analysis tool FindBugs and run it against your Java Programs in Eclipse or Spring Tool Suite.
Findbugs looks for and identifies bugs in Java Programs. It is based on the concept of bug patterns. A bug pattern is a code idiom that is often an error. Findbugs will search for over 200 bug patterns in your code.
Bug patterns arise for a variety of reasons:
- Difficult language features
- Misunderstood API methods
- Misunderstood invariants when code is modified during maintenance
- Garden variety mistakes: typos, use of the wrong boolean operator, dead code etc
FindBugs uses static analysis to inspect Java bytecode for occurrences of bug patterns. Static analysis means that FindBugs can find bugs by simply inspecting a program's code: executing the program is not necessary. This makes FindBugs very easy to use: in general, you should be able to use it to look for bugs in your code within a few minutes of downloading it.
Running findbugs will certainly help you write cleaner code by helping to identify bugs, typos, dead code or simple generic coding mistakes.
I treat static analysis tools as first class citizens and always execute on my code, regardless if its fun home code or serious production code.
Why clean code?
Simple. Clean code allows us to confidently make changes and deliver more features quickly to our customers.
Don’t forget to subscribe for your regular dose of Java Tutorials!
STOP THE ROT.
See you in episode 3,
Philip
[ Ссылка ]
Ещё видео!