|
| 1 | +# Design |
| 2 | + |
| 3 | +## Learning objectives |
| 4 | + |
| 5 | +- Know about the `java.time.temporal.TemporalAdjuster` interface and its purpose. |
| 6 | +- Know about the `java.time.temporal.TemporalAdjusters` utility class and how to use its static factory methods. |
| 7 | +- Know how to apply a `TemporalAdjuster` to a `LocalDate` using the `.with()` method. |
| 8 | +- Know how to select and use common predefined adjusters like `TemporalAdjusters.dayOfWeekInMonth()`, `TemporalAdjusters.lastInMonth()`, and `TemporalAdjusters.nextOrSame()`. |
| 9 | +- Understand that `java.time` objects are immutable and adjustment methods return new instances. |
| 10 | +- Know how to use a `java.time.DayOfWeek` enum value. |
| 11 | +- Know how to use a custom `enum` (like `MeetupSchedule`) in conditional logic (e.g., `switch` statement). |
| 12 | + |
| 13 | +## Out of scope |
| 14 | + |
| 15 | +- Creating complex custom `TemporalAdjuster` implementations. |
| 16 | +- Time zones, offsets, `ZonedDateTime`. |
| 17 | +- `LocalDateTime`, `LocalTime`. |
| 18 | +- Durations (`java.time.Duration`) and Periods (`java.time.Period`). |
| 19 | +- Date/time parsing and formatting. |
| 20 | + |
| 21 | +## Concepts |
| 22 | + |
| 23 | +- `temporal-adjusters`: This exercise introduces and focuses on the `TemporalAdjusters` concept. |
| 24 | +- `datetime`: Reinforces basic usage of `LocalDate` and `DayOfWeek`. |
| 25 | +- `enums`: Reinforces usage of enums. |
| 26 | + |
| 27 | +## Prerequisites |
| 28 | + |
| 29 | +- `datetime`: Must know how to create and use basic `java.time.LocalDate` objects and understand `DayOfWeek`. |
| 30 | +- `enums`: Must know how to work with `enum` types, including using them in `switch` statements or accessing properties like `ordinal()`. |
| 31 | +- `classes`: Basic understanding of Java classes and methods. |
| 32 | +- `methods`: Basic understanding of Java methods. |
| 33 | + |
| 34 | +## Analyzer |
| 35 | + |
| 36 | +This exercise could benefit from the following rules in the [analyzer]: |
| 37 | + |
| 38 | +- `essential` (replaces `actionable` if it MUST be fixed): If the solution involves significant manual date calculation logic (e.g., loops checking day of week, complex `plusDays`/`minusDays` sequences) instead of using `TemporalAdjusters`, instruct the student that using the `TemporalAdjusters` class is the idiomatic approach for this exercise. Provide a link to the `TemporalAdjusters` concept documentation. |
| 39 | +- `actionable`: If the student uses `TemporalAdjusters.dayOfWeekInMonth()`, check if they correctly map the `MeetupSchedule` enum ordinal (0-based) to the required 1-based ordinal argument. If not, provide a hint. |
| 40 | +- `actionable`: If the logic for `MeetupSchedule.TEENTH` seems incorrect or overly complex, suggest using `TemporalAdjusters.nextOrSame()` applied to the 13th day of the month. |
| 41 | +- `informative`: If the student uses `TemporalAdjusters` correctly, mention the specific adjusters used (`dayOfWeekInMonth`, `lastInMonth`, `nextOrSame`) as good choices for their respective cases. |
| 42 | + |
| 43 | +If the solution uses `TemporalAdjusters` correctly for all `MeetupSchedule` cases, it should be considered exemplar. Leave a `celebratory` comment to celebrate the success! |
| 44 | + |
| 45 | +[analyzer]: https://github.com/exercism/java-analyzer |
0 commit comments