Skip to content

Add baffling-birthdays exercise #2539

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

Merged
merged 34 commits into from
Mar 11, 2025
Merged

Add baffling-birthdays exercise #2539

merged 34 commits into from
Mar 11, 2025

Conversation

ErikSchierboom
Copy link
Member

@ErikSchierboom ErikSchierboom commented Mar 6, 2025

This exercise combines two subjects that I feel we are still lacking exercises for:

  1. Dates
  2. Randomness

I've created a sample C# implementation for reference: exercism/csharp#2402

@ErikSchierboom ErikSchierboom requested a review from a team as a code owner March 6, 2025 19:53
@ErikSchierboom ErikSchierboom force-pushed the baffling-birthdays branch 5 times, most recently from 10e63ab to f0c319b Compare March 6, 2025 19:58
ErikSchierboom and others added 3 commits March 6, 2025 21:21
Co-authored-by: András B Nagy <20251272+BNAndras@users.noreply.github.com>
Co-authored-by: András B Nagy <20251272+BNAndras@users.noreply.github.com>
Copy link
Member

@tasxatzial tasxatzial left a comment

Choose a reason for hiding this comment

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

I feel there may be some confusion between 'birthday' and 'birthdate' among non-native speakers. It might be helpful to clearly explain the difference in the instructions.

Co-authored-by: András B Nagy <20251272+BNAndras@users.noreply.github.com>
ErikSchierboom and others added 8 commits March 7, 2025 13:03
Co-authored-by: Isaac Good <IsaacG@users.noreply.github.com>
Co-authored-by: Isaac Good <IsaacG@users.noreply.github.com>
Co-authored-by: Anastasios Chatzialexiou <16361161+tasxatzial@users.noreply.github.com>
Co-authored-by: Isaac Good <IsaacG@users.noreply.github.com>
Co-authored-by: Anastasios Chatzialexiou <16361161+tasxatzial@users.noreply.github.com>
@tasxatzial
Copy link
Member

I'm wondering if the properties should maybe be renamed at bit:

  • matchingBirthday -> matchingBirthdayPair
  • hasMatchingBirthdays -> hasMatchingBirthdayPair
  • probabilityForMatchingBirthdays -> probabilityForMatchingBirthdayPair

Tough call. I'll share my thoughts.

  • The tests with matchingBirthday prop seem to have consistent description and props, and it's only 2 birthdates as input, so i don't find any reason for adding pair anywhere.

  • The tests with hasMatchingBirthdays have odd descriptions:

    has matching birthdays with matching birthday pair
    has matching birthdays without matching birthday pair

    I think something like this makes more sense:

    has matching birthday pair
    does not have matching birthday pair

    Given that the input is an array of birthdates, the word pair might suggest a pair from the array, so birthdates pair. So to avoid any kind of confusion, I would just leave the word pair out and adjust the descriptions to:

    has matching birthdays
    does not have matching birthdays

    or something similar.

  • The probabilityForMatchingBirthdays also have odd descriptions:

    probability for matching birthday pair for ten people

    This is a bit misleading because it suggests the probability of exactly one matching pair. A better way to phrase this so that it aligns with the paradox would be:

    probability of at least one shared birthday among ten people

    and i would leave anything related to pair out, for sure.

@tasxatzial
Copy link
Member

@ErikSchierboom Have you also considered nesting (->), or is it not appropriate for these tests?

@ErikSchierboom
Copy link
Member Author

In general we try to not use nesting, but in this case it might be appropriate due to several completely different properties being tested

@ErikSchierboom
Copy link
Member Author

I've used nesting and tweaked the properties again. Once again, we're proving that naming things is hard :)

@ErikSchierboom
Copy link
Member Author

There are now two variants (of which we need to choose one, or an alternative).

People with the same birthday are referred to as:

  • sharing their birthday
  • having a matching birthday

Which one do you prefer? Or should it be "same birthday?"

@tasxatzial
Copy link
Member

Or should it be "same birthday?"

I think "have the same birthday" sounds more natural. "Sharing their birthday" sounds like they are celebrating together. "Matching birthday" does sound a bit awkward.

You'd have to do a ton of renaming though. Properties, descriptions, instructions...

@ErikSchierboom
Copy link
Member Author

I don't mind as I'm agreeing with you so I think it is a good idea

@tasxatzial
Copy link
Member

tasxatzial commented Mar 9, 2025

For the record, the Wikipedia article uses a mix of "share the same birthday" and "have the same birthday". It also uses "shared birthday" a lot.

@ErikSchierboom
Copy link
Member Author

Okay, another iteration :) I've gone for "share" after all, as it seems to be used quite a lot in online material.

@tasxatzial
Copy link
Member

tasxatzial commented Mar 9, 2025

I don't know if I'm missing something, but I've noticed that the props sharedBirthday and containsSharedBirthday have very similar tests. The first one is about checking two dates, the other is about checking an array of dates. Would it make sense to remove the sharedBirthday and move those tests to the containsSharedBirthday ?

Edit: By doing so, it will also resolve the issue with the plural in "shared birthdays" (see prev review) as this will allow to change it to "shared birthday" without creating a conflict in parent descriptions and props.

@ErikSchierboom
Copy link
Member Author

That's a great idea. I originally had them separate to sort of force the student to solve it in steps but merging them is a good idea.

@ErikSchierboom
Copy link
Member Author

As suggested, I've merged the sharedBirthday and sharedBirthdays properties.

Copy link
Member

@tasxatzial tasxatzial left a comment

Choose a reason for hiding this comment

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

I think it looks good. I only have one remaining suggestion from a previous review, and the schema error in this one.

@tasxatzial tasxatzial added the x:rep/large Large amount of reputation label Mar 10, 2025
ErikSchierboom and others added 2 commits March 10, 2025 20:49
Co-authored-by: Anastasios Chatzialexiou <16361161+tasxatzial@users.noreply.github.com>
Co-authored-by: Anastasios Chatzialexiou <16361161+tasxatzial@users.noreply.github.com>
@ErikSchierboom
Copy link
Member Author

Fixed both

Co-authored-by: Anastasios Chatzialexiou <16361161+tasxatzial@users.noreply.github.com>
@ErikSchierboom ErikSchierboom merged commit 1799950 into main Mar 11, 2025
7 checks passed
@ErikSchierboom ErikSchierboom deleted the baffling-birthdays branch March 11, 2025 12:59
@ErikSchierboom
Copy link
Member Author

Thanks for the help everybody!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
x:rep/large Large amount of reputation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants