DEV Community 👩‍💻👨‍💻

Cover image for How critical thinking can help you learn to code
Hunter Johnson for Educative

Posted on • Originally published at

How critical thinking can help you learn to code

Experienced programmers frequently say that being able to problem-solve effectively is one of the most important skills they use in their work. In programming as in life, problems don’t usually have magical solutions. Solving a coding problem often means looking at the problem from multiple perspectives, breaking it down into its constituent parts, and then considering (and maybe trying) several approaches to addressing it.

In short, being a good problem-solver requires critical thinking.

Today, we’ll discuss what critical thinking is, why it’s important, and how it can make you a better programmer.

We’ll cover:

Critical thinking

What is critical thinking?

Thinking critically means that when faced with a question or problem, you spend time analyzing it and considering a range of possible approaches to it before acting or making a decision. This means evaluating not just the problem, but also your instinctive reaction to it. It’s an interrogative stance that’s directed both outward and inward.

Say, for instance, you’re scrolling through a news site, and you see a headline that expresses a position on a controversial political issue. Most of us will have an instinctive reaction to that headline. We’ll agree or disagree with it and, if it’s an issue we feel strongly about, this reaction might be accompanied by powerful emotions.

This is all very normal, but what we do next matters. This is where critical thinking comes in. To think critically about the article in question, you need to:

  • Read it in full rather than stopping at the headline
  • Evaluate the evidence supporting the author’s argument
  • Consider whether the author’s conclusions follow logically from the evidence
  • Research the topic to learn more about alternative positions
  • Reflect on whether your own ideas about the topic are based on evidence or on assumptions

Only then will you be prepared to make a judgment about the argument and, potentially, assert an opposing position.

Critical thinking is hard work, and it sometimes runs against our instincts. It’s important, though. Critical thinking will make you a more adept problem-solver, and it might even make you a bit more empathetic—more ready and able to see problems from a variety of perspectives.

Critical thinking

Why is critical thinking important in programming?

Critical thinking is about resisting the temptation to problem-solve on autopilot. It’s about thinking through problems systematically and at a granular level rather than just applying the first solution that comes to mind. This is an important skill for programmers.

People without a programming background sometimes imagine coders as being akin to superheroes or magicians: preternaturally talented individuals who can sit down at a computer and, without any preparation, speedily write intricate code correctly and from scratch.

There are a lot of important pieces missing from this picture. One of them is critical thinking.

Writing code is often a slow process that involves trial and error. Even experienced programmers writing in a programming language they know well will sometimes need to consult resources to solve a problem.

This is what critical thinking looks like in practice. Rather than immediately visualizing and implementing a perfectly coded solution to the problem, you’ll spend time evaluating the problem and your initial instinct for how to approach it. Is the first solution you think of really the best one? Or is it just the one you’re most familiar with?

Critical thinking requires taking time to deliberate and consider a range of possibilities rather than just going with your gut.

Critical thinking

How you can start thinking more critically

So, what are some strategies you can use to practice critical thinking? Here are a few things to try:

  1. Research a topic you consider yourself to be an expert on. Find an opposing viewpoint that you’d ordinarily dismiss and spend some time trying to understand it better. Even if you don’t end up changing your mind about the topic, you’ll arrive at a better understanding of alternative perspectives. You’ll probably also learn more about the values, experiences, and assumptions that inform your own position.

  2. Rewatch your favorite movie. Choose a scene that you find to be emotionally resonant and try to break it down into its constituent parts: the dialogue, the score, the lighting and cinematography, the structural role of the scene in the plot and in the character arc of the protagonist, and so on. Consider how all of these pieces of the scene are coordinated to elicit a specific emotional response from the audience. The goal here is to attain a little distance from that emotional response so that you can analyze it and consider the devices the film uses to draw it out.

  3. Many classic coding problems, such as reversing a string, can be solved multiple ways. So, if you already have some coding experience and you’re trying to refine your skills, find a familiar coding problem and try to solve it in a new way. Using pseudocode at this stage might help you to focus on the problem-solving process (you can always translate the solution into code later).

Afterwards, reflect on the experience. Did it reaffirm your usual approach to the problem? Or did you find a new approach that might be more effective or efficient? Either way, you’ll learn something valuable from questioning your default approach to solving the problem.

Critical thinking

Apply critical thinking today

Critical thinking isn’t a skill that you only learn once. Even if you have tons of experience parsing evidence, considering alternative perspectives, and deliberating before making decisions, there will be times when it’s difficult to apply these skills. Practicing critical thinking is an ongoing process that requires effort and self-awareness. It’s not easy, but it will make you a better thinker and a more skilled problem-solver.

If you’re an aspiring programmer, you'll find that learning critical thinking will help you learn to code. In turn, learning to code will provide you with an abundance of opportunities to strengthen your critical thinking skills. If you’re ready to take that next step, consider exploring Educative’s Introduction to Computers & Programming course. You’ll learn the basics of programming and computer science through a series of lessons, quizzes, and exercises. You’ll also learn more about some of the tools that programmers use to solve problems.

Happy learning!

Continue learning about computers and programming on Educative

Start a discussion

What other practices would you suggest to somebody trying to become a better critical thinker? Was this article helpful? Let us know in the comments below!

Top comments (0)

🌚 Friends don't let friends browse without dark mode.

Sorry, it's true.