DEV Community

Cover image for How to and not to do a CLI project-
Leigha
Leigha

Posted on

How to and not to do a CLI project-

Photo by Patataj Patataj from FreeImages

So far, the first module in the Flatiron online program has been really fun and at times overwhelming. There is just so much useful information to learn! I'm pretty excited to be at the point where we are taking everything we have practiced so far and are putting it all together in our first project: create a CLI Gem.

My plan was to get started right away, which would give me over a week to work on the project. That would be ideal and is usually my approach. Well, plans don't always go through and as it turns out, I ended up only having a handful of days to work on this due to a family emergency. So I may have started off in a bit of a panic.

Challenge #1
I was now pressed for time and feeling unsure about being able to produce a nice product. I did not take time to think about the project itself much before I just dove into 'getting it done'.

Solution
Before you approach a project, or really anything meaningful in life, you should take a moment to reflect on your intent. Try to visualize the process and focus on the final product. View any obstacles you may face as opportunities for growth.

If I had just taken the time to really think about my project before getting started I could have saved myself a few wrong turns in the process.

Challenge #2
This wouldn't have been too much of an issue without problem #1. I have no idea what I want to create! There are just too many possibilities and feeling pressed for time has temporarily clouded my creative abilities. Here is where I should have really put some thought into the design of my program. Sigh.

Solution
Take time to carefully think about what you wish to achieve with your product. Pick something that is meaningful to you. What kind of functionality do you wish to create? Really think about the design of your interface so that it is pleasant to the user and make sure the project can be produced within the required timeframe. You can always expand on what you have built after you get your MVP going.

So I decide on my lifetime standby topic: cats. I will create a CLI that scrapes fancy cats from a webpage and gives the user details about the cats.

Alt Text

Challenge #3
This really builds off of problem #1 as well, and since I felt pressed for time, I did not give enough thought into choosing an appropriate site for scraping. After visiting a few sites, I found one that visually looked good and I started working on the scraping details. That site ended up being 'unscrapable' and I had to start all over again.

Solution
Make sure that the site you select not only has the data you wish to gather, but also has the necessary information you need in order to access that data. The 'inspect' feature is your friend- use it to dig around on the page to make sure you can reach the data you want. I used repl.it to help visualize finding the data I needed. Taking a few extra moments at this step will save you lots of time and headache in the future!

Alt Text

Photo by Marcelo Gerpe from FreeImages

I wasted some time at this step in terms of progress on this project, but I did learn a lot about scraping and what it takes to make a site 'scrapable'- valuable knowledge!

Challenge #4
I really can't emphasize that most of the issues I encountered with this project had to do with a lack of planning in the initial stages. I ended up having to redesign my interface a few times, and I don't think that would have been so much an issue if I had really thought it through before starting.

Solution
The time it takes to plan your project is well worth every moment.

After a few failed approaches, I ended up taking a break, setting up a solid plan, and then got to work. Although this project certainly is challenging, I found it much easier to create with a good plan in place.

Alt Text

Though I am still busy at work, I have been able to create a pleasant interface with the ability to fetch a list of fancy cat names and some history about each cat. There is also a feature to generate a random fun fact about one of the fancy cats. Currently, I am working on the code to generate lists of the most and least affectionate, energetic, and shedding cats. I'll post an update when I can!

Latest comments (0)