I've been a programmer now for the better part of 15 years. In between that time I've taken on other roles, such project manager, Chief Technology Officer, bootcamp instructor and startup co-founder. But the majority of that time has been spent behind the keyboard behind a black screen with colorful text attempting to solve tomorrow's problems. But that wasn't always the case. Early on in my career during my first actual paying job as a programmer, things were very challenging and I could not wait to go home to recover from the day.
At this current stage in my career, coding is second nature. I don't struggle with it anymore and can visualize solutions to problems or tasks relatively quickly before I touch the keyboard. And in fact, most of the time, I don't think about the solution until I am in front of the keyboard ready to begin solving that problem. And a solution is always found eventually as I type away and pattern match my way forward towards some end goal.
The following are a few of the many habits that I have learned and implemented during the past decade that have helped me greatly in getting better at writing code, and in problem solving in general. Whether you are early in your career or have been at it for a while, you will find something useful in this post.
1. Building something really complex
Anybody can read a quick guide to HTML and get a static page up and running in under an hour. In fact, that's the very first thing that I did years ago. And I was proud of this accomplishment. So much so that I kept building static websites with random text and images scattered around them. Mainly because it was relatively simple to do and I could do it for hours on end and show it to people, both friends and potential employers.
But as with anything in life, we need complexity and challenge in order to get better at things and to grow. We need to see what works, what doesn't work, and really what we don't know and have never thought about just yet. So I began to build out an idea that I had for some time, but that I didn't know how to even begin to work out.
I wanted to build an online community for a certain music band that I was a fan of at the time. Similar to MySpace, but more personal. As soon as I had the thought, a million other ones followed it. This community would allow people to befriend each other (somehow) and to send messages, review albums, share lyrics, etc.
The main challenge here was that I had no idea how to do any of these things. I knew how to write code to some extent, but I didn't know how to architect anything just yet. Database design was still relatively new to me and I didn't know the concepts of messaging or authentication. So I began to work on this pet project day in and day out for months after my job. After about 6 months, gallons of coffee, hundreds of hours of online research, I had a fully functional beta version to launch.
To this day, I give credit to that project for catapulting my coding career. Everything just seemed so much easier once this project was completed. My job was easier and new ideas formed quicker, probably because in building out this idea, I had to overcome hundreds upon hundreds of hurdles in order to get to completion.
I ran the website for a few years with relatively high success. Eventually, due to job constraints I ended up having to abandon the project, which you can read more about here, and decided to focus more on my career.
2. Ask people that know more than you
I was lucky during this time because I had just landed my first programming job, and so, I was surrounded by a team of very talented programmers every single day. And while I didn't out right ask them to build my new amazing website for me, I did ask them questions about how to go about doing certain things. Something that would have otherwise taken me weeks only took days after that. This also made it much more exciting to head in to work the next day, as I knew that I was going to be able to solve the challenges that I faced the day before.
These days, we don't have to wait until we get to work to ask questions. The odds of there being a question that no one has asked except you is relatively low. It's possible. Just not likely. Particularly if you are early on in your career. I have seen the most obscure and complex issues resolved online by amazing groups of strangers on StackOverflow.
3. Throw away your old code
This was the hardest part that I personally faced when getting better at writing code. But it's a must. If you are working with code that you wrote 5 years ago and refusing to update it, odds are that you are severely hindering your overall progress and working with outdated patterns and standards. Make it a practice to review your code frequently, and to really just delete anything that isn't being used. Don't comment it out because you like the for loop. The for loop is commented out because it didn't work. It didn't accomplish its goal, that's why it is commented out.
10 years ago we didn't have a free cloud-based repository such as GitHub at our disposal. Source control was pricey and complex to use, with locking and unlocking mechanisms. These days, we've figured out these problems and made it simple enough that anybody can set up a repo with their code on it. So delete your code, because it's never really deleted anyway. It will always be waiting for you on the cloud.
4. Stop changing programming languages
I'm all for learning every single language ever and then building cool things with each, I am. But it's just not realistic in the limited time we get on Earth. The best programmers that I know have spent years working on a single language or stack, and that is what makes them so efficient and functional. Most of the time, when I see people jump from language to language, it is mainly because either the language/framework that they are working on is either too difficult or, it is too complex and they got bored with it. I myself have been guilty of this. I've attempted to learn PHP multiple times, only to realize that I found it boring. Note that "I" found it boring.
There are some fantastic PHP developers out there that have spent years working with the language and can pretty much build anything that they wish. A shout out to iDiallo.com as one of the best. But to me personally, I stopped during the 'Read a line of text from a file' portion. I focus on .NET development as my framework of choice. It is a vast framework that can take years to understand and that you never really master.
There are portions of it that I have yet to touch myself, such as game development, hardware programming, AI and Machine Learning and cloud based development. And much much more. It does not really benefit me to drop everything to begin to learn how to write "Hello World" using a new language that I am not familiar with at this stage. I leave it to the experts in those languages to handle that for me as I get better daily at my framework of choice.
5. And lastly...
Really what I tell my bootcamp students is that the learning happens automatically. You don't "learn", as in you aren't responsible for the processes in the brain that deal with learning. You expose yourself to stimuli, you set a goal and a desire, and you repeat the process until the right pathways are created. Then one day, it just seems easy. You might not even notice the change at all. It could be a Monday morning, you could be sipping on coffee finding yourself creating a new React site to play around with and adding it to GitHub.
Whereas, 1 month before then, you were reading the "Getting started with React" tutorial and had no idea what source control was. You didn't actively "learn" in a sense, but you did the work. You exposed yourself using your time to something new. It was uncomfortable at first (because it was confusing) and every now and then you got some form of satisfaction as you figured things out. And the more satisfied you felt, the easier things got and more we can say you were "learning".
So how do I get better at coding these days? I make sure to expose myself daily to technology that I am interested in. And to stick with it until that uncomfortable feeling begins to fade away and I get more and more satisfying moments in my learning. More "aha" moments if you will.
So challenge yourself, ask questions, correct your work and focus, and eventually you will be coding at a much higher level and it will seem almost automatic. Happy coding!