CLI Gem Project

Breweries Near Me

Posted by Nolan Hughes on December 19, 2017

This was definitely a tough project. There’s no question about that! It gives you more free range than any of the labs up until this point, but that doesn’t necessarily make it any easier. I’ll go into the dirty details below.

So I wanted to make an app that lists top rated breweries. The user inputs a city, the program lists top breweries in that city and then you can see a summary of the brewery of your choice and their top rated beers. My initial idea for this project was to scrape from the BeerAdvocate website because it has all of the information that I needed. I quickly ran into troubles.

While I was on a page for a specific city, there wasn’t any way to instantiate a city object with the correct name. It was odd that there wasn’t a header with the city name, and instead it was just the state where the city resides. My only option was to scrape from the first brewery’s address in the list. Maybe my knowledge of scraping isn’t that good, but for the life of me I couldn’t extract the city from the address. There were too many variants of street, avenue, and boulevard concatenated onto the beginning of the city in the string to make it manageable.

This led me to find an API called breweryDB. It is an extremely large database of breweries and beers from around the world. It doesn’t have any ratings associated with the beers or breweries like BeerAdvocate does, but I may add a feature later to cross-reference the API and BeerAdvocate.

Before I actually started pulling data from the API, I created basic versions of my classes and was passing in “fake” data that I hard coded into my objects. This was an extremely helpful technique because it got all of my class relationships headed in the right direction before I started working with large amounts of data that wasn’t right in front of me. Later on in the project I almost wished I had waited longer to start instantiating “real” objects from the API because it was more difficult to debug when I had to deal with multiple city objects that had up to 50 breweries objects each, all of which had three beer objects.

The bulk of the work consisted of figuring out where my methods should live, how to call everything, and transferring data between classes. I feel like this is where I might be lacking the most in my programming knowledge. While the code I wrote works, it doesn’t always seem elegant. But, after loads of hours, some more frustrating than others, I had completed my project. Hopefully taking a few days to step away from it and coming back after an assessment will give me good insight on ways to improve. Overall I really enjoyed working on this app. I can’t wait to start refactoring with a Flatiron instructor and adding additional features later on to make it even more amazing!

Here's a link to the repo on github if you want to take a look at the code or play around with it yourself.