Skip to content

docs: Introduce new concept for TemporalAdjusters - #2944

Open
rabestro wants to merge 8 commits into
exercism:mainfrom
rabestro:issue/2935-TemporalAdjusters
Open

rabestro wants to merge 8 commits into
exercism:mainfrom
rabestro:issue/2935-TemporalAdjusters

Conversation

@rabestro

@rabestro rabestro commented May 4, 2025

Copy link
Copy Markdown
Member

pull request

Description

This PR introduces a new concept, "TemporalAdjusters", to the Java track's syllabus.

Motivation:

It has been observed (e.g., during mentoring for the Meetup exercise) that many students are unfamiliar with the java.time.temporal.TemporalAdjuster interface and the associated TemporalAdjusters utility class. This often leads to complex manual date calculations instead of leveraging these powerful and idiomatic standard library features.

Solution:

This PR adds a dedicated concept to explain TemporalAdjusters, covering:

  • What they are and why they are useful.
  • How to use them via the .with() method.
  • Common predefined adjusters provided by the TemporalAdjusters class (e.g., dayOfWeekInMonth, lastInMonth, nextOrSame).
  • The importance of immutability in java.time.

The following files have been created for this concept:

  • concepts/temporal-adjusters/about.md
  • concepts/temporal-adjusters/introduction.md
  • concepts/temporal-adjusters/links.json

UUID: cc7a06d1-ddb3-4722-88a5-f762254d664e

The concept has also been added to the track's main configuration file using the UUID above.

Goal:

By introducing this concept, we aim to guide students towards using TemporalAdjusters earlier, enabling them to write more idiomatic and robust solutions for date-related exercises.

Closes #2937


Reviewer Resources:

Track Policies

@kahgoh

kahgoh commented May 5, 2025 •

Copy link
Copy Markdown
Member

Ah, I noticed you've moved the meetup exercise to a concept exercise. We shouldn't be doing that because it is a practice exercise, with a problem spec in the problem-specifications repo (so the tests are shared across the tracks).

Instead, we should come up with another concept exercise to introduce temporal adjusters. For the concept exercise, we'll need to choose a background story. For example, we're using Booking Up For Beauty for Local Date/Time. For temporal adjusters, C# also uses Beauty Salon Goes Global - we could probably do the same. Alternatively, we could also look through the list to see what other stories are used.

We should also add temporal-adjusters as a prerequisite to the meetup exercise so that the meetup exercise is enabled only after students learn the concept.

// => 2024-08-26
```

## Finding Relative Occurrences ("Teenth" dates)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a left over from writing for the "meetup" exercise? Since this is an introduction to the temporal adjusters concept, I think we can copy the Relative Adjustments (Next/Previous) content from the about.md here.

@rabestro

rabestro commented May 7, 2025

Copy link
Copy Markdown
Member Author

Ah, I noticed you've moved the meetup exercise to a concept exercise. We shouldn't be doing that because it is a practice exercise, with a problem spec in the problem-specifications repo (so the tests are shared across the tracks).

Instead, we should come up with another concept exercise to introduce temporal adjusters. For the concept exercise, we'll need to choose a background story. For example, we're using Booking Up For Beauty for Local Date/Time. For temporal adjusters, C# also uses Beauty Salon Goes Global - we could probably do the same. Alternatively, we could also look through the list to see what other stories are used.

We should also add temporal-adjusters as a prerequisite to the meetup exercise so that the meetup exercise is enabled only after students learn the concept.

Thank you for your suggestion. To be honest, I was also thinking about a special exercise. It take some time :)

@IsaacG

IsaacG commented Oct 29, 2026

Copy link
Copy Markdown
Member

@rabestro Is this something you're still working on?

@rabestro

rabestro commented Oct 30, 2026 •

Copy link
Copy Markdown
Member Author

@rabestro Is this something you're still working on?

Thanks for pinging me.

Jegors Cemisovs added 6 commits October 30, 2026 11:07
Introduces the `Temporal Adjusters` concept, including an overview, examples, and links for Java's `TemporalAdjuster` and `TemporalAdjusters` utilities. Updates `config.json` to include the concept and a new exercise, "Meetup," with relevant prerequisites.
Simplify the introduction and examples for `TemporalAdjusters` to improve clarity and focus on practical use cases. Removed redundant examples and reorganized sections to prioritize key adjusters like ordinal days and "teenth" date calculations. Enhanced consistency and readability across code snippets and explanations.
Adjusted the `blurb` text for clarity and reformatted the `authors` field for improved readability. These changes maintain consistency with JSON coding standards and enhance the file's maintainability.
Replaced asterisks with dashes for consistency in list formatting and added blank lines for better readability. These changes improve the overall structure and clarity of the documentation.
Standardize heading levels for consistency and readability. Changed `###` to `##` in multiple sections to align with the document's structure. No content modifications were made.
The links to LocalDate and DayOfWeek documentation were unused and have been removed to improve clarity and maintainability. This helps keep the documentation clean and focused.
@rabestro
rabestro force-pushed the issue/2935-TemporalAdjusters branch from e76ec25 to 32c74e7 Compare October 30, 2026 09:08
@rabestro

Copy link
Copy Markdown
Member Author

Rebased on main and dropped the move of meetup to a concept exercise, following @kahgoh's feedback above. The PR now only adds the temporal-adjusters concept: concepts/temporal-adjusters/ plus its entry in config.json. A dedicated concept exercise for it would be a separate PR.

Jegors Cemisovs and others added 2 commits October 30, 2026 11:35
The concept exercise asks students to write a TemporalAdjuster of their
own, so the introduction shown before the exercise needs to cover it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
A sequel to booking-up-for-beauty that teaches the temporal-adjusters
concept: standing appointments for regular clients (dayOfWeekInMonth,
lastInMonth, nextOrSame), the month-end bookkeeping day (lastDayOfMonth,
previous) and a reusable custom adjuster for the weekend rule.

Also adds temporal-adjusters as a prerequisite of the meetup practice
exercise, as requested in review.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@rabestro

Copy link
Copy Markdown
Member Author

Added a concept exercise for the concept, beauty-salon-regulars: a sequel to Booking Up For Beauty where regular clients have standing appointments ("every second Tuesday", "the last Friday of the month"). Five tasks cover dayOfWeekInMonth, lastInMonth, nextOrSame, lastDayOfMonth with previous, and a small custom TemporalAdjuster for a weekend rule. temporal-adjusters is now also a prerequisite of the meetup practice exercise. The story is new, so it is not in the stories catalog yet; happy to adjust the story or the task set.

@rabestro
rabestro requested a review from kahgoh October 31, 2026 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants