Skip to content

Instantly share code, notes, and snippets.

@brantwellman
Forked from rwarbelow/week-2-diagnostic.markdown
Created December 11, 2015 16:15
Show Gist options
  • Save brantwellman/0b82a85c1880358bc103 to your computer and use it in GitHub Desktop.
Save brantwellman/0b82a85c1880358bc103 to your computer and use it in GitHub Desktop.
Week 2 Diagnostic
  1. Describe the request-response cycle. Start with the client making a request.

  2. Explain when each of these HTTP verbs would be used: GET, POST, PUT, DELETE.

  3. What are all of the necessary routes for full CRUD functionality in Sinatra app? Why do we need seven routes when there are only four CRUD actions?

  4. Describe the function of models in the MVC structure.

  5. Describe the function of views in the MVC structure.

  6. Describe the function of controllers in the MVC structure.

  7. What is the difference between model tests, feature tests, and controller tests? Give an example of functionality tested using a model test, functionality tested in a feature test, and functionality tested in a controller test.

  8. What does ActiveRecord do? Why do we use ORMs like ActiveRecord?

@brantwellman
Copy link
Author

  1. A client makes a response to the Resolving Name Server...if the RNS doesn't know the ip address instead of request it goes to the Root Name Server...if the RNS doesn't know the address it tells the Resolving NS the address of the Top Level Domain Server. If the TLD doesn't know the IP address it tells the RNS the address of the Name Server. The Name Server should know the IP address of the requested site and returns this to the RNS which then returns the ip address to the client, which then (finally) goes to the requested server. That server then processes the request and sends back the appropriate response - Headers, Body, and Response Code.

  2. GET - Request from the client requesting information from the server.
    POST - Request from the client to add new information to the server database.
    PUT - Request from the client to update information already on the database associated with that user.
    DELETE - Request from the client to delete information already on the database associated with that user.

/tasks - GET - Read - view list of objects(tasks)
/tasks/:id - GET - Read - view specific object(task) with given :id
/tasks/new - GET - Create - view form to submit information to create new object(task)
/tasks - POST - Create - Submit information to create new object(task)
/tasks/:id/edit - GET - Update - View form to submit information to edit existing object(task)
/tasks/:id - PUT - Update - Submit information to edit existing object(task)
/tasks/:id - DELETE - Delete - Delete existing object(task)

  1. Models - Handle the business logic in an application. Some can be the Ruby Objects that are stored in the database tables
  2. Views - The code which generates the pages that are displayed to the client.
  3. Controllers - Responsible for handling incoming requests from clients, routing them to appropriate models for data analysis, and then routing information to the appropriate views to render the appropriate information....which then gets sent back to the controller as a string and sent back to the client.
  4. Feature Tests - Test functionality as viewed by the "user". Test if specific information is displayed on a view, if buttons can be clicked, if data can be submitted in a form.
    Controller Tests - Test that the proper response codes are sent to the client - when not 200s. Test that the proper routes are being used.
    Model Tests - Test business logic is being handled properly. Test that Ruby objects are being created properly from the database.
  5. Active Record is the ORM layer between the Ruby Objects and the database. It gives us the ability to interact with the database and retrieve information from it making specific calls without necessarily creating Ruby Objects to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment