CS 212 Software Development

CS 212-01 • Spring 2020

COVID-19 Notice

Due to the COVID-19 outbreak, this website is being retired effective March 15, 2020. All future updates will be moved to Canvas for online instruction as advised by the university.

Configuring Eclipse

Eclipse is a free, powerful, open-source, and configurable IDE. I recommend you spend some time configuring Eclipse to meet your needs.

Compiler Configuration

The project code may not have warnings, including Javadoc warnings, when running the project script on the lab computers. If you want your Eclipse to have similar compiler settings, import this configuration into your Eclipse workspace:

https://gist.github.com/sjengle/c7d572a4d0eaf0be618f95d761d49a08

Note that it is not exactly the same—the project script uses javac and Eclipse uses its own built-in Java compiler instead.

Javadoc Configuration

Your code should have proper Javadoc comments for all members and methods before requesting a code review. To receive warnings when you are missing something (or something is out of date) with your Javadoc comments, use these settings:

Javadoc

Code Formatting

Your code should always be consistently formatted, especially before requesting a code review. The exact style you adopt is up to you. The official Java code conventions are at:

However, these conventions are no longer maintained and major features have been introduced to Java since these were last updated. For a more modern guide, see:

I will use the Google style guide for all lecture code, as well as the homework and project templates. If you also want to use this code style, you can download the Eclipse settings and import them.

Otherwise, you can customize the formatter to your own preferences. you can use these settings to change the brace style, where newlines and spaces are used, and fix how Eclipse formats try-with-resources code blocks. For example:

Java Code Formatter

You can further customize Eclipse to re-format your code every time you save. See below for details.

Other Customization (Optional)

I recommend you customize other features in Eclipse as well. For example:

  • Change the fonts used in the editor (reference). You can find several options on Google Fonts. My favorites are Source Code Pro Light, Roboto Mono Light, Anonymous Pro, and Incosolata. There are many fans of the customizable Input font as well.

    Colors and Fonts

  • Change your save actions (reference). I usually remove unused imports and fix indentation at least.

    Save Actions

  • Customize the autocomplete code templates (reference, examples). I usually create one for printf myself. You can download the templates I use and import them into your Eclipse workspace:

  • Change the layout and add different views. I usually add the Tasks view, which shows me all of my TODO comments. I also prefer to add the Git views to my Java perspective rather than switching to the Git perspective.

    Views

  • Customize the visibility of whitespaces in the text editor (reference). This can be helpful to detect when a mix of tabs and spaces are used for indentation.

    Whitespace

  • Change how content assist works for the Java editor (reference). If you find Eclipse inserting code automatically when you do NOT want it to, you might consider changing the “Disable insertion triggers” setting:

    Content Assist

The official guides for Eclipse are located at:

Keep in mind that Eclipse is under active development, and bugs happen.

Try to close projects in Eclipse when you are no longer working on them. This can improve performance.