As a developer, you must have been frustrated at one point or another. Some devs get frustrated daily. That's extreme for sure. Frustration has its effects, usually short term. Here are a few of them.
- Loss of motivation to go further
- Many hours lost trying to track the given bug
- Going to bed with anger
- Impostor syndrome for not being able to fix that bug.
I've experienced all of these and possibly more. I believe some don't apply once you're a senior dev. One thing I certainly enjoy is the euphoria of fixing that bug or getting that implementation right.
Limiting the frustration
Different people have different strategies for limiting their frustration. These strategies are context-based. Meaning they don't work for all types of bugs.
- Some people sleep on the bug and have it fixed when they awake. This is by far the most popular. Though it's effectiveness is something to review.
- Most times, the easiest way is to google the problem. The wealth of dev knowledge on the internet ensures your bugs get fixed within minutes and your frustration level stays low.
- One thing I recently discovered is that at a time, most of your bugs won't be one very big problem. They'd be silent ipms sent to ruin your day 😂. They are usually subtle things that you can't catch for some reason.
An example of the third point is this. Most times, when I follow tutorials, documentation or blog posts, I do so to implement something in my own code. I rarely take the tutorial as is. Trying to play smart like this has its gotchas.
Recently, I was picking up Flask and SQLite from this site. The tutorial gave a code snippet which I blindly copied (to save time 😉). This was the snippet
import sqlite3 def drop_table(): with sqlite3.connect('songs.db') as connection: #made an error here c = connection.cursor() c.execute("""DROP TABLE IF EXISTS songs;""") return True def create_db(): with sqlite3.connect('songs.db') as connection: ...
The snippet was written assuming the
songs.db file is located at the root folder. But mine was located in a
db folder. So, running the code above produces nothing. This was what I was meant to do
import sqlite3 def drop_table(): with sqlite3.connect('db/songs.db') as connection: # change occurred here c = connection.cursor() c.execute("""DROP TABLE IF EXISTS songs;""") return True def create_db(): with sqlite3.connect('db/songs.db') as connection: ...
The bugs that resulted weren't thrown by the interpreter. I was subtle and silent. It occurred due to carelessness.
So, I learned or relearned a lesson on copying code and doing things on your own terms. If you are doing things on your own terms, be sure to be careful enough to prevent path errors or missing symbols.
So, I just talked about path errors. Now, let's review the problem of missing or extra symbols. Another thing to think about when your writing code that will run on a different environment. Another personal experience here.
I was working on an express project. My API endpoints were meant to be tested on a test runner called
Gradr, feared by many, not sure if anyone likes it 😪. Everything was working on my own end, but they failed on the server. They failed because of an extra forward slash "/". So my API was being misread as
some-link.com//json instead of
some-link.com/json and returning a 404 error. It just returned 404. No explanation.
So, what have I been saying so far? To keep your frustration level low, you have to limit the number of bugs you create for yourself. To limit the number of bugs you have to have an anti-bug checklist in your brain. Sometimes, writing about your bug helps you remember on the long-term. Which means you don't need to fall for it next time. This checklist grows with experience. To really increase the number of checks on the checklist, you have to stretch yourself.
Asking the deep questions
Another strategy of solving the hidden bugs is asking the hidden questions. If I asked myself why I was getting 404 error, I'd have figured out that the server was posting to the wrong endpoint. Then recheck my endpoints. Both the root and the extension.
- Google your bugs before going to bed. This ensures greater productivity.
- Take 'going to bed' as the last resort.
- Have a mental or physical anti-bug checklist.
- Write about the bug. It helps you remember and prevent them.
- Ask a deep question about the bug instead of freaking out.
Andela usually has a way of stretching developers yearly. I have been participating in Andela related challenges over the years (2 actually). I don't know how they do it, but many people participating feel the need to complete the challenge by all means. It's usually different from hackathons on Devpost where you can bail if you're tired of it all. I'm dedicating this post to Andela. For all the wonderful things they do for the developer ecosystem in Africa.
Please share this article if you found it helpful. What strategies do you undertake to keep your frustration level low? Share it here. Also, follow me on Twitter 😉