In our own internal education, we've found that the following exercises work particularly well. They're all in sequence – each subsequent exercise modifies the code you wrote previously. Enjoy, and let us know if you have any questions! 👩‍🎓

Assignments

1. Auto-tag customers with @gmail.com email addresses, with "gmail"

  • Support case-insensitivity – recognize "@gmail.com", and "@Gmail.com"
  • Ignore domains with more extensions – don't tag for "@gmail.com.au"
  • Make sure that any existing tags on the customer's account are kept, not lost

2. Allow the merchant to configure the domain name to look for, and the tag to apply

  • Help the merchant make sure they enter a real domain name – return an error if the domain doesn't include a "."
  • Support case-insensitivity – if the merchant enters "Gmail.com", and the customer's email address ends with "@GMAIL.COM", they should still be tagged

3. Allow the merchant to add any number of domain name and customer tag pairings

4. Support responding to customer updates, in which the customer's email address changes

  • Remove any domain name tags that do not apply, and add the tag (if any that does apply
  • Do not remove any tags that contain a domain name tag – if the tag "google" should be removed, do not accidentally remove "google-foo"
  • Make this optional – allow the merchant to choose whether or not Mechanic listens for this

5. Move to GraphQL for removing and adding tags

6. Allow waiting a configurable number of minutes

  • Account for the customer tags or email address having changed during the waiting period

7. Create a backfill mode, that can be run manually

8. Do that with bulk operations

Did this answer your question?