I\'m a front end developer...I\'ve never done ANY backend, although I did take a
ID: 651505 • Letter: I
Question
I'm a front end developer...I've never done ANY backend, although I did take a course in databases once. (I have a comp sci degree; I'm a competent programmer, I just haven't done any backend web stuff before.)
So I'm trying to figure out how the framework relates to the database. Presumably they're set up separately, and the framework receives requests from the website and sends them to the database, then receives the response and handles it appropriately to deliver the content correctly? It's basically a complex intermediary for all the web-app logic? Am I far off?
Need a good explanation of this.
Explanation / Answer
There are many possibilities to connect a web-app to a database (and a lot of different databases to choose from).
I think you should first consider the normal case (as e.g. most used in the RoR community):
a relational DB and a ORM (the object relational mapper - in RoR it is ActiveRecord based on the active record pattern).
a very high-level (and superficial) introduction:
the database is a separate entity and process.
the app defines models that describe both the tables in the relational database (RoR will create the necessary SQL commands) and the the way the data in the database can be accessed and modified from the web-app using objects and properties.
in your web-app-code you access the database only by interacting with those models. e.g. in RoR:
the users make requests to the web-app
the requests are handled in the controller.
the controller creates or retrieves records (e.g. by invoking find(<id>) on the class object) from the DB. these records appear as objects (or arrays of objects).
the controller modifies them, and
stores the result back to the DB (e.g. by invoking save() on the object).
the response e.g. shows the result to the user.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.