Skip to content

Instantly share code, notes, and snippets.

@Tman22
Forked from rwarbelow/week-2-diagnostic.markdown
Last active December 11, 2015 17:07
Show Gist options
  • Save Tman22/94df9d3a40444961d6f5 to your computer and use it in GitHub Desktop.
Save Tman22/94df9d3a40444961d6f5 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. Going to Youtube.com: The client creates a request to go to youtube.com in their URL. The requests goes to a server after going through a process of finding the server and gets a response back. (Can I use my notes on this? If so I could give you the exact complex process of how it finds the domain after processing TLD)

  2. Explain when each of these HTTP verbs would be used: GET, POST, PUT, DELETE. GET: is in the request that tells the server to send a display back. Post: is for when the client is sending information to the server to be stored in database Put: is when the client is wants to update information in the database Delete: is a request to delete something on the page (for some reason, browsers don't have Put or Delete though there are work arounds to use them.)

  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? Create = GET, POST : Read = GET, GET: Update = GET,PUT : Delete = Detele.

  4. Describe the function of models in the MVC structure.
    The model has most of your classes and ruby information in there. The actual code that is used for views.

  5. Describe the function of views in the MVC structure. Views is mostly HTML with some ruby implementation. Also this is what will go on the page. The controller will find these files(erb) and display them on the correct path.

  6. Describe the function of controllers in the MVC structure. The controller is what takes in the params. The verb and path will be given to the controller to decide what actions and take with the given information.

  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. Model tests are for individual testing on methods of ruby. Testing that methods work through the model/ruby code Feature testing is testing like you were the user scrolling through the website. Making sure the website functions the way you want. The test would like: visit page, click link, within h2:first has content "HELLO". Controller tests are for making sure the the server/ path is correct. Making sure the response codes are correct

  8. What does ActiveRecord do? Why do we use ORMs like ActiveRecord? ActiveRecord allows us to use ruby like methods to access the database/sql. It creates a bridge between sql and ruby to make it easier.

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