DBC Phase 1, Day 14
A fairly short post today. Here’s the big news:
I’m moving on to Phase 2! Woo! I’m feeling good about the program and my understanding of everything, but we’re now going to be venturing into all new territory that I haven’t seen before. Prepare for lots of posts where I pine for the days of Phase 1, when I was only a little lost.
The morning lecture was a bit of everything regarding Active Record. We looked at migrations again, and talked a bit about building your app to include the four basic commands: create, read, update, destroy, or CRUD.
My pair and I had a pretty good understanding of what needed to be done, but I was surprised by how fast we were going through the challenges. We needed to build a To-Do list, similar to the one we built last week. However, we needed to build it to access the SQL database through AR instead of loading through a CSV file. The skeleton was already built, so we just needed to build the actual functionality. The migration file was easy to build, and so was the model file. We spent all of our time building the actual List Class, which could house all of the individual tasks that we created. We added CRUD commands, as well as a few extra tools like sorting, categories, specific tags, etc. This was both the morning and afternoon challenge, so once we had a working prototype, we started implementing the additional features immediately.
Lunch, yoga, afternoon lecture. This one was a sort of booster session on some Active Record commands, so my pair and I decided to exercise our right to leave. We already had a good understanding and knew where to find answers if we got lost. We continued to add features to our app and began splitting it apart into files that would adhere to the MVC architecture. By 4pm, we were done. You could call the app from the command line and it would give you options like ‘add task’, ‘complete task’, ‘view all’, ‘view incomplete’, etc. Pretty nifty. If we were going to spend more time on it, we probably would add functionality for having multiple users that could each access their own list. We already had that capability through the ‘categories’ option, but being able to access a separate table of tasks would be interesting.
Our last challenge of the day had us getting into the Rake Console inside Active Record. Instead of using SQL commands to access the database, we could use AR commands that would interact on our behalf. Technically easier, but since we didn’t know all of the AR commands, we ended up spending a lot of time Googling. There are certainly a lot of ways to interact with the information, but I ended up finding a particularly useful, if not sneaky, option: ‘#find_by_sql()’ allows you to provide the actual SQL command as an argument and give you exactly what you need. It’s not the easiest way, but it’s certainly useful until I get more comfortable with AR commands.
Tonight was DBCx, the lecture series. We were treated to a very interesting (though long) talk from Laurie Voss, the CTO of NPM. He’s only a few years older than I am, but has been coding for 19 years and is incredibly intelligent. He spoke for about two hours (!) on some best practices when it came to web development. Stuff we don’t know, but should. Some of it was a little above our heads at this point, but for the most part, there was a lot to take away from it.
All in all, an eventful and successful day. Until tomorrow, I’m Edwin Unger, and I’m a web developer in training.