Exercise Wednesday

Goal: We covered a lot of interconnected concepts lately. Take today to slowly unpack them and ensure you're comfortable with each. Really, don't move on to the next line of code, feature, or project until you have a solid grasp on what each part of your project is doing.

Warm Up


  • What is a static method? What about a static variable? Brainstorm a list of situations in which you'd use each with your partner.
  • How do we add an object to another object? What elements of the child object's class does the parent object have access to when we do this?
  • What is RESTful routing? What are its benefits?
  • How does Spark create unique URLs for each individual detail page using only one route?
  • What happens each of the following lines of code?
    • Task foundTask = Task.find(3);
    • model.put("foundTask", foundTask);
    • model.put("allTasks", Task.all());

Code


Blog

If you haven’t completed the homework, follow along with it to finish building our the beginning of your frontend for your Blog. Then, move on to the first lesson of today: Building out the frontend routes for UPDATE and DELETE.

Places You've Been

Make a website to keep track of places you've travelled to.As always, follow the process of Behavior-Driven Development to create and test your back-end logic before integrating Spark.

Job Board

Create a section of a job posting board where a user can create an instance of a JobOpening class by submitting a form. It should include properties for a title, description, and contact info for the person posting the job. It should allow users to createJobOpenings by submitting a form. The application should also list all openings for users to view. Feel free to add separate classes such as Company or Applicant, but do know that we have not taught you yet how to link Objects to other Objects, so you may not be able to implement this functionality yet.

Backpacking Packing Tracking

Make a program for users to catalog the things they need for an upcoming Camping, Backpacking, Bike Touring, or Rock Climbing trip.

Before you begin, sketch out what your data model should look like - you may want to name, price, purchased or not yet purchased, weight, manufacturer, packed or not yet packed, etc. Begin by testing. Can you generate a list of things that are not yet packed so they can be checked off? Use forms for this.

Further Exploration

If you complete all projects above with time to spare, go back and review each. Make sure you really, truly understand what the different components of each application are doing, and how they're communicating between each other. If you do, choose one of the following to work on for the rest of the day:

  • Integrate CSS into today's Spark applications to include additional formatting and styling.
  • If you're confident and comfortable with everything from this week so far, you're welcome to work through tonight's homework.

Peer Code Review


  • Spark routes process GET and POST requests/responses successfully.
  • Spark routes follow RESTful conventions.
  • Objects are created from a custom class with a custom constructor.
  • Object unit tests are organized into their own files separate from integration tests.
  • Tests are in place for back-end logic. All tests pass.
  • Spark routes process GET and POST requests/responses successfully.
  • Application works as expected.