My First Software Engineering Project — NHL CLI

Angelo T
3 min readApr 7, 2021

For my first project at the Flatiron School, I needed to create a working CLI gem. I decided to create an NHL rosters CLI that will display all 31 teams and allow the user to select the team of their choice and display the current (present day) NHL roster.

Here’s how it works:

First, the user is welcomed to the program and asked to enter their name. Once received, the program will display the users name in uppercase in order to clearly display the user’s name.

Then the user will be asked if they would like to view the roster of their favorite NHL team by typing ‘y’ for yes or ‘exit’ to exit the program.

After typing ‘y’, the user will see a main page with the NHL Roster CLI logo and an alphabetized list of all 31 NHL teams. Instead of typing in the full team name to see the roster, I was able to construct my code to allow the user to enter the corresponding number in order to view the roster of their choice.

Once the team number is entered, the roster will populate and sorted by player number. From there I added a header with the team name, and as we iterate through each individual player, it will output the player number, name and position.

Once the user was finished, they could either type ‘exit’ to exit the program or ‘y’ to return to the team page and view another team’s roster.

Final Thoughts:

This was a really fun project to complete because, not only is it my first project, but having never coded before, to create something from nothing was exciting. I certainly had my fair share of ups and downs while completing the project, but I learned a lot along the way. For example, when trying to gather the data from the NHL stats API, I need to return the team name and the entire roster, but when I called the roster, I kept returning “nil”. The problem was that they had a roster hash nested inside of another roster hash, so I needed to call the key of “roster twice: [“roster”][“roster”]. Something that seems so simple now took me forever to figure out because some other API’s that I’ve seen are sorted in a different manner, but it was still great to troubleshoot.

One thing, among many, that I learned was how to add text color to the terminal. The colorize gem was really easy to setup and use. After adding it to my Gemfile and Run file, it was really simple to add “ColorizedString” to my output string and add the color to my CLI. This provided some flair to my project.

puts ColorizedString[“#{index}. #{team.name}”].colorize(:light_blue)

As we move onto the second phase of the program, it’s worth noting that these first 6 weeks have already been an emotional rollercoaster. A huge thank you goes out to my cohort lead, educational coach, the AAQ team at Flatiron and my entire cohort classmates. Nothing worthwhile is accomplished alone and to have this built in support system makes a huge difference.

--

--

Angelo T

fashion professional turned software engineering student