Napoleon Bonaparte famously said:
For war we need three things — money, money and more money.
It resembles what you need to learn to program — to code, code, and code some more. That’s the only viable way to get better.
You probably already know that, and maybe you’ve been coding for years. But I bet sometimes you get stuck. You may be involved in a long project with few challenges or still looking for a job and not knowing how to stand out from the crowd.
Whatever it is, it feels like you’re coding more and more and can’t progress. Every project is similar. You solve problems in the same way.
To escape this vicious circle, you need to think outside the box and challenge yourself. Here are some tricks to help you start growing again.
1. Rebuild an Existing Tool
Insufficient feedback is one of the greatest obstacles to learning how to code. When you start, it’s not such a big problem. You want your code to work. If it doesn’t work, you’ve made a mistake—instant feedback.
The more experience you get, the more challenges you face. You need to consider design patterns, architecture, readability, performance, etc. You find out that every problem has multiple solutions, and it’s not easy to judge whether yours is sound or not.
Fortunately, there’s a straightforward way to get feedback or a different perspective on the code: by rebuilding an existing library or another tool.
All you have to do is find some tool (preferably something you use regularly) and understand what it does. Then identify its core functionality. Read the documentation thoroughly and make sure you understand the API. Now you’re ready to code.
You don’t need to recreate everything — just one or a few of the most common use cases. Ideally, the project should take you a few days.
The fun part comes when you finish coding. Take a look at your code and analyze the decisions you’ve made. Consider possible edge cases and bugs. Note them.
Now open the source code of the tool you recreated. Review the code and the approaches to these same problems. Is your solution similar? Is it better or worse? Why? Try to understand the decisions behind the library’s code.
Many libraries were created by proficient programmers and expanded by the community. By examining their code, you can learn new patterns and approaches to problems. And as you tried to solve these same problems, it will be easier to put your new knowledge into practice.
2. Pair Program
Pair programming is a divisive idea. It’s a software development technique whereby two programmers work together, but only one writes the code. The other observes and reviews the work. The programmers switch roles regularly.
The downside is obvious: Only one programmer codes, so it takes more time to create software. The upside should be better software quality.
The benefits of pair programming for software development are debatable, but its learning benefits are obvious.
When you are writing code, your partner spots your patterns and way of thinking. It challenges you both to analyze how you create the code.
When you’re observing someone else writing code, you can see their patterns and mindset. You almost certainly approach problems differently, so it’s a great chance to see another perspective.
Pair programming can be difficult. To make it easier and more productive, your partner should be approximately at your level. If they are too junior, it will change into a mentoring session. If they are too skilled, they may get bored fast or do everything by themselves.
3. Restrict Yourself
Being creative is hard. You get used to solving problems in one way and don’t even consider alternatives. It’s like being on autopilot.
Fortunately, programmers are not the only ones struggling to be creative. It’s an even greater problem for writers. They live off being creative, so they developed techniques to spark creativity.
Constraints are among the most powerful creative techniques. For writers, it may be limiting the word number (e.g. a story in ten words) or word usage (e.g. no words starting with “S”).
As a programmer, you have countless ways to limit yourself in order to become more creative. You can:
- Avoid some language features (e.g. write code without if and switch statements).
- Reduce data mutability — use pure functions wherever possible or even some tools enforcing immutability, like Immutable.
- Use test-driven development — TDD is a powerful technique that will make your code better and force a mindset change.
- Limit your time (e.g. give yourself three days to build an app or join a hackathon).
The limitation type is not the most important part. You can choose whatever seems fun. What’s crucial is the paradigm shift. Restrictions force you to think about the fundamentals again. Rethinking and refining your methods is fuel for your growth.
4. Write Technical Articles
You’ve been programming for some time and you think you know what you’re doing. I can prove that you don’t.
Write a technical article.
You’ll be astonished by how many things you take for granted when programming. You’re often mindlessly repeating these same steps over and over.
When you explain your process in writing, you’ll immediately begin to consider your assumptions and approach. You’ll start to question if some code is the core part of the issue. Other code may be redundant or too intricate.
Writing will make you think methodically and critically about your code. You’ll need to refactor and simplify it to create useful learning material for others.
Do you see what you’re doing here? You’re learning. It’s learning disguised as teaching others, but it’s learning nevertheless.
There are not many more efficient tools to fathom a subject than teaching others. Take advantage of it and your growth will skyrocket!
Thanks for reading!
Did you find this article valuable?
Support Szymon Adamiak by becoming a sponsor. Any amount is appreciated!