It is always helpful when a tool encourages you to write ‘good code’. Eclipse has some excellent plugins like PMD and FindBugs for analysing and improving your code. But did you know that Eclipse actually has some useful built-in tools to help you?
I found a useful feature of eclipse, to help me clean up my code before I test or commit any of it.
If you go to ‘Window’ -> ‘Preferences’
I’m sure you have been in here before,
But now go to ‘Java -> ‘Compiler’ -> ‘Errors/Warnings’
Now there are lots of useful clean code building features you can edit.
I use the Unused imports and local variables unread, as many times writing new code you add variables that you later end up not needing. This is a good way to highlight them to you. You can also set the options to show a warning or fail – so that your code will not compile and Eclipse will show an error. You will then have to actually fix the issue then and there.
It also allows you to turn all those annoying warnings off so that you can see the errors in the right side bar of your code display window (those blue and yellow, and sometimes red, square markers).
If you turn them all on, you will probably see loads of errors or warnings. So if you are new, a good strategy is to turn them on individually over a period of time and deal with the issues over a period of time. This also lets you test your changes gradually and reduces the chances of breaking something. It is a good end of day 15 minute task.
Do you have any favourite features that help you in developing your code?
Did you know...
IDRsolutions offers a whole range of online file converters to convert PDF and Microsoft Excel, Word and Office Documents to HTML5, SVG or image formats?
It is free to use for single file conversions and also includes Developer links if you want to use our commercial software for bulk conversions. Find out more on this page