Writing My First CLI Application

Halle Montgomery
3 min readFeb 8, 2021
Photo by Markus Spiske on Unsplash

It wasn’t easy. It was messy. It was time consuming. And…it’s not finished. I ran into the biggest obstacles with the smallest things such as iterating through hashes, or remembering which steps to take to actually pull the data from my API. I want to talk about the process I am going through while trying to complete my first CLI project and things I intend to implement in the future to improve my workflow, troubleshooting, and overall coding experience.

The biggest part of this was the choice of API I made for my very first project. The learning curve took up most of my time, and by the time I finally had the time to work on my project, it wasn’t quite enough time to fully flesh out all the problems I had. This taught me that I shouldn’t plan for anything and know that, what I originally planned, might not happen the way I expected. I had my project planned weeks in advance, just to find when it came time to actually write my project, I would be riddled with issues I hadn’t foreseen. For example, the API I used for the Hearthstone Deck Builder, require an Authorization code that expired every 24 hours, and every search request had a different set of parameters for me to utilize by changing the URL of my pull request. This alone took a day for me to learn and to realize that my OAuth token was expiring! On the bright side, I fully built out my API class and successfully pulled the data I wanted, I just had trouble with establishing the connection between my API class and my Card class. When I tried to utilize metaprogramming, I was unable to get the desired result(the name of the cards that match my search query) and knew that if I had more time, I would have been able to get to the result I desired.

The second roadblock I faced was dealing with time management. Believe it or not, although I am only a part-time student, I also work full time, and freelance to take care of my household. Work, life, social balance is something that I have learned I seriously needed to take into consideration with this project. As I stated before, I planned my project in advance, knowing I would have less time to work on it than normal, due to a previously scheduled event in my life. Even though I worked on it for many days, I struggled, searching for the answers on Google and working through problems one step at a time. Knowing when to step out and ask for help would have greatly increased my chances of success, which brings me to my third and final realization: I learned a lot.

Although I did not finish my project, I know the material. That is a fact. I remembered concepts, I remembered how to debug and troubleshoot my program with binding.pry and working through my code, step-by-step, instead of trying to guess what my errors were or where they were coming from(even if Ruby does provide a quick and resourceful way to detect your errors in the terminal). Once I got the correct data pulled from my API, sorting the data into one hash formatted in the way I desired was quite simple, breaking down each piece into its key/value pair and then returning another hash {deck_hash} in order to try and make the connection to my Card class. This is where the disconnect began and I hope to figure it out.

I am happy with my progress and hope to refactor my project and continue to work on it with success. It has the potential to be a great project for my portfolio and showcase my talents as a developer. It was an enlightening experience, that was challenging, fulfilling, and overall taught me what I am capable of.

--

--

Halle Montgomery

I am a Graphic Designer learning software engineering and UX to create ethical, quality life for those in underrepresented communities.