From 420dc1f095d815c7e5a6c69113069c684e42fb48 Mon Sep 17 00:00:00 2001 From: Sander Ploegsma Date: Tue, 30 Jan 2024 20:32:56 +0100 Subject: [PATCH 1/4] lasagna: Add existing analyzer comments to .meta/design.md --- exercises/concept/lasagna/.meta/design.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/exercises/concept/lasagna/.meta/design.md b/exercises/concept/lasagna/.meta/design.md index 3addebb23..d01adbc98 100644 --- a/exercises/concept/lasagna/.meta/design.md +++ b/exercises/concept/lasagna/.meta/design.md @@ -47,7 +47,13 @@ This exercise does not require any specific representation logic to be added to ## Analyzer -This exercise does not require any specific logic to be added to the [analyzer][analyzer]: +This exercise could benefit from the following rules in the [analyzer]: + +- `actionable`: If the student did not reuse the implementation of the `expectedMinutesInOven` method in the `remainingMinutesInOven` method, instruct them to do so. + Explain that reusing existing code instead of copy-pasting can help make code easier to maintain. +- `actionable`: If the student did not reuse the implementation of the `preparationTimeInMinutes` method in the `totalTimeInMinutes` method, instruct them to do so. + Explain that reusing existing code instead of copy-pasting can help make code easier to maintain. +- `actionable`: If the student left any `// TODO: ...` comments in the code, instruct them to remove these. [analyzer]: https://github.com/exercism/java-analyzer [representer]: https://github.com/exercism/java-representer From c3a54eb1c646215ea09861f5574302d73aa40a8a Mon Sep 17 00:00:00 2001 From: Sander Ploegsma Date: Tue, 30 Jan 2024 20:42:11 +0100 Subject: [PATCH 2/4] leap: Add existing analyzer comments to .meta/design.md --- exercises/practice/leap/.meta/design.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 exercises/practice/leap/.meta/design.md diff --git a/exercises/practice/leap/.meta/design.md b/exercises/practice/leap/.meta/design.md new file mode 100644 index 000000000..ba1f404b6 --- /dev/null +++ b/exercises/practice/leap/.meta/design.md @@ -0,0 +1,12 @@ +# Design + +## Analyzer + +This exercise could benefit from the following rules in the [analyzer]: + +- `essential`: Verify that the solution does not use `java.time.Year.isLeap(int)` or `new java.util.GregorianCalendar().isLeapYear(int)`. +- `essential`: Verify that the solution does not contain hard-coded years used in the tests. +- `actionable`: If the solution uses conditional statements like `if/else` or ternary expressions, instruct the student to use simple boolean logic instead. +- `actionable`: If the solution contains more than 3 checks, instruct the student that their solution can be simplified. + +[analyzer]: https://github.com/exercism/java-analyzer From bf26e63389b8131150a3af6866d031491af8ad28 Mon Sep 17 00:00:00 2001 From: Sander Ploegsma Date: Tue, 30 Jan 2024 20:51:01 +0100 Subject: [PATCH 3/4] two-fer: Add existing analyzer comments to .meta/design.md --- exercises/practice/two-fer/.meta/design.md | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 exercises/practice/two-fer/.meta/design.md diff --git a/exercises/practice/two-fer/.meta/design.md b/exercises/practice/two-fer/.meta/design.md new file mode 100644 index 000000000..ada1aa6b4 --- /dev/null +++ b/exercises/practice/two-fer/.meta/design.md @@ -0,0 +1,25 @@ +# Design + +## Analyzer + +This exercise could benefit from the following rules in the [analyzer]: + +- `essential`: Verify that the solution does not hard-code the names used by the tests (`Alice`, `Bob`). +- `actionable`: If the solution contains more than one `return` statement, instruct the student to try and only use one. + Using multiple `return` statements in this exercise could be an indication of code duplication, as it probably contains the sentence twice: + + ```java + String twofer(String name) { + if (name == null) { + return "One for you, one for me." + } + + return "One for " + name + ", one for me." + } + ``` + +- `actionable`: If the solution uses an `if` statement, instruct the student to use a ternary expression instead. +- `actionable`: If the solution uses `String.format`, instruct the student to use simple string concatenation instead. + Explain that `String.format` is significantly slower than concatenating strings and should be used in more complex scenarios. + +[analyzer]: https://github.com/exercism/java-analyzer From 0cf3aadad2f603d6787cbc2cdc1cf99d15dd9328 Mon Sep 17 00:00:00 2001 From: Sander Ploegsma Date: Tue, 30 Jan 2024 21:03:19 +0100 Subject: [PATCH 4/4] hamming: Add existing analyzer comments to .meta/design.md --- exercises/practice/hamming/.meta/design.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 exercises/practice/hamming/.meta/design.md diff --git a/exercises/practice/hamming/.meta/design.md b/exercises/practice/hamming/.meta/design.md new file mode 100644 index 000000000..8684434b5 --- /dev/null +++ b/exercises/practice/hamming/.meta/design.md @@ -0,0 +1,15 @@ +# Design + +## Analyzer + +This exercise could benefit from the following rules in the [analyzer]: + +- `actionable`: If the solution calculates the Hamming distance each time `getHammingDistance()` is called, + instruct the student to calculate the Hamming distance once in the constructor. + Explain how this is more efficient. +- `actionable`: If the solution hard-codes the DNA cells as character literals (`A`, `C`, `G`, `T`) when comparing strands, + inform the student that their solution should be able to calculate the Hamming distance between any two strings, + regardless of their contents. +- `informative`: If the solution uses `Instream.reduce()`, inform the student that it can be simplified to `Instream.filter().count()`. + +[analyzer]: https://github.com/exercism/java-analyzer