Building a CLI for Flatiron Bootcamp pt.1
Published: 2021-01-25 07:32:09

March 11, 2020 is a day I will not be forgetting anytime soon. It's the day the NBA cancelled the 2020 professional season in the middle of a game. Non coincidently, it's also the day I decided to transition into a software engineering career from a customer service field job. To finally write this post feels like an accomplishment in it's own right.  After several consistent weeks I can proudly say I've built my first Flatiron portfolio project...

The requirements for the project were as followed:

-provide access to data from a web page.
-the data provided must go at least one level deep.
-Use object-oriented programming 

For my project I decided to create a program that would provide COVID-19 related resources to users in the Chicagoland area. To **provide access to data from a web page** I decided I would scrape from a website using the nokogiri gem. 

Once I decided where and how I was going to scrape data the next step was to build out the flow, or at least a general idea, of my program.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/95dabmdt4m7lh8cm25ki.jpg)

The above diagram is an earlier version of my CLI program. Ultimately the program didn't end up quite like that but it helped with fulfilling the requirement of **having provided data go at least one level deep**. 

Note: I created the diagram with [draw.io](https://www.draw.io/). Flatiron suggested it and I found it to be helpful. This is a good tool for visual learners. 

Once I had the skeleton of the CLI created I started getting into some serious coding and tackled **object oriented programming**. Grasping the concept of OOP was one of the biggest challenges I dealt with throughout this project. 

As mentioned above I struggled, still do but getting better, with grasping OOP concepts such as "objects". Thinking back to labs such as the Music Library was helpful when creating methods like the one below. A turning point in this project was how I was viewing programming. I was only looking at it through one "lense" when there are different levels of scope that an engineer needs to be aware of in order to make a seem less program

`def initialize(name, tag)
        @name = name
        @tag = tag
        @description = description
        #notify tag about the resource
        add_to_tag
        save #create a save method for better organization 
  end
    `

to be continued...

WHAT IS object-oriented programming?
It is a programming paradigm based on the concept of "objects", which can contain data and code: data in the form of fields (often known as attributes or properties), and code, in the form of procedures (often known as methods)
_(https://en.wikipedia.org/wiki/Object-oriented_programming)_

WHAT IS A CLI?
A CLI processes commands to a computer program in the form of lines of text. 
_(https://en.wikipedia.org/wiki/Command-line_interface)_


WHAT IS scraping?
It is a technique in which a computer program extracts data from human-readable output coming from another program.
_(https://en.wikipedia.org/wiki/Data_scraping)_

WHAT IS a gem?
The RubyGems software allows you to easily download, install, and use ruby software packages on your system. The software package is called a “gem” which contains a packaged Ruby application or library.
_(https://guides.rubygems.org/)_


WHAT IS nokogiri?
It is a gem that makes it easy and painless to work with XML and HTML from Ruby. 
_(source https://nokogiri.org/)_