The Sinatra Car Maintenance Tracker is my first real web application, utilizing the Sinatra framework, Rack, and Active Record. I went through a number of different ideas (exercise tracker, chess game tracker) and rebuilt my application several times before I finally settled on the car maintenance tracker. Basically, it allows a user to keep track of the maintenance records for their vehicle. As a car owner (1999 Honda Civic), I’ve never been good at tracking my maintenance (I’m one of those people who prefers to do the maintenance myself, instead of taking it to a mechanic).
After a brief pairing section, I have made some updates to the original gem and am proud to release Version 1! Most of the changes involved refactoring the code, but I’ll list the Steam Upcoming gem updates here:
It wasn’t an easy decision to make. But I’ve never been happier. I decided to switch my career to Web Development for several reasons:
– I was experiencing a growing lack of fulfillment in my previous occupation, since I was in more of a managerial role and not as hands-on with production
– Web development is an in-demand skill
– It’s a well respected profession – web developer’s are like the tech industry’s rock stars! (okay, that might be an exaggeration)
– On a personal level, it’s important to understand the foundations of technology, which we interact with every day
I consider the Steam Upcoming gem to be my first legitimate project in Ruby – creating a Command Line Interface (CLI) gem from scratch! It was also my first opportunity to code an application using a Git and test driven workflow.
I decided to use Steam’s Upcoming Games page as the basis for my gem – the Steam Upcoming Gem, which scrapes that page for a list of upcoming games on the Steam platform and allows the user to drill down into more information about each game.
I started the process of building the Steam Upcoming Gem by analyzing what my requirements should be. The listed requirements were:
– Deliverable must be packaged as a gem ✓
– Deliverable must provide a CLI on gem installation ✓
– The CLI gem must provide data from an external source, such as via scraping or an API ✓
– Data provided must go at least a level deep, generally by showing the user a list of available data and then being able to drill down into a specific item ✓
I initially considered using an API but decided to gather the information via scraping as I am currently more experienced with that (though I love a good challenge!). I then had to decide what I was going to build. I knew I wanted to do something different, interesting, and challenging.
I settled on scraping information from Steam, a popular online platform with a massive online catalog of games for purchasing, playing, and sharing. While not an avid gamer anymore, I do enjoy playing video games when I have the time and figured this would be a fun project to work on that might be useful as well (my wallet might disagree).
The next step was to define what information the gem would scrape and what functionality it would have. I settled on the following information to start, though I did want to do more:
– Game name
– Release date
– Platform (Windows, Mac, Steamily, Linux , etc)
– About – description
– Details – other info about the game (single player, multi player, VR support, etc.)
After defining the information I wanted to capture, I started coding my classes, methods and tests.
Once I had a basic CLI application working , I started to do some refactoring. One of the major issues I identified was the application load time – up to 15 seconds to load the results! The original code I wrote would scrape the index page, create the game objects and list, and would also create all the attributes for all the games before finally displaying the list. I realized this was terribly inefficient and decided to refactor my code so the gem would only create and display a game’s attributes when it was selected by the user. This greatly improved performance and decreased the load time from 15 seconds to about 1 – 2 seconds (depending on Internet connectivity speed).
I also added in some of the functionality I thought would be in version two – the ability for users to load additional pages of results and a page tracker so the user knows what page they’re on while sifting through the results. I also added error messages for users if their input is invalid.
Finishing Touches and Wrap Up
At the end of the project, I reviewed all my code again to add comments and simplify the code where necessary (eg removing unnecessary lines of code and any simple refactoring). I also used the Colorize Gem to add color to the gem and make it more visually interesting. Check out the Steam Upcoming gem on Github and Ruby Gems.
Thoughts for version 2
Ability to sort the results by Release Date, Name, Lowest Price, Highest Price, and User Reviews.
Include the total number of upcoming games when the gem loads.
Refactor the “page” command so a user can type “page [page_number]” instead of the page command, then the number separately.
Suggestions for the Steam Upcoming Gem? Leave them in the comments or shoot me an email at firstname.lastname@example.org.