A Difficult Situation and How I Overcame It
Response to the ubiquitous interview question
Figure 1 Unsplashed Image (by Sam McGhee)
The goal of this article is to serve two purposes: (1) my own recollection and (2) inspire someone else that might be preparing for interviews.
I often find that sometimes my memory can use outside inspiration to help recall some of my own experiences. Even if you don’t have a story similar to this one, perhaps it will help your recollection.
I have been programming for 4 years. I’ve not done a bootcamp or taken a computer sciences class. YouTube and all the generous programming influencer videos, articles, etc. have been my teachers.
What I really think I am is dashboard and databases builder. The concept of having a front end (the dashboard) supported by a backend (the database) is constantly provoked in my thoughts when it comes to what I build.
The crux of this story is leveraging another technology, version control. GitHub is ubiquitous in the programming community for version control. If you’re not familiar with it just think of your last project where you may have drafted a word document or spreadsheet and appended “version#” or as I sometimes do “_v#” to the file. That folder you keep all those versions is your GitHub repository. As with all things technology, it can get more sophisticated and becomes very powerful.
I’ve been using GitHub version control for a couple of years but not really leveraging many of its traditional features… until recently.
The website I have been working on for a couple months now is all of a sudden having a problem where none of the buttons seem to be working.
It seems like the frontend is not able to send information to the backend. I haven’t checked every single page of the application but buttons don’t seem work. Furthermore, when I hover my mouse over a button the cursor doesn’t change either. My website now seems like a pretty image of a website, but otherwise inanimate.
After I discovered the problem, I started poking around. While not elegant, poking around is usually how bugs get resolved.
I remember it being an hour and a half later when I gave out a strong sigh and thought, “Ok, I want to take a break.”
Breaks following strong sighs of defeat are never pleasant.
In fact, my whole mood is affected. While difficult to do it’s usually best that before I leave the apartment, I do some thought exercises. Specifically, exercises to remind myself that life is bigger than this last problem that is causing me grief — so should be pleasant when I cross my neighbor or ask a barista for a coffee.
When I came back to the problem, I knew I was going to use a strategy, but it was probably not going to be elegant. Some form of brute force most likely.
These are the worst ways to start a session of coding — known bug, no strategy.
When I say brute force, think of doing the same thing many times, with only slight variations or starting over from scratch. Maybe like forgetting your password and trying variations of it until you get it right. Or accessing a forgot password link and dealing with all the downstream effects from changing the password to all the other devices that were linked to that account.
Regardless, it’s not an inspiring solution but if you approach it methodically it usually solves your problem.
Regardless, at this junction I didn’t really even have a convincing methodical brute force approach.
I started by making a copy of my project directory and adding “_backup”.
Then my mind started to travel a bit. Or maybe it was intuition. But intuition about something that was not really in my knowledge base, but more like on the periphery of what I’ve learned in the past.
Up to this point I have been using GitHub (remember the metaphoric folder with all your file versions) but only as a file transfer method. In other words, I would work on my personal computer then commit changes (aka save changes) to GitHub’s remote repository. Then login to the production computer hosting the website, delete the old version and clone (aka copy) the GitHub.com project to the hosting computer. GitHub users might say that’s not even how you’re supposed to use it — and I know, but that’s where we were… I digress.
Figure 2 GitHub Logo
Troubleshooting Approach Has Some Direction
At this point, I was thinking to myself that I could go to the GitHub website and look at old commits — something I’ve never done, but know is possible.
My thoughts continue to expand on this idea of leveraging GitHub.
Maybe instead of using this copy, i.e. the ‘_backup’. I’ll just git clone an older version.
As I allowed myself to visualize all the steps to do this, a little voice was saying, “git must have features to do exactly what I want to do however you haven’t taken the time to learn them.”
I was really not in the mood to get into deep learning GitHub session. Version control hardly stimulates my appetite for learning — especially in the middle of troubleshooting.
At this moment while I was internally debating and looking at the screen my brain was simultaneously becoming more sure that leveraging GitHub was the path forward.
So much that I actually think a sperate voice inside my brain screamed “leverage GitHub version control, fool!”.
I briefly, laughed at my internal conversation.
Actually, there was a lot of laughter. It really felt like a little debate in the office and someone won.
Next thing I knew, certain commands that I’ve glossed over in the past, were starting to formulate themselves into links in my brain.
Hmmm.. “git checkout” sounds like opening up a version of a file in my folder of version analogy of GitHub version control. Furthermore, I’m guessing GitHub must have a way of checking out (aka viewing) old versions.
At that moment I said to myself let’s double check with Google how to checkout a past commits (aka look at older versions).
Google’s reponse: Git checkout <commit hash>
Me: Ahhh … ok it’s called a commit hash!
“Hash” is the term for the ID used to identify old commits (versions). That means in my folder of versions analogy a hash is the equivalent of the # in my “version#” or “_v#” file naming convention as I like to use.
Soon enough and without actually doing a beginner tutorials I had pulled together enough commands to start checking old versions of my website.
As I was reviewing older versions and to my surprise, I had actually been working on this project without buttons working for a while. “Geez, what was I doing!”
I finally reached a point where buttons were working.
I decided I would further leverage GitHub.
GitHub allows users to see what files were changes and copy the updated files themselves.
So my approach became start from this button working version and piecemeal copy one file at a time, run the app, until the buttons stopped working.
Sure enough, I arrived to to problem file and found the issue.
There was a panel that is part of the navigation bar that was not actually removed, but hidden. Therefore, anything behind the panel could be seen, but not actually clicked.
Me: wow… uhh, yea that never crossed my mind.
As far as I was concerned that was a needle in a haystack. And not even the haystack I was aware was out there.
I undid my edits to the old version. Checked out the latest version of the project and edited the navigation bar code to hide the panel.
Problem resolved and new skills learned!
While I touched on a lot of detail here, there were many more nerve-racking moments as I was copying files and using these unfamiliar GitHub commands. But, at that point I was resigned to the possibility that I may have to start from a much earlier point. So while the nerves were tight, I felt my options were limited.
I believe there is a small takeaway here besides any inspiration this may provide. The takeaway is that is it is remarkable how intuition can expand beyond the familiar. It would be disingenuous to say I was not familiar with GitHub. I used it a lot, I just wasn’t a polished user of GitHub. Regardless, I must have absorbed some of these details during all the iterations of my primitive use of it.
While I still see my approach as a bute force approach, I did leverage GitHub’s polished features. So, I in the end I think this was polished brute force solution.
I hope this provides some inspiration as you reflect on your own challenges.