4 Ways to Break Out of That Slump
We get stuck in ruts, the developer’s version of the yips, and sometimes we don’t know how to get out. Here’s four ideas on things you can do to try and get out and grow as a developer.
We should, both as developers and as people, always be striving to learn and grow. Through self-discovery and self-motivation we can learn to be better people and better professionals. By expanding our areas of knowledge we expose ourselves to new ideas, new worldviews, new challenges, and new questions to be answered. So in that spirit I’ve put together a short list of things that would make good topics for your next 2 AM rabbit hole or self-paced learning session.
Multi-threading in Python
If you’re a Python developer you should absolutely learn about threading. “But doesn’t Python have the GIL, so threading is basically useless?” I hear you ask. Well, no, that’s not true at all. In fact, there are some scenarios where using threading in Python is immensely useful. A good rule-of-thumb is that if your application is waiting on any resources slower than disk, you can use threading to parallelize operations. A good real-world example of this comes from the days of OpenStack Havana.
The company I worked for at the time had a massive OpenStack deployment across multiple datacenters, and given that our application needed geographic redundancy we had instances in multiple regions, with multiple environments per region. This caused a bit of a headache when doing an inventory of all of our VM’s as the dashboard didn’t provide a way to see a 1,000 foot view of everything attached to our organization. With that problem in mind I created a Flask app that reached out to the OpenStack API and grabbed the instance list for each region and environment we were in, then updated a giant table in a basic web page. All told we had about 9 or 10 API calls that needed to happen to get the full instance list. My first draft of the app took a solid minute or two to populate the list, with all of the API calls happening sequentially. While it worked the user experience wasn’t the greatest — sitting and waiting for a page to load for over a minute is a good way to get bored and frustrated. So I went back and refactored the app to use threading. As most of the latency involved was network-bound I/O the application actually spend most of its time idle, waiting for network responses. I could put this idle time to work by making all of the API calls in parallel, letting the kernel schedule the threads and use as much of that idle time as possible. This allowed the application to go from a minute or two to a matter of seconds for fetching the instance list. Given the right application and use-case, threading in Python can be a powerful tool.
Learn the Opposite Language
I grew up as a Python guy. It was the first language I truly learned (I had hacked some browser JS in the past, but that doesn’t really count) and its still my first love. But a few years ago I was encouraged to learn Go and I am very glad that I did. Not because Go is the best language in the world — far from it — but because moving from one paradigm to a completely different paradigm has allowed me to think about code differently and given me another tool in my toolbox for solving problems. So when I say to learn the “opposite” language this is what I mean: if your main language is a duck-typed interpreted language like Python, an opposite language would be something like Go or C++ — a compiled, statically-typed language that makes you focus more on resource management than something like Python or Ruby. If you’re mainly a Java developer I would highly encourage you to look into something like Haskell or Elixir, something that gets you out of your comfort zone and into a mental space you’re not used to operating in.
Re-Explore the Standard Library
This might sound a little crazy but hear me out. Just like in most things people get into rhythms, they find what they like and what works and they use that thing or that method as their go-to. Its not a bad thing, nor is it a good thing, it just is what it is. One of the side affects of this, however, is that we sometimes forego the better solution for the one that we know. To combat this I would encourage you to go re-explore your language’s standard library. Its not the kind of thing that people typically do after they’ve learned the language, but you should absolutely go back and check it out again. Having already learned the language there might be some packages or concepts that you didn’t understand fully at first blush but now have the context for. There’s been a number of times that I’ve been faced with a certain problem that I’m not quite sure how to solve, and having decided to go back and browse Go’s stdlib I’ve been able to discover a much simpler way of solving that problem. Or sometimes it isn’t a specific engineering problem but more of a vague “I wonder if you can do ______…” that’s sparked a late-night dive into the stdlib.
Try to Re-Implement Something that Already Exists
Sometimes you get bored, sometimes you get stuck in a rut. That’s OK, it happens. When that happens I like to try to re-implement some kind of well-known function or algorithm. The last time I did this I attempted to recreate a bubble sort algorithm in Go. Was I successful? Eventually. Was it performant? Absolutely not, but that wasn’t the point of the exercise. So what is the point? To get myself out of my usual groove and do something I’ve never done before. You might start to sense a theme with this list, but stepping outside your usual sphere of influence is always a good idea and can lead to important discoveries. In this case, it was that people like Ken Thompson are way smarter than I am, but secondary to that was that no matter what your first attempt at something is, there’s always room for optimization and improvement.
Being a developer can be a stressful job and time-consuming hobby but that doesn’t mean that it has to be boring. There’s always things to learn, areas to understand better, and ideas to convert from concept to reality. These are just four ways to help break out of a cycle of repetition, but there are more. Do you have a favorite? I’d love to hear it, let me know in the comments below!