'A Code to Joy': My First Portfolio Project

Posted by hambrice on January 17, 2018

I have to start by saying I had so much fun with this project.

I’m always one for looking ahead and trying to mentally prepare for what’s to come (I’ll admit it, I was a Christmas present peeker as a child). So even before I had gotten to the CLI Data Gem project properly, I was already racking my brain for what I would do, while also terrified that I would have no idea where to begin. However, by the time I had completed Music Library CLI, Tic-Tac-Toe, and Student Scraper labs, I felt prepared to tackle the task at hand.

My first plan was to basically make a fully-functioning search engine of the Craigslist website. It was an amibitious task, but I was pumped to try it. I mapped all the functionality I wanted for it (picking any city/region via input, allowing for price ranges.. I was even planning on building a cart that could store potential items you were interested in!) I spent a lot of time mapping everything out in my head before I finally sat down to start writing the code to scrape the website, only to discover for some reason the nokogiri gem didn’t seem to work with the Craigslist domain (the jury seems to still be out on if nokogiri actually doesn’t work on Craigslist or if there was something off with my code, though in my defense I tried it with numerous other domains and had no issues.) In any case, I was discouraged because I hadn’t considered many other back-up options.

After doing a lot of aimless googling and toying around with a few ideas, I started to ponder building a vocabulary quiz game that would scrape words and their definitions from vocabulary.com. The idea felt kind of boring to me at first. Who would actually want to play this? But by this point I had wasted a lot of time on trying to come up with a genius idea instead of actually writing code, so I made myself dedicate to the concept with the condition that I could always try something else out later.

It’s an understatement to say that I got sucked into this project. I loved getting to create something that had previously only existed as an idea in my head while starting with a blank slate. Not only that, but something about the whole process just felt so effortless. Don’t get me wrong, it took a lot of hours to get everything right. But I think it speaks to how much I’ve learned so far that rarely did I ever get stuck staring at my screen, wondering what on earth was wrong with my code or how to accomplish a task I wanted to complete.

One of my favorite aspects of my project from the technical side is that I think (and hope) I did a really great job creating the classes of objects that I did. I beiieve they all integrate perfectly, and their relationships make a lot of sense. A Scraper builds a Dictionary, a Game has a Dictionary and uses that Dictionary to build a Question and a Game has many Questions. A Question has an answer and options attributes and keeps up with its own answer. It was challenging at first to be sure. I built from the ground up, starting with the scraper and ending with the CLI. But by doing that, all of the previous objects were almost nested inside of each other in a weird way. In order to call a new Game class in the CLI, you had to call it with a long, nested chain of variables so that everything would instantiate. It worked, and I was so excited to see it work. But it was messy. And I hate messy.

I probably spent more time on cleaning up my code (and even the presentation of the CLI) than I did on actually building the core structure of the game. As an aside, I really just want to brag on myself because one of my favorite parts of what I built was that while I wanted the game to come with pre-programmed options for vocabulary lists to use, I also wanted it to be more open-ended with dictionaries. So what I love about my program is if you don’t like any of the options for vocabulary lists that are given, you can just supply your own! Just by pasting in the url of a list from vocabulary.com, it can build a dictionary out of (seemingly) any list on their website.

Truthfully I had to stop myself from getting into it. As I was finishing everything up, I started to consider all the other things I could (and wanted) to do. Multiple players? That would be awesome! Collects words you missed and allows you to practice with only those? How hard could that be?! But I realized at some point I’ve actually got to stop and just hit submit, and I have to say that so far I’m pretty happy with the end result!