Posts tagged 'sql'
Today's partner: Eva
The assignment today was deceptive. It began simply enough—with me completely forgetting everything I learned about ActiveRecord last week. Wait, back up.
Today's assignment expanded on what we learned about ActiveRecord before Thanksgiving. It took a little bit to warm up, but thankfully Eva had done enough practice to get me on track quickly. It was a lot of boilerplate:
has_many( :method_name, class_name: "Blah", ...)(which is a bit annoying, because of course the solutions all use the more succinct forms of relations), which seems somewhat typical of this phase of Rails.
The project centered, again, around a standard online trope: the survey.
Users and their selections from these answers. The core work: outlining the migrations, defining the initial validations and relations, and adding indices all went smoothly, and we were done with the core logic that was demanded of us (mostly custom validations) well before 2. There was a bit of tricky SQL and ActiveRecord Relation syntax (not logic, per se) that we struggled with, but overall it was very smooth.
… and then came the Bonus work. Four hours of bonus. Holy mother of god, there's some convoluted rules for what can and can't be put in different places in a Relation. (
joinscan't take parameters… wat.) However, I gained some respect for the power of building queries step-by-step, especially when Eva and I stumbled across the finish line and read through the solutions. One of the validations we struggled with was addressed by defining the
SELECTlogic and the
JOINlogic separately from the heart of the SQL statement, then glued everything together, firing off a single db query at the last possible moment. Pretty neat.
I'm a bit concerned about the upcoming assessment (this Wednesday, although I need to do at least one practice run tonight) because it's clear that it takes me a minute to spin up when it comes to starting work in Rails. I have time to practice, and as long as I make use of it, I should be fine.
Today's partner: Ed
Today was our first exposure to Real Rails™. We delved into ActiveRecord and creating relations between our created classes and their associated tables (created via migrations).
Setup is pretty straightforward: specify your database during creation, or edit the .yml file to specify your database because you're dumb and forgot to throw rails the configuration option, then get to writing migrations. It's clear that rails is designed around a fast iteration cycle, either Agile or TDD, because just about every action has an easy way to build up, reload, or rollback.
But that's not really what today was about. Today was about trudging though a lot of examples of the most basic Rails structures, which are superficially similar to their SQL roots and the code that's created when you create raw SQL glued together with Ruby. It's certainly nice, and we learned a lot about the basics of Rails, but it felt kind of like a slog because it never went much of anywhere… yet.
So this weekend, I'm going to try to re-read Hartl's tutorial alongside the pre-readings for next week to try to build some excitement for what Rails can do. I know it's powerful, but I don't feel it yet.
Today's partner: Michael D.
Unpacking, since I can't actually remember what we did today:
I know this isn't the point of appAcademy, but today was the most fun I've had since we started. Michael and I were cracking up about mistakes and ruby/SQL absurdities all day.
Yeah, so we were doing something with SQL… I thought populating the test database would be more onerous than it was, but really it was a couple
INSERTprocedures copied over and over.
Oh, I remember now… so we made basically a tiny reddit clone, using database accesses on an SQLite3 instance. By reddit clone, I mean a class structure with Posts, Users, and Comment trees (
Replys), where we had to write procedures to translate between stored and active objects. It was very educational, but similar to yesterday in that it was a straight walk through the instructions, implementing some calls that were well within our understanding of SQL and Ruby. Certainly nothing earth shattering, but the practice was good.
In not quite unrelated news, I've been meaning to get my financials in a format I can actually do something with… I think I have just enough tools to start doing something interesting with my data. A CSV parser, an SQLite3 instance, and a lot of ruby code, and I could probably do some pretty damned cool stuff :)
Today's partner: Justin
A good day. The assessment started out okay: I got through 90% of the coding in under 30 minutes… then I choked and couldn't scrape together enough bugfixes to make the last test pass before time was called. After crushing the practice assessment over the weekend, it was a bit weird to have such a turn of events this morning, but it just makes it clear that I need to continue practicing: ruby, rspec, and whatever else we're going to be learning. It needs to come easy, and I need to triumph over my demons of both attention, and attention to detail. (Did you know '8' is different than
:eight? Crazy! Crazy eights!)
So I have to do a three-line bug fix and re-submit before 9:00 to get that last point. Hooray?
It's telling that by noon, no one was talking about the assessment anymore. SQL was quite the leap for just about everyone, and even though when I listened around it seemed like we were all on the exact. same. exercise at each moment, it turns out there was a lot of hair-pulling and gnashing of teeth at other tables.
My partner and I didn't have any particularly noteworthy trouble, but there were some hairy
JOINs that took a bit of digesting to grasp. Again, I know that I don't understand SQL completely yet - sometimes it feels like a matrix language, with all the associated transformations; sometimes it feels like a procedural language full of loops—but I can guess out what a statement is going to do if I can access the schema. So, hooray.
I'm actually really excited about tomorrow's SQLite lesson. I keep hearing about SQLite in desktop and mobile app development, and now that SQL doesn't seem such an impenetrable barrier, if I get the hang of things tomorrow, I could theoretically look into learning Obj-C or Swift at some point and actually start making money off development ;)
That is all.