Exercise Wednesday

Goal of the day: Your goal for today is to practice making Silex apps which allow you to create and save new instances of objects by submitting a form. Start by making your routes return basic HTML, and then add Twig templates for each page.

Each class in each project should include a constructor, getters and setters, private properties, a save method, as well as static methods for getAll and deleteAll.

Again, for all of these projects, remember to make regular commits and include a README when you push your project up to your Github repository.

To Do

Start off by following along with the homework lessons to build a To Do list.

Places You've Been

Make a website where you can enter places that you have been. A Place should be an object. Start by just giving it one property - a city name. Then expand it by adding other properties like a picture, or how long you stayed, etc.

Peer code review checklist:

  • Can you save a task or place in the app? Are the values from the form being passed correctly?
  • Is the code easy to read? How clean are the class declarations?
  • Are all routes built with Silex?
  • How might you proceed from the end point of the project? What features could be added next?



Jobs You've Held

Imagine that you would like to create an application that can store information about all of the jobs you've held, so that you don't have to keep searching for your resume every time you are looking for employment.

Create a Job class with properties that you think are relevant to an employer. Have a form so that a user can fill out information about each job. When you display the information in your app, make sure to include all of the information that was submitted in the form, organized in a nice way.

Tamagotchi

When I was a kid, Tamagotchis were popular for a while. They were kind of like electronic pets that you would carry around with you and press buttons to feed it, play with it, and put it to sleep. (Or something like that - I honestly never had one.) If you didn't give it enough food, attention or rest, it would die.

Make a web app where you can create a Tamagotchi object by giving it a name and submitting a form. It should have properties for the amount of food, attention and rest it currently has.

There should be a main page displaying the names of our Tamagotchi object with the values of its properties.

Create buttons to call methods which:

  • Feed it, play with it, and put it to sleep. These methods should modify the properties of our Tamagotchi object - such as a $food property.
  • Make time pass. Every time you press it, the food, happiness and sleep properties of our Tamagotchis should decrease. If any of these properties get to 0, the Tamagotchi object should report that it's dead.