Always Learning

Jillian Short
5 min readMay 14, 2021

AUGUST 28, 2020

Alright, folks. Here comes the software engineering blogging! But there are still some great lessons in here, so stick with me.

So the last two weeks marked the first “project mode” for my Software Engineering course. I was feeling really excited about it! I was also super nervous, but I kept reminding myself that there was so much support available to us, and I’d have no problem getting things done if I just stuck to my schedule and asked questions when I needed to!

Wouldn’t it be great if I had done that?

It would have! But I didn’t. Life got busy, work got busy, and I allowed myself to panic a lot more than I knew I needed to. I cried a couple of times because of the unnecessary panic, and I definitely went down a not-great rabbit hole and got myself pretty stressed out. I scrapped one project, and started over, stressed some more, but!

Here I am now with a completed project that … wait for it… works!

So here’s what we had to do:

  • Create a CLI interface
  • This must go one level deep and get information from a website via scraping or an API

That’s a very bare-bones explanation, but here’s what I decided to go with after switching ideas a week into project mode.

I found a fun and pretty simple Cocktail database. I used to bartend, so I thought that was something I knew a bit about and could understand what a user may find useful from something like that.

First I built my command-line interface, CLI, class. The CLI welcomes the user and asks if they need some ‘gin’spiration (because that’s hilarious). The user inputs ‘y’ or ’n’, and obviously no just exits. But yes will release a random cocktail from the database. It gives the user the name, ingredients, and instructions for each cocktail.

Then it asks if they would like another round and if they say no, it exists. And if yes, it starts over again with a new random cocktail. Great!

Next, I went to deal with my API class and figure out how to get the information I needed. The database had an endpoint link that generated a random cocktail with each refresh. So I chose that link. I opened that link in a new tab to see what the data looked like. Unfortunately, the data was a hash, inside an array, in a hash. I’m not going to lie, it took me quite a while and some trial and error googling to figure out how to get the data I wanted out of that.

Once I found out how to get the name, and instructions, I started tackling ingredients. This one was interesting because the hash listed up to fifteen ingredients, but the amount always varied. Because of how the data was set up, I decided to write a line of code that returned each ingredient 1–15 and then shoveled it into an ingredients array.

I did mess with the idea of adding the measurements for each ingredient, however, this database did not use consistent units of measurement so I had to let that one go as I did not think I had time to run down the rabbit hole of creating a way to convert measurements so everything returned in ounces. Bummer. But onward.

So once I had my API class put together, I called a new instance of my Cocktail class and began building that.

It took me some time to think through the things my Cocktail class would need. I definitely overthought that, but good old binding.pry reminded me the Cocktail class was just a place initializing and storing instances of a cocktail for my CLI to call on.

So I created an initialize method so every cocktail object would start with a name, ingredients, and instructions. I also created an @@all array, with a save method so the cocktail object would be saved. And a get_cocktail method, so the API class and Cocktail class talked to each other.

The challenge here was when I added the line in my CLI class calling over to the cocktail class to retrieve the cocktail object, my ingredients returned with all the nil values I didn’t want, and they were listed with brackets and double-quotes. Not very pretty. So I went back to the initialize method and told it to .compact the ingredients array. This got rid of all the nil values, great! Then I added a .join with the argument (‘, ‘) to convert each element within the array to a string value, and then the argument added a comma and space after each element. Alright! So all of my values appeared in the CLI properly!

At this point, I just added finishing touches like \n to add nice spacing. I also used a few sleep()s throughout the CLI class to slow down the returns and make the program more user-friendly.

Holy cow a working program! I wonder what feedback I’ll get. The next step is assessment, and that’s honestly the most nerve-wracking part! But, I want to just hear what my instructors have to say, and remind myself that I’m learning here. So it’s ok to make mistakes. And it is absolutely a great thing to get constructive criticism. Where is Brené Brown?! I think I’ll need some of her wisdom here.

Beyond coding, I learned a lot here. I learned I still panic and stress about big projects if I feel even REMOTELY behind. Here’s the thing I wasn’t ever behind, but I convinced myself I was. And I was afraid to fail. I started distracting myself with things that were NOT important at that moment. But they were a way for me to avoid the project. Classic move. The worst part was, I literally saw myself doing it. But I did it anyway. And when I dug deeper and asked myself what might have been making me do that, fear of failure was the response. My fear of failure kept me from just putting my head down and getting the work done. It kept me from asking for help when I needed it.

I hate the idea of failure. Which is STUPID. We all have to fail, that’s how we learn. We all have to ask for help sometimes. I offer help to people all the time! Speaking of Brené Brown here’s what she has to say about that,

“How many of you would rather give help than ask for help? Let me just ruin this for you. When you cannot ask for help without self-judgment, you are never really offering help without judgment.”

OUCH! But read that again. It’s so true. It makes me feel like an asshole, but it’s true. I am almost always willing to offer help, but I HATE, LOATHE, ABHOR (you pick your favorite, hell throw some more in there!) asking for help. And that’s not ok.

So! Things to learn for next time (coding aside):

  • Stick to the schedule
  • Ask for help, without judgment of myself

Oh great, only two things! But that last one is heavy. The last one will take some work for me. Life’s lessons appear in so many different ways. I’m learning a lot more than coding right now, y’all. Time to be a good student!

Don’t get me wrong, I’m proud that I got this done and I have a working program, but there is always room for improvement. In my code, and in me.

Until next time (probably project mode #2)

Boldly go,

Jillian

--

--