Individual Assignment 1: Birthday Input

For the individual assignments in this class, we will be developing a web-based application that helps us keep track of people’s birthdays. Each assignment will make the appliation more complicated and useful.

For this assignment, you must create a very simple rails application. This application will ask users to input information about a birthday, and then create a dynamic webpage that prints out that birthday information.

Due: January 29, 2014 at 1pm

Requirements

Part 1: Store in GIT

Store your assignment 1 application in git, in a repository named <username>/assign1. Don’t forget to git commit and git push when you are done, so that the newest version is in the repository. note: you create this repository with the new_repo assign1 command.

Part 2: Rails

Create a simple rails application using the rails new command.

Part 3: Input

Modify your new rails application to create an action and a view page that contains a simple form for inputting birthday information. In particular, the form should ask for:

Part 4: Output

Modify your rails application to create another controller action. (Don’t forget to add a route for it.) This action should receive the birthday form and fill in @variables with the information from the form. Also, create a second view page that displays this information in a format that is easy to read. Once you have done this, you should have a working pair of pages – one that allows you to submit birthday information, and the other displays the submitted information. Make sure that these two pages work together as expected.

Also, at the bottom of the second page (the page that displays birthday information), create a link back to the first page.

Part 5: Documentation

When writing code, you should always document what the code does, and why. There are two pieces to the documentation:

  1. Write self-documenting code. It should be relatively easy to read your code and understand what it does. This means you should do things like:
    • Use meaningful and accurate names for variables and methods
    • Don’t put everything on one line. Put each separate step on its on line
    • Use whitespace. Leave blank lines in the code to conceptually group parts of the code.
  2. Write explicit documentation when appropriate:
    • Unless it is blatantly obvious, include a comment describing what each function does right above the function
    • Describe expectations. For example, one of your “action” methods in your controller expects to receive form data. Describe that data in the comment for that method
    • Anytime the code isn’t clear, use a comment to describe what the code is doing

In addition, for this assignment I would like you to create a file in the doc/ directory that describes the workflow of your application. This file should be named workflow.txt and it should be a plain text file. Basically, it should contain:

  1. What URL a user should start with
  2. When using the application, what does the user have to do, and where in the application (URL, or controller/action) this will take them

Part 6: Extras

You are not required to do any of these extras, but including one or more of them in your assignment will lead to extra credit.

  1. Use a better format for the birthday. Ask the user separately for month, day, and year and store them in a “Birthday” class. Include a “to_s” function.

Submission

At 1pm on the due date, I will collect the assignments out of the git repository <username>/assign1. Be sure that your assignment is in the repository, in the correct directory, and don’t forget to git commit and git push. Make sure the application runs on the server as part of my grading will be to run the program and enter birthday information into it.

Due Date

Wednesday, January 29, 2014 at 1pm

Frequently Asked Questions

Can I use my Mac?
Yes, you can. I frequently do work on the class server from my Mac. The terminal can work as an ssh client. Open the terminal and type in
  ssh **username**@webdev.cas.msu.edu

(of course, fill in your username).

Can I use my PC?
Yes, you can. Use the program PuTTY as an ssh client. Enter webdev.cas.msu.edu in the hostname box, and click connect. It will prompt you for your username and password. Everything else is the same.
How do I know if I successfully put my code in git?
Check! For any git repository, you can clone it to get a new copy of it. You just have to give it a different directory name to put the second copy in. Try this command:
  git clone git@webdev.cas.msu.edu:<username>/assign1 assign1-check

This will put a new copy of your repository into the assign1-check directory. Then you can cd into that directory, and verify your code is there and works correctly.