But actually, today Backbone started making sense. After getting our hands dirty with the models, views, and router in JS, I’m like, “ohhhh that’s where this is going.” I finally saw the forest instead of the trees!
The lecture in the morning was also very helpful. Basically, at this point, Rails is just in charge of rendering 1 full page–the static root page. All the other components are populated by JS views and perform small server calls only when needed, and thus the site is mostly this fragmented AJAX loop. That’s what they mean by “single page site.” Kewl.
It’s pretty cool incorporating it into our Rails projects. Now everything–Rails, HTML/CSS, and JS– is coming together! At this point, in theory, we can build the apps we see all over the internet these days. (Granted, we haven’t yet spent time to make anything really polished yet, but that’s what the capstone project is for!) It’s a lot of moving pieces–updating views, models, js files/events, routes, and controllers–but I actually find it not terrible to keep track of because of how CONCRETE it is: if I am on so-and-so page, wouldn’t it make sense that the views are in so-and-so folder, the js scripts are named so-and-so, etc etc? So I’m having a pretty good time orchestrating everything.
with JQuery! This is the context in which I’m used to seeing JS, and it thankfully was indeed more concrete than the JS abstract, server side stuff we were writing before. Browser-based Tic Tac Toe and Towers of Hanoi (my old enemy, but perhaps this is the last time!?) were pretty straightforward. Snake was a little slower going because we had to write the game logic ourselves, but I think (hope) writing JS is becoming slightly clearer to me as time goes on. When I got home I also took the time to review the inital JS notes on closures, this/that, and ways to invoke a function, and that should help a lot. It was all pretty abstract to me the first time I read it, but now, many debugging sessions later..!