I have decided I want to start reflecting on the books I read, in the form of a blogpost, before moving onto the next one. Just a brief summary of my key takeaways from the book. Currently, Rails 5 Test Prescription by Noel Rappin is giving me a look of betrayal from my iBooks bookshelf, waiting for me to finish drafting this.
I just finished reading Agile Web Development with Rails 5.1 by Sam Ruby, David Bryant Copeland, and Dave Thomas. It is a great book for building a good foundation of knowledge in Rails and web development. Before I get into the content of the book, I wanted to give some context about me.
I’m about 3 years into a slow, steady absorption of all things software engineering, including college courses, video tutorials, books, and online documentation. I have a basic understanding of many fundamental computer science and programming concepts. I completed a 10 week internship program at 8th Light over this past summer that was incredibly insightful and helpful in my software journey (read more about this here).
At the end of the internship, I applied for a full-time position at the company and failed to secure a spot in the upcoming group of apprentices. Upon introspection, I failed in my interview. My answers were fractured and sometimes tangental to the questions asked because I did not prepare myself. “What should I do next?” I asked myself following my failure.
I wanted to build my own application to show off my skills. I knew I could make a simple Rails application due to my exploration of Rails during my internship, but I wanted to know more. I wanted to avoid coding by coincidence. I wanted to know the full capabilities of Rails and the ‘best’ way to create a Rails application. That’s why I chose this book. I decided to seek depth and build upon the knowledge I already had - I was going to build the best Rails application I could.
This was probably the longest technical book that I’ve read cover to cover. This was mostly due to a realization that changed my perspective of technical books. I’ve known for awhile now that I learn the fastest when I get a chance to observe other people. I began to perceive technical books in this light. Reading one of these books is a chance to observe an author’s practices - sit over their shoulder and watch them work while they explain what they’re doing. This motivated me to read the book cover to cover, even though I could have skipped some chapters, such as Installing Rails and Introduction to Ruby. For the first time ever, I enjoyed reading through content I already knew - it gave me a peek into the mind of the author.
One of my favorite things about the book was in the second part, “Building An Application”, where I started building an online bookstore application with the authors. They define a few initial use cases/stories and we create a new Rails application. What made it my favorite was that it followed an incremental development process. Small parts of the application were defined and focused on. Each section of this part from that point forward was a small iteration of features: adding, fixing, and removing things that the client points out when the application is shown to them after each section. This was the Agile in the title of the book.
I also love books that challenge me. At the end of each section within the application building part of the book, there are “Playtime” section - a handful of challenge problems. These were fun and adequately challenging. They helped encourage learning through exploration.
I also gained a lot from all of the testing examples throughout the book. I can’t get enough of testing. Sometimes we wrote tests first, sometimes we wrote tests last. It was important to have tests, but the order is not as big of a deal as long as the scope stays small and things maintain a single responsibility. Unfortunately, all of the examples are in minitest and I would have preferred RSpec, but that isn’t a big deal. Why not learn 2 test frameworks? You don’t get to choose legacy code frameworks. This book was also the first time I had been exposed to Capybara and integration testing in Rails. I was blown away when I ran my first Capybara test and saw Chrome open up and run through my application automatically.
The sections on RSS feeds and e-mail support (sending/receiving) were interesting as these were capabilities I didn’t know Rails had. The user/password management sections were very helpful in helping me understand how to build that into the application I’m currently pondering.
The most difficult chapter for me was the chapter on deployment. I was able to get Apache and Phusion Passenger to work, but I didn’t know enough to actually access my application from a separate machine. The book assumes a lot of background knowledge about this. The first part of this chapter only shows you how to install and configure an Apache httpd server on your computer. Then, it jumps from “Apache is running” to “now you can access your application on another computer” with no explanation of how to set things up for this purpose. I still worked my way through the chapter, by following the steps. I figured I was doing things correctly as I wasn’t getting any error messages while configuring the server software - I just didn’t know anything about hosting or accessing the server so I had no way to visually confirm anything being successful.
Another part of this section of the deployment chapter shows how to replace the Rails default database, SQLite, with MySQL. This was fairly straightforward and introduced some interesting database management practices (mainly learned how to create database users and give them permissions for specific tables). There’s a lot more for me to learn about relational databases, and I hope to conquer them some day soon.
The second part of this chapter covered Capistrano. This seems to be a very powerful tool that, once configured, allows you to update and deploy your application remotely. Unfortunately, I was unable to see the final result of this work because, as I previously mentioned, I didn’t have a server or host for the example application that I build while following the book. I was really impressed by the functionality and how easy it all seemed to get “Capistrano to do its magic”. The book also covered how to use the rails console or the log files to check up on a deployed application - something that I can see being very useful.
Thankfully, not all was lost to me not having a host/server for the example application. The final section of this chapter introduced Heroku. I had heard about Heroku and was very excited to finally be learning about it. Although the book’s tutorial was slightly outdated, I was able to leverage Heroku’s documentation for all of the steps from the book that didn’t work. I was amazed at how easy it was to get my application up and running. The streamlined process blew my mind. I will probably be using Heroku to launch my personal application when I get around to making it!
The third part of this book, Rails In Depth, was a deep dive into the components that makes Rails work. Although the first and second part of the book provided some valuable insights (adding React, integration testing, using Heroku for example), this third part of the book was the most important for me. When I first picked up this book, I really wanted to get a good understanding of how Rails works. After reading this part, I believe I got exactly what I wanted from it. In this section the authors explore the directory structure of a Rails application, Active Record, Action Dispatch (routing) and Action Controller, Action View, and database migrations.
The chapter on the directory structure of a Rails application explains where things go. This is valuable, because when I first encountered a Rails app, it was a bit overwhelming and intimidating to see all these folders and not know where to start adding your features. This chapter does a wonderful job of breaking this all down.
The next chapter is on Active Record. This was maybe my second or third exposure to the concept of an object-relational mapping, but my first detailed explanation. There are some really awesome conventions that Rails uses to communicate with a database. There is a lot to this chapter and it is all extremely valuable information. Six months ago, I may have been intimidated by all of it, but I finished it with confidence in what I learned.
Routes can be tricky, I know this from experience. Especially if you’re trying to create new pages by copy-paste-coding (I hope I’m not alone in being guilty of this as a newbie coder 😅). The chapter on Action Dispatch and Action Controller does an excellent job of explaining Representational State Transfer (REST) and its purpose in a Rails app. It further explains how requests are processed, how to create new routes, how to define new actions within controllers, and how to create new controllers. One thing I’m very glad the authors covered in this chapter is sessions. My first exposure to sessions was during the second part of this book when we were creating Cart functionality for the tutorial application. This chapter really helped my understanding.
Did I mention that I absolutely loved the third part of this book? It extends to all of the chapters, including the next chapter on Action View. The authors explain templating and all the different types of templates available. They deep dive into the creation and processing of forms. They even explain how to upload files to a Rails app. Then there’s a section on helpers. I was amazed by how many built-in helpers are available to Rails. They also dive into templating and partials, good tools to DRY out your application.
The next chapter on migrations is also extremely good (I feel like a broken record of praise for this book). I previously had the impression that I would have to design my database perfectly before starting an application. Something wrong with my fields? Scrap the app and start over (in hindsight this is silly, but it is what I believed). This book preaches a much better development practice - one rooted in Agile. This chapter gave me the background knowledge I needed to use an iterative style of development for a database. The authors explain how migrations work and how to change your database after it’s been created. Discovering the rollback functionality gave me some much needed confidence to experiment with databases.
The last chapter focuses on common extensions for Rails. I personally like and have experience with RSpec, but almost all of the tests in this book are written in minitest. I was very excited to see a section on replacing minitest with RSpec. There were other things to this chapter that I’m not sure I’ll be needing in the immediate future but were probably valuable to learn about anyway.
To conclude, I absolutely loved this book (could you tell?). It was extremely helpful in building an understanding of Rails. I would definitely recommend it to everyone that is interested in Rails, or web development/frameworks in general. This summary here will help me reflect back on my progress as a developer. I’ve also taken notes so that I can quickly reference back to the appropriate sections if I ever need to revisit any of the concepts in this book. I honestly can’t wait to start building something, but I just want to read one more book beforehand to improve my knowledge of testing.