Final Project: CLI Data Gem

Learn Verified requires you to complete 4 final projects in the Ruby Object Orientation section. Thus far, I've completed 2 that required me to build a "Music Library CLI" which was heavily focused on domain modeling and collaborating objects, and a "Student Scraper" which focused on using Nokogiri. Then there is the "Tic Tac Toe with AI" project that requires pair programming. Since my boyfriend is doing this course too, I've decided to wait for him to catch up before tackling it. Side note, I am quite intimidated by this one! This leaves me to discuss the final final project,"CLI Data Gem". 

Requirements:

  1. Package as a gem
  2. Provide a CLI on gem installation.
  3. CLI must provide data from an external source, whether scraped or via a public API.
  4. 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 into a specific item.

I am ALMOST finished with this project, but I would like to request a code review before submission. This is the first ruby gem I've ever made, and really the first project I've created without following a step-by-step guide. However, when the going got tough I reached out to a few lovely programmers I've met along the way! I may as well buy a stack of thank you cards; I can tell that they'll come in handy throughout this journey. For this blog post, I'm going to review my gem and share some great advice bestowed upon me by my mentors! Shoutout to Chris Lloyd (friend I met at Railcamp) and Jay McGarvin (my guide from Rubyconf)! What I love about them both is how they are willing to point me in the right direction and jog my problem solving skills, without just giving me the answer. They let me figure it out whilst offering support and encouragement.

During this past year I've transitioned into a vegan lifestyle. (LOVE IT, GO VEGAN!) Being vegan is actually really easy whilst at home, however my recent travels showed me that eating out can prove to be a bit challenging. This inspired me to create my gem, Vegan Restaurant Finder! To be completely selfish, I TOTALLY created something useful for myself. I wanted to be able to type in any zip code and have a list of local vegan establishments pop up. Then I wanted to be able to select from that list to learn more details about that specific choice. After days of fun/frustration, my program finally works! PS. You'll probably need to maximize the following youtube video to see it in action.

My program works but it's not 100% complete yet. Upon submission I will be required to meet with an advisor for a code review/demonstration where we will also be refactoring my work for improvements. Additionally, we will be writing tests for my code which I have very little experience with. I suppose I'll come back to update this post once that bit is done. 

CHALLENGES:

There were a couple of notable challenges I faced while building this project. Initially I approached it with Nokogiri in mind. I was going to scrape HappyCow.net and became completely annoyed because I knew exactly what I wanted to do and understood idea behind scraping a website, but I was having a hard time actually getting results. Then I learned that a vegan-friendly food API was available. But I haven't had much experience with APIs, and this one in particular produces results in JSON, not Ruby. 

Another challenge I faced was one that shouldn't have stumped me, but for some reason it did for longer than it should've. I needed to drill down further into my list of restaurants by creating a hash of each restaurant's data, by iterating through another hash. Again, I knew exactly what I wanted to do and was even able to articulate it, physically drawing it out, but I think I let my frustrations get the best of me. I couldn't wrap my brain around it until I was able to calm down.

I haven't done a good job with domain modeling. I suppose it's not stated as a requirement but we've been doing so many labs with it lately that I feel like I should make use out of it?

TAKEAWAYS: 

  1. When I reached out for some help with my first problem, I was a bit embarrassed about sharing my code; it was (and still is) pretty sloppy. Then I was reminded that my #1 priority is to make it work. MAKE IT WORK! ... ALAS, IT WORKS! :D
  2. Before you even begin to code, write out your goals and the steps/options you'll need to take to achieve them. Code each step one at a time until all are passing.
  3. When you are frustrated, sometimes it helps to walk away and take a break. Also, it helps to explain what your problems are out loud. You could even do so to that cute rubber duckie whilst taking a relaxing hot bath, which is great; he won't judge you.
  4. Use Google... a lot! And/or pick the brain of an experienced programmer and pay it forward later.
  5. If there is an option to use an API, use it. Nokogiri is awesome but you are at the mercy of that site's development team who owe you nothing. If they decide to make changes, or even delete their site, your app will be screwed. Whereas API data tends to be more stable. 
  6. "RTFM" - Read The Fucking Manual :) Slow down and read. Most of the information you need will be available in a README file or user manual. 
  7. Learn about the operations happening under the hood. Being able to understand HOW something works on a deeper level will make you a better programmer. 

That's all I have for now! I am very proud of this little gem (yes, pun intended) and I can't wait for it to launch! Next up, SQL...