On the surface I haven’t really done anything with the app yet. It’s basically just four simple pages—but there’s quite a bit going on beneath the surface and I’m really enjoying the progression.
Some Take Aways
- Further explanation of the MVC framework and exposure to REST principles
- Introduction to Don’t Repeat Yourself (DRY) principles
- Introduction to Test Driven Development (TDD)
The best epiphanies of this chapter came through TDD (partly because I’ve had a decent amount of exposure to the others). Learning to write a test that fails and then sequentially making changes until the test passes…is pretty interesting. Here’s an example of how that might look:
Step 1: Write a failing test for a new Contact page
Step 2: Run test suite
error: [no route matches "contact"] Ah-ha!
Step 3: Go back and add the contact code to routes.rb
Step 4: Run test suite again…
error: [no action matches "contact"] Ah-ha!
Step 5: Go back and add the contact action to the static_pages controller
Step 6: Run test suite again…
Step [x]: Pass! (high fives)
I can see how developers might find this cumbersome and repetitive…but I can also see how it would be greatly beneficial when writing large complex applications. Plus it’s super helpful when learning how all of the pieces link together in this lesson (this post is mostly just beneficial to me for now…).
Still, excited to learn more!