When I first became a programmer, I wanted to be done with projects yesterday. I was more concerned with building something so that I could show off my skills. However, I ended up frustrated with bad code and half-finished projects. After many failed projects, I leaned on experienced coders to start thinking like them. Here I share some of the tips that helped me, as a beginner, to think like a programmer.
Understand Your Requirements
When you are new to coding, it’s easy to get worried about deadlines. “Am I going to finish on time? Will I get stuck and need help?” These are all the questions I have asked when trying to meet a deadline or add a project to my portfolio. The reality is that if you aren’t 100% sure of what you are trying to accomplish, you will likely hate the process. You might just attribute any failures to being an amateur. Programmers don’t just jump into it. They think about all the requirements before they even think about starting.
Understand the requirements of your program or your client’s. If you have a client, ask them tons of questions until you have a clear picture of what they are expecting. Even if you are making a program for fun, know your requirements inside out.
Break Those Requirements Into Tiny Steps
Write it out, draw it out, or both. Gordon Zhu shares in his course Watch and Code that many programmers write out their requirements. Moreover, they use the sentence starter “It should…” so that they focus on exactly how their end product will work.
After I write or draw my requirements, I go back and see if I can make my sentences even simpler, focusing mainly on the action. Here is an example of possible requirements for a simple game of Hangman:
Instead of: It should allow the user 6 tries to guess the correct word.
Write: It should generate a random word.
I am focusing on the first most important thing that needs to happen. We need a random word in order to play. Breaking it up makes it easier to start working. You don’t have an overwhelming list of things. You can think and do one task at a time.
Create A Clear Plan of Attack
Get clear on how you are going to accomplish the project. Having tiny steps will give you an idea of the languages, libraries, etc. that you will need to get it done.
Allow yourself time to do research and refresh on anything that you are rusty in. Think it through. Once you are 100% sure you are ready to go and have all your small steps, you are ready to begin.
Start One Step At a Time
Experienced coders tackle one thing at a time. Even if you feel like you can finish faster by doing multiple things, please don’t. You will thank me later!
Focusing on one thing will help you evaluate that you have completely met that requirement. There won’t be any doubt when you get one little thing done, that you got it done. Any great programmer knows that they will have to come back and review their code anyway (more on that later).
Test and Debug Frequently
I use to code like a deranged woman just trying to get stuff to work. I would erase whole functions and code. Five hours later, I only had about a half hour worth of work. Avoid the misery and test frequently.
Every language has its own form of console.log() and Debugger, find it and use it. It will save you so much time and you will grow faster as a programmer.
If You Are Stuck For A Long Time, Just Sit With It
I didn’t learn this through programming. This was something I often do when I am stuck on something for too long. I saw it mentioned during a Learning How To Learn course I took on Coursera. They validated that my practice, which I attributed to my procrastinating tendencies, was actually a useful tool for my brain to grapple with information and determine the next course of action. You don’t have to do anything, just sit or do something completely unrelated.
If you need something to keep your focus and help you take breaks to just sit, I enjoy the pomodoro method. You set a timer for 25-min, work non-stop, and when the time is up you take a 5-min break. After 4 intervals, you get to take a longer break for 15-30 min. I find it really helpful. I prefer to use the marinara timer because it is easy to use and is modeled after the method. Productivity apps are great tools if you need them.
Review and Refactor
A software development rule to keep in mind is DRY (Don’t RepeatYourself). This is a great article that explains in depth why you almost always want to use DRY code.
Refactoring keeps your code easier to read, maintain, and run. Can you accomplish a specific function of your app with less or more efficient line of code? It also helps find bugs or typos in your files.
Programmers are always looking for ways to make their programs more efficient and decrease complexity. We always have the user in mind and we know as users we like things to be simple and fast. This is also another time to test your code.
Lean On The Tech Community
Programmers love to collaborate and share their wisdom. You can find so many resources to help you online. You can ask questions on Stack Overflow and get advice pretty quickly. Be clear in your questions, share what you have tried (no one likes lazy coders), and pay it forward.
They organize meetups and share new technologies and information. Attending these meetups are a great way to meet experienced folks and connect. You might even find your next job. It is all a give and take, so make sure you genuinely connect and offer your help or a resource before you start asking.
Programming is so rewarding but also hard sometimes. You are building resources that could potentially save the world. So start thinking like a programmer even if you are just starting to learn. So many engineers think that they know so much less than the next person and we are okay with that. In tech, you learn every single day.