Skip to content

docs: Introduce new concept for TemporalAdjusters #2944

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

rabestro
Copy link
Member

@rabestro rabestro commented May 4, 2025

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

Jegors Cemisovs added 13 commits May 4, 2025 12:14
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.
Relocated the `meetup` exercise and updated its structure to align with the concept track. Adjusted paths, references, and configuration files accordingly to reflect this transition. No functional changes to the implementation or tests were made.
The "Meetup" exercise entry has been deleted, including its slug, name, uuid, practices, prerequisites, and difficulty level.
Introduce `introduction.md.tpl` and `hints.md` for the Meetup exercise to guide learners. The hints provide detailed steps on working with `LocalDate` and `TemporalAdjusters` for date manipulations.
Added the "exemplar" key to the config.json for better exercise organization. Also fixed the missing newline at the end of the hints.md file to ensure proper formatting.
The `tests.toml` file and specific keys in `config.json` for the meetup exercise have been removed. These changes clean up outdated metadata and streamline the exercise configuration.
Introduces learning objectives, out-of-scope topics, concepts, prerequisites, and analyzer rules for the exercise. Clarifies focus on `TemporalAdjusters` and proper usage of `java.time` API while providing guidance for evaluations in the analyzer.
Updated `config.json` to include 'editor' paths for 'meetup' and adjusted `settings.gradle` to include the concept version while removing the practice version. This aligns with the intended migration from a practice exercise to a concept exercise.
@kahgoh
Copy link
Member

kahgoh commented May 5, 2025

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
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
Copy link
Member Author

rabestro commented May 7, 2025

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 :)

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.

2 participants