Skip to content

Commit

Permalink
Add comments for the Java analyzer
Browse files Browse the repository at this point in the history
  • Loading branch information
sanderploegsma committed Jan 19, 2024
1 parent 58d4c59 commit 9d970d7
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
13 changes: 13 additions & 0 deletions analyzer-comments/java/general/avoid_print_statements.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# avoid print statements

Try removing statements such as `System.out.println()` from your code.
Exercise tests require the solution to _return_ values from methods instead of printing them.

Usually, statements like these are added to help debug the code.
However, a better approach is to debug the code while running one or more unit tests.
This has the added advantage that one can focus on debugging a specific test case.

Here are some links that explain how to debug Java code while running unit tests in various IDEs:

- [Running and debugging Java tests in Visual Studio Code](https://code.visualstudio.com/docs/java/java-testing#_rundebug-test-cases)
- [Debugging tests in IntelliJ IDEA](https://www.jetbrains.com/help/idea/performing-tests.html#RedebugFailedTests)
13 changes: 13 additions & 0 deletions analyzer-comments/java/general/do_not_use_main_method.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# do not use main method

Try removing the `main` method from your code.
Exercise tests don't require solutions to have a `main` method and having one makes the code slightly harder to read.

Usually, a `main` method is added to help debug the code.
However, a better approach is to debug the code while running one or more unit tests.
This has the added advantage that one can focus on debugging a specific test case.

Here are some links that explain how to debug Java code while running unit tests in various IDEs:

- [Running and debugging Java tests in Visual Studio Code](https://code.visualstudio.com/docs/java/java-testing#_rundebug-test-cases)
- [Debugging tests in IntelliJ IDEA](https://www.jetbrains.com/help/idea/performing-tests.html#RedebugFailedTests)

0 comments on commit 9d970d7

Please sign in to comment.