International News Finder: my first application

Jonathan Block
2 min readMar 8, 2021

After much trial and error, I have finally achieved the milestone of creating a functional Command Line application for my very first Flatiron School Software Engineering project. Its goal is to search for the latest news articles by country for the user to access directly. Overall, this first attempt at functionality and error handling felt pretty satisfying. However, it didn’t come without an endeavor of making the program deliver the proper output for the user.

The first step of the application is to receive and validate user input. The user is given a prompt to enter the country code of their choice. If the user’s input is contained in the ISO alpha-2 country codes list, they are sent to the next step, which is for the user to choose the number of an article from the list of the latest articles in their chosen country. After an article has been selected, the title, url, and complete content of that article appears, along with a prompt to return to the article menu. The user then has a choice to select another article, or exit. This is the application in a nutshell.

One of the main blind spots in creating this app was to handle all of the side effects of the functionality I had in place. For instance, if my requests were going through, why was the same news appearing over and over again? In the first step of the application, it turned out that my API request contained the hard coded instance variable of the user input, instead of allowing it to change. Once I created a different variable to store each instance of user input in my CLI ‘validator’ instance method, I was able to instantiate a list of articles from a different country per trial.

Another dilemma occurred when I went to go back to the list and chose another article: how could a user do so without replicating their original input? Whenever I went back, I invoked a method that took me to the original article menu, but I would see (at least) twice the number of articles as before. This was because the method hadn’t cleared the first array of article objects created upon entering the menu. The solution to this problem saved confusion, errors, and an overwhelming number of possibilities!

The experience of building this application helped me understand the basics of building an interface application with external data. The user needs to have nothing more or less than the results that are intended. There could be an additional feature to my application that select a choice from a from a list of news topics. Nonetheless, this felt like a pretty major endeavor for someone who is relatively new to programming.

--

--