Practice WOD: DigitsInit

The goal of this WOD is to learn about the Play Global class, which enables you to do initialization activities upon system startup. To prepare for this WOD, read about the Global object and the onStartup method.

Instructions

Create a revised version of your Digits application which initializes the system with four contacts.

  1. Start your timer.
  2. Create a new branch off of your last WOD. Name this new branch “DigitsInit-1″, indicating that this is the first attempt at the DigitsInit WOD.
  3. Enable checkstyle.
  4. Create a Global class and implement the onStartup method, then create four contacts and add them to the ContactDB on system startup. Here’s what the home page might look like upon initial retrieval:

When finished, stop your timer, and record how many minutes it took you to complete the WOD.

Rx: <8 min Av: 8-12 min Sd: 12-16 min DNF: 16+ min

Demonstration

Once you’ve finished doing the WOD a single time, watch me do it.

Note: since the time of this screencast, I discovered the way to eliminate the checkstyle error associated with the Global.java class in the default package. Simply create a package.html file in the same directory as Global.java. You may need to clear the checkstyle warnings manually and then re-run checkstyle, but the warning will then disappear.

Standard WOD Caveats

You’ll learn significantly less from watching me solve the WOD if you haven’t attempted the WOD yourself first.

While it’s an achievement to finish the WOD no matter how long it takes, you might experience “diminishing returns” if you work longer than the DNF time. Thus, it might be strategic to stop working at the DNF time and watch my solution.

After watching my solution, I recommend that you repeat the WOD if you have not achieved at least Av performance. If so, be sure to:

Feel free to keep trying until you make Rx if that’s of interest to you.