Exercise Tuesday

Goal: Continue to practice building Spark applications that persist data in a database, including following best practices for routing, database naming, database relationships, and thorough testing using Behavior-Driven Development. Additionally, begin to get comfortable translating user stories into tangible application features.


To Do List

Before beginning the main project below, follow along with last night's homework to integrate objects within objects and editing routes (with corresponding tests!) into your To Do List application. Once you can successfully update Task objects, add similar functionality for updating Category objects.

Animal Shelter

Make a program for an animal shelter that tracks animals up for adoption, and potential owners that have visited the shelter. Build out the following user stories. As with your previous projects, don't focus on different user roles, focus on implementing the behaviours you'll need to complete each user story.

  • As a shelter worker, I want to add animals to the system. An animal will have a name, gender, date of admittance, type (ex. cat/dog) and breed.
  • As a shelter worker, I want to add a person as a customer into the system. A customer should have a name, phone, animal type preference, and a breed preference.
  • As a potential owner, I want to see be able to see lists of animals by breed, type or by name alphabetically. (Hint: make separate pages for each of these, but write methods for these sorts)
  • As a shelter worker, I want to list animals chronologically - starting with the ones who have been in the shelter the longest.
  • As a shelter worker, I want to be able to see a list of customers by breed preference so if a specific breed arrives, I am able to contact potential owners for the animal.
  • As a shelter worker, I want to add an owner to an animal if that customer adopts.

Further Exploration

  • Add images and css to improve the user experience on your pages.
  • Explore HTML and bootstrap options for forms and fields.
  • Add the ability for the shelter to assign volunteers or foster parents to specific animals.

Further Exploration: Game of Choice

If you and your partner feel comfortable integrating objects within objects into Spark and are ready for a more complex challenge, create one of the following games. As always, make sure to follow the Red, Green, Refactor BDD Workflow, and integrate RESTful routes. Also, don't worry if you don't fully complete your game today. You can continue work on this Thursday, if you complete your two-day project with time to spare.


Create an app that allows you to recruit a well-balanced team of superheroes (or any other character-type of your choosing).

  • Create a Hero object: At the very least, they should have a name, age, special power and weakness. Special powers and weaknesses could be freely assignable or you may offer users a predetermined set to choose from.

  • Create a Squad object: They should have a max size, name, and a cause they're are dedicated to fighting (sexism, computer illiteracy, not covering your mouth when you sneeze, hogging bus seats with your backpack, passive aggressive post-it notes, etc).

  • Allow users to assign Heros to a Squad. Each hero can only participate in one Squad at a time.

  • You could even calculate scores for a specific skill area for your squad (defense, distance attacks, etc), or begin to integrate a turn-based battle system. Get creative! This could be the start of a fun portfolio piece!

Go Fish

Make a game where two people can play the card game Go Fish with each other. If you're not familiar with the rules of Go Fish, check out it's entry on Wikipedia here.

  • Create a Game object: This should hold the multiple Players participating, and methods for dealing cards, changing turns, determining a winner, etc.

  • Create a Player object: At the very least this should contain the player's hand of cards, and their name. You could keep track of how many wins and losses a player has too.


  • The Nested Looping lesson from week one may assist in constructing a virtual deck of cards.

  • Also, take a peek at Oracle's documentation for the Collection.shuffle() method. It may come in handy for "dealing" your virtual cards.

Peer Code Review

  • Database tables and columns follow standard naming conventions
  • One-to-many database relationships have been configured and executed correctly.
  • CRUD functionality is present in methods and routes.
  • Spark routes follow RESTful standards.
  • Application works as expected.
  • Tests are in place (and passing) for each behavior the program demonstrates.