Skip to content

Instantly share code, notes, and snippets.

@stevepentler
Forked from rwarbelow/week-2-diagnostic.markdown
Last active December 11, 2015 16:52
Show Gist options
  • Save stevepentler/03c7efbba55c0d00843f to your computer and use it in GitHub Desktop.
Save stevepentler/03c7efbba55c0d00843f 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.
  • oh geez! Client sends request, makes it through rack and middleware, heads to DNS? DNS bounces the message to a few more servers with greater specificity each time. Eventually it locates the server and passes the response back through the rake/middleware to the client.
  1. Explain when each of these HTTP verbs would be used: GET, POST, PUT, DELETE.
  • GET is used to retrieve and display information from the server.
  • POST is used to modify the server by adding information.
  • PUT modifies information that exists in the server with greater specificity than POST.
  • DELETE LOLZ, duh
  1. 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?
  • Not really sure? I'm fairly certain that DELETE and PUT are reliant upon the GET and POST paths, thust GET and POST are the only two that are completely necessary.
  • GET
  • POST
  • POST -> DELETE
  • POST -> PUT
  1. Describe the function of models in the MVC structure.
  • Models are the logic centers of the application. Like most programmers, I love fat models. They are the engines that interact with the database, establish methods, etc.
  1. Describe the function of views in the MVC structure.
  • Views are used to display information to the client. Ideally, they contain minimal logic and are written in HTML.
  1. Describe the function of controllers in the MVC structure.
  • Controllers determine how to route information using paths. They identify paths and redirect the client to the proper views. The also incorporate slight amounts of logic from the models, ex: shipping in the @app.applications.all method to the index so that you can reference the database.
  1. 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 * local, small *scale testing to verify individiual and independent methods. ex: determining if a method's parses information as you'd expected.
  • Feature tests * integrated tests that verify that multiple methods/classes are providing their expected outputs. ex: capybara testing that simulates a user navigating the site and clicking on buttons/links.
  • Controller tests * verify the request side as opposed to the response. Output is verified prior to hitting the actual server. ex: inaccurate path or missing payload test
  1. What does ActiveRecord do? Why do we use ORMs like ActiveRecord?
  • Active record is an Object Relational Model that allows us to interact with databases. The primary benefit is that the simple syntax is converted into longhand SQL. This shortens the time/code/knowdledge requirements to manipulate the database.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment