What Does It Mean to Think Like a Programmer?

readTime

9 min

What Does It Mean to Think Like a Programmer?

When you're first learning to code and taking your first steps in programming, it's easy to feel like a kid lost in the fog. Everything is unfamiliar, you don't know where to go or what to do. It's like learning a new musical instrument or a foreign language.

I totally get it, because I've been there. When I started programming, I had no commercial experience, no computer science degree, and I decided to learn to program on my own.

No matter what you want to do or which direction you plan to go, the first step to becoming a programmer is learning to think like one.

What is a Programmer’s Mindset?

A common misconception about programmers is that they know everything. In reality, that's far from the truth. Programmers have a unique way of thinking about and approaching problems that works well in their job and in everyday life.

Think about programming like speaking. When you talk, you try to communicate effectively with the people around you. When you program, you’re trying to communicate with a machine. In both cases, you don't need to know every word or element of the language—you just need to know enough to convey your ideas and be understood.

When you use code to solve problems, it’s not about memorizing code like you did with poems in school. It’s more about grasping the fundamentals, understanding the core concepts, and applying them in practice. Once you learn how to break a problem down into smaller parts and apply programming principles, you don’t need to memorize everything. You just need to know how to approach the problem, which is a skill that improves with experience.


Three Things to Keep in Mind While Programming

  1. Try a solution.
  2. If it doesn’t work, try something else.
  3. If that still doesn’t work, repeat step 2 until you solve the problem.

Remember, as a programmer, you’ll run into problems most of the time. If you're just starting, you'll feel less comfortable debugging and problem-solving because it takes more time. But you need to arm yourself with patience and push through that initial, tough phase rather than giving up on learning how to program.


What Does It Mean to Think Like a Programmer?

When you encounter a problem, pause for a moment and try to fully understand it. Then, define what you want to achieve and identify the expected outcome. In the next stage, think about what steps are necessary to solve that problem.

Resist the temptation to blindly dive in and start coding with a “let’s just see if it works” approach. Instead, step back and carefully consider what you’re doing. Slow programmers often make better programmers. Why? Because instead of immediately jumping to a solution and using trial and error, they think things through and then execute. As a result, they don’t waste time and get closer to the solution right from the start.


How Programmers Approach Problem Solving

Let’s look at a simple example of how to break a problem down into parts, just like a programmer would.

If you were asked to describe how to open a jar, you couldn’t just say “open the jar.” You’d need to explain, step by step, in a language understood by the person or machine what specific actions are required to open the jar. For example, you might offer the following set of instructions:

  1. Pick up the jar with your left hand.
  2. Place your right hand over the lid.
  3. Tighten both hands.
  4. Turn your right hand counterclockwise and your left hand clockwise.
  5. Turn until the lid separates from the jar.
  6. Release the tension in both hands.

Steps to Think Like a Programmer:

1. Understand the Problem

Why are problems hard? Because you don’t understand them.

How do you know when you truly understand the problem? When you can explain it in simple terms. Remember the time you were stuck on a problem and started explaining it aloud, only to spot logical gaps you hadn’t noticed before?

Most programmers know that feeling. That’s why it helps to write your problem down, draw diagrams, or talk it through aloud (some people even talk to a rubber duck 🦆).

As Richard Feynman said, "If you can't explain something in simple terms, you don't understand it."


2. Plan

Don’t dive straight into solving problems without a plan (hoping you’ll somehow brute-force your way through).

Instead, plan your solution!

If you can’t write out the exact steps, then you don’t fully understand the problem and are likely just guessing.

In programming, this means you shouldn’t start coding immediately. Give your brain time to process and think it through.

To create a solid plan, answer the question: “Given input X, what steps are necessary to produce output Y?”

Tip: Programmers have an awesome tool to help them with this... comments! 📝


3. Break Big Problems into Smaller Ones

This is the most crucial step of all. Don’t try to tackle one massive problem head-on; you’re likely to fail.

Instead, break it down into subproblems. Subproblems are much easier to solve.

Then, solve each subproblem one by one. Start with the simplest one. “Simplest” means the part where you already know the answer (or are closer to knowing it than not).

Once you’ve solved each subproblem, connect the dots.

Solving each subproblem will eventually give you a solution to the original problem.

This technique is the cornerstone of problem-solving. Commit it to memory—it’s the “divide and conquer” strategy.

For example, if you’re a beginner and asked to write a program that reads ten numbers and calculates the third largest one, that might seem daunting, even though it only requires basic syntax.

If you’re stuck, you should reduce the problem. Instead of finding the third largest number, how about finding the largest one? Still too hard? How about the largest of three numbers? Or the largest of two?

Reduce the problem until you know how to solve it, then gradually expand and adjust your solution until you’re back where you started.


4. What to Do If You’re Stuck

First, take a deep breath. Second, don’t worry, it’s normal and happens to everyone.

The difference is that the best programmers are more curious about bugs than annoyed by them.

Here are three things to try when you find yourself in this situation:

Debugging: Walk step by step through your solution, trying to pinpoint where the error is occurring.

“The art of debugging is figuring out what you actually told your program to do, not what you thought you told it to do.” – Andrew Singer

Reevaluation: Take a step back. Look at the problem from a different angle. Is there something you can abstract to a more general approach?

Sometimes, we get so caught up in the details that we miss general principles that could solve the problem on a broader level.

Search Online: Uncle Google rarely lets you down. No matter the problem, someone else has probably solved it. Find the solution, even if you’ve already solved the problem! (You can learn a lot from how others approach it.)

Note: Don’t search for the solution to the entire problem. Only search for the solutions to the subproblems. Why? Because if you don’t struggle a bit, you won’t learn anything. And if you don’t learn, you’re wasting your time.


Three Key Steps Every Programmer Should Know When Writing Code

1. Make It Work

When you encounter a problem, the first step is simply getting it to work. The goal is only to understand the problem and find a solution. That’s it. You might think your program also needs to be correct and optimized, but premature optimization is always a bad idea.

It will lead to coding nightmares. Remember that a good solution should evolve over time, but start with any solution that works.

You can make your code do what it’s supposed to do in any ugly, messy way you like, as long as it works. We’re talking about software—there’s no cost to materials, so instead of trying to find the perfect solution right away, just find a solution that works.


2. Make It Right

Once your initial solution works, it’s time to improve the code quality. Follow best practices, principles, and patterns.

This step is all about refactoring your code so it’s cleaner, more readable, and easier for others (and yourself) to maintain.


3. Make It Fast

Finally, it’s time to measure the performance of your code. This is where you optimize. It’s the most challenging step, but if there are obvious performance bottlenecks with easy fixes, you should implement them now.

Optimizing code doesn’t just mean making it run faster—it also means making it more testable, scalable, and valuable to other developers and users.


Learn to Push Through

Once you start coding, you’ll probably spend hours searching for bugs and feel like you’re on the verge of giving up and heading for the mountains.

How do you overcome these common frustrations in the life of a programmer?

Persistence

The most crucial thing, regardless of the situation, is persistence.

At the beginning, push yourself—at least a little further than usual—when searching for solutions to problems.

When you feel exhausted, frustrated, and ready to quit, that's often the moment you’re about to find the solution. The point where most people give up is the point where you need to keep going. It’s where real growth happens. Anything uncomfortable is a gift that helps us grow as

individuals and strengthens our character.

The first few months are the toughest. But don’t worry, I can tell you from experience—it gets better. The hard work you're putting in right now is worth it. Over time, it all becomes easier.

Remember Your Goals

Another way to keep pushing forward is to remember your goals. Why do you want to learn programming? Keep a list of your goals on your computer, in a notebook, or on your wall. I like to create lists of my goals and then remind myself of them in the morning. It sets my intention for the day and helps me stay focused on achieving them.

There are many paths to learning programming. You can learn on your own, attend a bootcamp, study computer science, or take online courses. But no matter how you’re learning, keep your goals in mind. They’re the reason you're learning—and they’ll help you power through when you’re stuck.


Sources:

authorImg

Witek Pruchnicki

I passionately share knowledge about programming and more in various ways.