DEV Community

JillKlatt
JillKlatt

Posted on • Updated on

Meeting Requirements

Our very first project required quite a few different aspects. I was confident as I looked over the checklist, but the execution proved my confidence superlative.
We've learned so much in the past few weeks, and I assumed this project was a culmination of all of that, which in some ways it is, but in others (like using object orientation over procedural), it definitely was not.
On day three my code looked like this:

cocktail_name = response_hash["drinks"][0]["strDrink"]
cocktail_instruc = response_hash["drinks"][0]["strInstructions"]
main_ingredient = response_hash["drinks"][0]["strIngredient1"]

Notice anything suspect? I was reaching into my API, pulling out information, turning it into an object in a new class, but then when it came time to display that info, I just scooped it out without using the object at all!

Luckily this was identified and I was able to make it prettier and actually iterate through the Drink class I spent time making:

if @input.to_i <= Drink.all.count && @input.to_i > 0
puts "YOU GOT THIS!".colorize(:blue)
puts "-------------"
puts "The main ingredient is #{Drink.all[@input.to_i - 1].strIngredient1}."
puts "Along with #{Drink.all[@input.to_i - 1].strIngredient2} and #{Drink.all[@input.to_i - 1].strIngredient3}."
puts "Here's what you're gonna do: #{Drink.all[@input.to_i - 1].strInstructions}"

At this point I had felt like my project was basically complete, so to learn I wasn't actually meeting the requirements I was crushed. As my cohort lead pointed out, it honestly was an easy fix, but the feeling still crushed me.

I feel as if I fluctuate between devastation and overconfidence, and I'm still struggling to find that balance and just embrace being uncomfortable. But we'll get there! I can't believe how much I've learned in such a short amount of time already.

Dancing Wizard Gif

Top comments (0)