What Is Problem Solving? How Software Engineers Approach Complex Challenges

HackerRank AI Promotion

From debugging an existing system to designing an entirely new software application, a day in the life of a software engineer is filled with various challenges and complexities. The one skill that glues these disparate tasks together and makes them manageable? Problem solving . 

Throughout this blog post, we’ll explore why problem-solving skills are so critical for software engineers, delve into the techniques they use to address complex challenges, and discuss how hiring managers can identify these skills during the hiring process. 

What Is Problem Solving?

But what exactly is problem solving in the context of software engineering? How does it work, and why is it so important?

Problem solving, in the simplest terms, is the process of identifying a problem, analyzing it, and finding the most effective solution to overcome it. For software engineers, this process is deeply embedded in their daily workflow. It could be something as simple as figuring out why a piece of code isn’t working as expected, or something as complex as designing the architecture for a new software system. 

In a world where technology is evolving at a blistering pace, the complexity and volume of problems that software engineers face are also growing. As such, the ability to tackle these issues head-on and find innovative solutions is not only a handy skill — it’s a necessity. 

The Importance of Problem-Solving Skills for Software Engineers

Problem-solving isn’t just another ability that software engineers pull out of their toolkits when they encounter a bug or a system failure. It’s a constant, ongoing process that’s intrinsic to every aspect of their work. Let’s break down why this skill is so critical.

Driving Development Forward

Without problem solving, software development would hit a standstill. Every new feature, every optimization, and every bug fix is a problem that needs solving. Whether it’s a performance issue that needs diagnosing or a user interface that needs improving, the capacity to tackle and solve these problems is what keeps the wheels of development turning.

It’s estimated that 60% of software development lifecycle costs are related to maintenance tasks, including debugging and problem solving. This highlights how pivotal this skill is to the everyday functioning and advancement of software systems.

Innovation and Optimization

The importance of problem solving isn’t confined to reactive scenarios; it also plays a major role in proactive, innovative initiatives . Software engineers often need to think outside the box to come up with creative solutions, whether it’s optimizing an algorithm to run faster or designing a new feature to meet customer needs. These are all forms of problem solving.

Consider the development of the modern smartphone. It wasn’t born out of a pre-existing issue but was a solution to a problem people didn’t realize they had — a device that combined communication, entertainment, and productivity into one handheld tool.

Increasing Efficiency and Productivity

Good problem-solving skills can save a lot of time and resources. Effective problem-solvers are adept at dissecting an issue to understand its root cause, thus reducing the time spent on trial and error. This efficiency means projects move faster, releases happen sooner, and businesses stay ahead of their competition.

Improving Software Quality

Problem solving also plays a significant role in enhancing the quality of the end product. By tackling the root causes of bugs and system failures, software engineers can deliver reliable, high-performing software. This is critical because, according to the Consortium for Information and Software Quality, poor quality software in the U.S. in 2022 cost at least $2.41 trillion in operational issues, wasted developer time, and other related problems.

Problem-Solving Techniques in Software Engineering

So how do software engineers go about tackling these complex challenges? Let’s explore some of the key problem-solving techniques, theories, and processes they commonly use.

Decomposition

Breaking down a problem into smaller, manageable parts is one of the first steps in the problem-solving process. It’s like dealing with a complicated puzzle. You don’t try to solve it all at once. Instead, you separate the pieces, group them based on similarities, and then start working on the smaller sets. This method allows software engineers to handle complex issues without being overwhelmed and makes it easier to identify where things might be going wrong.

Abstraction

In the realm of software engineering, abstraction means focusing on the necessary information only and ignoring irrelevant details. It is a way of simplifying complex systems to make them easier to understand and manage. For instance, a software engineer might ignore the details of how a database works to focus on the information it holds and how to retrieve or modify that information.

Algorithmic Thinking

At its core, software engineering is about creating algorithms — step-by-step procedures to solve a problem or accomplish a goal. Algorithmic thinking involves conceiving and expressing these procedures clearly and accurately and viewing every problem through an algorithmic lens. A well-designed algorithm not only solves the problem at hand but also does so efficiently, saving computational resources.

Parallel Thinking

Parallel thinking is a structured process where team members think in the same direction at the same time, allowing for more organized discussion and collaboration. It’s an approach popularized by Edward de Bono with the “ Six Thinking Hats ” technique, where each “hat” represents a different style of thinking.

In the context of software engineering, parallel thinking can be highly effective for problem solving. For instance, when dealing with a complex issue, the team can use the “White Hat” to focus solely on the data and facts about the problem, then the “Black Hat” to consider potential problems with a proposed solution, and so on. This structured approach can lead to more comprehensive analysis and more effective solutions, and it ensures that everyone’s perspectives are considered.

This is the process of identifying and fixing errors in code . Debugging involves carefully reviewing the code, reproducing and analyzing the error, and then making necessary modifications to rectify the problem. It’s a key part of maintaining and improving software quality.

Testing and Validation

Testing is an essential part of problem solving in software engineering. Engineers use a variety of tests to verify that their code works as expected and to uncover any potential issues. These range from unit tests that check individual components of the code to integration tests that ensure the pieces work well together. Validation, on the other hand, ensures that the solution not only works but also fulfills the intended requirements and objectives.

Explore verified tech roles & skills.

The definitive directory of tech roles, backed by machine learning and skills intelligence.

Explore all roles

Evaluating Problem-Solving Skills

We’ve examined the importance of problem-solving in the work of a software engineer and explored various techniques software engineers employ to approach complex challenges. Now, let’s delve into how hiring teams can identify and evaluate problem-solving skills during the hiring process.

Recognizing Problem-Solving Skills in Candidates

How can you tell if a candidate is a good problem solver? Look for these indicators:

  • Previous Experience: A history of dealing with complex, challenging projects is often a good sign. Ask the candidate to discuss a difficult problem they faced in a previous role and how they solved it.
  • Problem-Solving Questions: During interviews, pose hypothetical scenarios or present real problems your company has faced. Ask candidates to explain how they would tackle these issues. You’re not just looking for a correct solution but the thought process that led them there.
  • Technical Tests: Coding challenges and other technical tests can provide insight into a candidate’s problem-solving abilities. Consider leveraging a platform for assessing these skills in a realistic, job-related context.

Assessing Problem-Solving Skills

Once you’ve identified potential problem solvers, here are a few ways you can assess their skills:

  • Solution Effectiveness: Did the candidate solve the problem? How efficient and effective is their solution?
  • Approach and Process: Go beyond whether or not they solved the problem and examine how they arrived at their solution. Did they break the problem down into manageable parts? Did they consider different perspectives and possibilities?
  • Communication: A good problem solver can explain their thought process clearly. Can the candidate effectively communicate how they arrived at their solution and why they chose it?
  • Adaptability: Problem-solving often involves a degree of trial and error. How does the candidate handle roadblocks? Do they adapt their approach based on new information or feedback?

Hiring managers play a crucial role in identifying and fostering problem-solving skills within their teams. By focusing on these abilities during the hiring process, companies can build teams that are more capable, innovative, and resilient.

Key Takeaways

As you can see, problem solving plays a pivotal role in software engineering. Far from being an occasional requirement, it is the lifeblood that drives development forward, catalyzes innovation, and delivers of quality software. 

By leveraging problem-solving techniques, software engineers employ a powerful suite of strategies to overcome complex challenges. But mastering these techniques isn’t simple feat. It requires a learning mindset, regular practice, collaboration, reflective thinking, resilience, and a commitment to staying updated with industry trends. 

For hiring managers and team leads, recognizing these skills and fostering a culture that values and nurtures problem solving is key. It’s this emphasis on problem solving that can differentiate an average team from a high-performing one and an ordinary product from an industry-leading one.

At the end of the day, software engineering is fundamentally about solving problems — problems that matter to businesses, to users, and to the wider society. And it’s the proficient problem solvers who stand at the forefront of this dynamic field, turning challenges into opportunities, and ideas into reality.

This article was written with the help of AI. Can you tell which parts?

Get started with HackerRank

Over 2,500 companies and 40% of developers worldwide use HackerRank to hire tech talent and sharpen their skills.

  • DSA Tutorial
  • Data Structures
  • Linked List
  • Dynamic Programming
  • Binary Tree
  • Binary Search Tree
  • Divide & Conquer
  • Mathematical
  • Backtracking
  • Branch and Bound
  • Pattern Searching

How To Approach A Coding Problem ?

Solving a DSA (Data Structures and Algorithms) Problem is quite tough. In This article, we help you not only solve the problem but actually understand it, It’s not about just solving a problem it’s about understanding the problem. we will help to solve DSA problems on websites like Leetcode, CodeChef, Codeforces, and Geeksforgeeks. the importance of solving a problem is not just limited to job interviews or solve problems on online platform, its about develop a problem solving abilities which is make your prefrontal cortex strong, sharp and prepared it to solve complex problem in future, not only DSA problems also in life.

These steps you need to follow while solving a problem:

– Understand the question, read it 2-3 times. – Take an estimate of the required complexity. – find, edge cases based on the constraints. – find a brute-force solution. ensure it will pass. – Optimize code, ensure, and repeat this step. – Dry-run your solution(pen& paper) on the test cases and edge cases. – Code it and test it with the test cases and edge cases. – Submit solution. Debug it and fix it, if the solution does not work.

How-to-Approach-a-Coding-Problem

Understand The Question

firstly read it 2-3 times, It doesn’t matter if you have seen the question in the past or not, read the question several times and understand it completely. Now, think about the question and analyze it carefully. Sometimes we read a few lines and assume the rest of the things on our own but a slight change in your question can change a lot of things in your code so be careful about that. Now take a paper and write down everything. What is given (input) and what you need to find out (output)? While going through the problem you need to ask a few questions yourself…

  • Did you understand the problem fully?
  • Would you be able to explain this question to someone else?
  • What and how many inputs are required?
  • What would be the output for those inputs
  • Do you need to separate out some modules or parts from the problem?
  • Do you have enough information to solve that question? If not then read the question again or clear it to the interviewer.

                Estimate of the required complexity

Look at the constraints and time limit. This should give you a rough idea of the expected time and space complexity. Use this step to reject the solutions that will not pass the limits. With some practice, you will be able to get an estimate within seconds of glancing at the constraints and limits.

              Find, edge cases 

In most problems, you would be provided with sample input and output with which you can test your solution. These tests would most likely not contain the edge cases. Edge cases are the boundary cases that might need additional handling. Before jumping on to any solution, write down the edge cases that your solution should work on. When you try to understand the problem take some sample inputs and try to analyze the output. Taking some sample inputs will help you to understand the problem in a better way. You will also get clarity that how many cases your code can handle and what all can be the possible output or output range.

Constraints 

0 <= T <= 100

1 <= N <= 1000

-1000 <= value of element <= 1000

Find a brute-force Solution

A brute-force solution for a DSA (Data Structure and Algorithm) problem involves exhaustively checking all possible solutions until the correct one is found. This method is typically very time-consuming and not efficient, but can be useful for small-scale problems or as a way to verify the correctness of a more optimized solution. One example of a problem that could be solved using a brute-force approach is finding the shortest path in a graph. The algorithm would check every possible path until the shortest one is found.

Break Down The Problem

When you see a coding question that is complex or big, instead of being afraid and getting confused that how to solve that question, break down the problem into smaller chunks and then try to solve each part of the problem. Below are some steps you should follow in order to solve the complex coding questions… 

  • Make a flow chart or a UML for the problem at hand.
  • Divide the problem into sub-problems or smaller chunks.
  • Solve the subproblems. Make independent functions for each subproblem.
  • Connect the solutions of each subproblem by calling them in the required order, or as necessary.
  • Wherever it’s required use classes and objects while handling questions (for real-world problems like management systems, etc.)

Optimize your Code

Always try to improve your code. Look back, analyze it once again and try to find a better or alternate solution. We have mentioned earlier that you should always try to write the right amount of good code so always look for the alternate solution which is more efficient than the previous one. Writing the correct solution to your problem is not the final thing you should do. Explore the problem completely with all possible solutions and then write down the most efficient or optimized solution for your code. So once you are done with writing the solution for your code below are some questions you should ask yourself. 

Optimizing a solution in DSA (Data Structure and Algorithm) refers to improving the efficiency of an algorithm by reducing the time and/or space complexity. This can be done by using techniques such as dynamic programming, greedy algorithms, divide and conquer, backtracking, or using more efficient data structures.

It’s important to note that the optimization process is not always straightforward and it can be highly dependent on the specific problem and constraints. The optimization process usually starts with a brute force approach, and then various techniques will be applied to make the algorithm more efficient. The optimization process will often require a trade-off between time and space complexity.

Also, measuring and analyzing the performance of the algorithm is an essential step in the optimization process. The use of mathematical notation and analysis tools like Big O notation and complexity analysis, can help to understand the performance of an algorithm and decide which one is the best.

  • Does this code run for every possible input including the edge cases.
  • Is there an alternate solution for the same problem?
  • Is the code efficient? Can it be more efficient or can the performance be improved?
  • How else can you make the code more readable?
  • Are there any more extra steps or functions you can take out?
  • Is there any repetition in your code? Take it out.

Below is the alternate solution for the same problem of the array which returns even numbers… 

          Dry-run your solution

Dry-running a solution on test cases and edge cases involves manually going through the steps of the algorithm with sample inputs and verifying that the output is correct. This process can help to identify any bugs or errors in the code, as well as ensure that the algorithm is correctly handling all possible inputs, including edge cases.

When dry-running your solution, it’s important to consider both the expected test cases and any unexpected edge cases that may arise. Edge cases are inputs that are at the boundaries of the problem’s constraints, for example, the maximum or minimum values.

To dry-run the solution, you will need to:

  • Write down the sample test case inputs and expected outputs.
  • Go through the steps of the algorithm manually, using the test case inputs.
  • Compare the output of the algorithm to the expected output, to ensure the solution is correct.
  • Repeat the process for each test case and edge case.
  • Dry-running your solution on test cases and edge cases can help you to identify any issues with your algorithm, and make any necessary adjustments before running the code on a computer.

             Code & Test it On Edge Cases

After dry-running your solution and verifying that it is right, the next step is to code it and test it using the test cases and edge cases.

To code the solution, you will need to:

  •  write the code for the algorithm.
  • Make sure to include any necessary data structures and methods.
  • Test the code with sample inputs, including the test cases and edge cases that were used during the dry-run.
  • When testing the code, it’s important to not only check for the expected outputs, but also for any unexpected behavior or errors. Testing with edge cases is especially important as it can reveal bugs or errors that might not be present in other test cases.

It’s also a good practice to test the code with additional test cases and edge cases, to further ensure the correctness and robustness of the solution.

Once the code has been tested and all the bugs have been fixed, you can submit it.

 Submit solution

After coding and testing the solution on the sample test cases, the next step is to submit it, usually to a platform for review or for a contest.

The submission process can depending on the platform, but basically it involves submitting the code and any necessary documentation. After the submission, the solution is usually reviewed by other participants or judges, and feedback is provided on whether the solution is correct or if there are any errors. If the solution is wrong or does not work as expected, the next step is to debug and fix it. Debugging is the process of identifying and resolving errors in the code. This can involve using tools such as a debugger, print statements, or logging to find the source of the problem.

Once the error has been identified, the next step is to fix it. This can involve making changes to the code, data structures, or algorithms used. Once the changes have been made, it’s important to test the solution again to ensure that the error has been resolved and that the solution is correct.

If the solution is correct, you can submit it again or move on to other problems.

It’s important to note that the debugging and fixing process can be an iterative one and it may take several iterations to get the solution working correctly.

author

Please Login to comment...

Similar reads.

  • Competitive Programming

Improve your Coding Skills with Practice

 alt=

What kind of Experience do you want to share?

Tutorial Playlist

Programming tutorial, your guide to the best backend languages for 2024, an ultimate guide that helps you to start learn coding 2024, what is backend development: the ultimate guide for beginners, all you need to know for choosing the first programming language to learn, here’s all you need to know about coding, decoding, and reasoning with examples, understanding what is xml: the best guide to xml and its concepts., an ultimate guide to learn the importance of low-code and no-code development, top frontend languages that you should know about, top 75+ frontend developer interview questions and answers, the ultimate guide to learn typescript generics, the most comprehensive guide for beginners to know ‘what is typescript’.

The Ultimate Guide on Introduction to Competitive Programming

Top 60+ TCS NQT Interview Questions and Answers for 2024

Most commonly asked logical reasoning questions in an aptitude test, everything you need to know about advanced typescript concepts, an absolute guide to build c hello world program, a one-stop solution guide to learn how to create a game in unity, what is nat significance of nat for translating ip addresses in the network model, data science vs software engineering: key differences, a real-time chat application typescript project using node.js as a server, what is raspberry pi here’s the best guide to get started, what is arduino here’s the best beginners guide to get started, arduino vs. raspberry pi: which is the better board, the perfect guide for all you need to learn about mean stack, software developer resume: a comprehensive guide, here’s everything all you need to know about the programming roadmap, an ultimate guide that helps you to develop and improve problem solving in programming, the top 10 awesome arduino projects of all time, pyspark rdd: everything you need to know about pyspark rdd, wipro interview questions and answers that you should know before going for an interview, how to use typescript with nodejs: the ultimate guide, what is rust programming language why is it so popular, software terminologies, an ultimate guide that helps you to develop and improve problem solving in programming.

Lesson 27 of 33 By Hemant Deshpande

An Ultimate Guide That Helps You to Develop and Improve Problem Solving in Programming

Table of Contents

Coding and Programming skills hold a significant and critical role in implementing and developing various technologies and software. They add more value to the future and development. These programming and coding skills are essential for every person to improve problem solving skills. So, we brought you this article to help you learn and know the importance of these skills in the future. 

Want a Top Software Development Job? Start Here!

Want a Top Software Development Job? Start Here!

Topics covered in this problem solving in programming article are:

  • What is Problem Solving in Programming? 
  • Problem Solving skills in Programming
  • How does it impact your career ?
  • Steps involved in Problem Solving
  • Steps to improve Problem Solving in programming

What is Problem Solving in Programming?

Computers are used to solve various problems in day-to-day life. Problem Solving is an essential skill that helps to solve problems in programming. There are specific steps to be carried out to solve problems in computer programming, and the success depends on how correctly and precisely we define a problem. This involves designing, identifying and implementing problems using certain steps to develop a computer.

When we know what exactly problem solving in programming is, let us learn how it impacts your career growth.

How Does It Impact Your Career?

Many companies look for candidates with excellent problem solving skills. These skills help people manage the work and make candidates put more effort into the work, which results in finding solutions for complex problems in unexpected situations. These skills also help to identify quick solutions when they arise and are identified. 

People with great problem solving skills also possess more thinking and analytical skills, which makes them much more successful and confident in their career and able to work in any kind of environment. 

The above section gives you an idea of how problem solving in programming impacts your career and growth. Now, let's understand what problem solving skills mean.

Problem Solving Skills in Programming

Solving a question that is related to computers is more complicated than finding the solutions for other questions. It requires excellent knowledge and much thinking power. Problem solving in programming skills is much needed for a person and holds a major advantage. For every question, there are specific steps to be followed to get a perfect solution. By using those steps, it is possible to find a solution quickly.

The above section is covered with an explanation of problem solving in programming skills. Now let's learn some steps involved in problem solving.

Steps Involved in Problem Solving

Before being ready to solve a problem, there are some steps and procedures to be followed to find the solution. Let's have a look at them in this problem solving in programming article.

Basically, they are divided into four categories:

  • Analysing the problem
  • Developing the algorithm
  • Testing and debugging

Analysing the Problem

Every problem has a perfect solution; before we are ready to solve a problem, we must look over the question and understand it. When we know the question, it is easy to find the solution for it. If we are not ready with what we have to solve, then we end up with the question and cannot find the answer as expected. By analysing it, we can figure out the outputs and inputs to be carried out. Thus, when we analyse and are ready with the list, it is easy and helps us find the solution easily. 

Developing the Algorithm

It is required to decide a solution before writing a program. The procedure of representing the solution  in a natural language called an algorithm. We must design, develop and decide the final approach after a number of trials and errors, before actually writing the final code on an algorithm before we write the code. It captures and refines all the aspects of the desired solution.

Once we finalise the algorithm, we must convert the decided algorithm into a code or program using a dedicated programming language that is understandable by the computer to find a desired solution. In this stage, a wide variety of programming languages are used to convert the algorithm into code. 

Testing and Debugging

The designed and developed program undergoes several rigorous tests based on various real-time parameters and the program undergoes various levels of simulations. It must meet the user's requirements, which have to respond with the required time. It should generate all expected outputs to all the possible inputs. The program should also undergo bug fixing and all possible exception handling. If it fails to show the possible results, it should be checked for logical errors.

Industries follow some testing methods like system testing, component testing and acceptance testing while developing complex applications. The errors identified while testing are debugged or rectified and tested again until all errors are removed from the program.

The steps mentioned above are involved in problem solving in programming. Now let's see some more detailed information about the steps to improve problem solving in programming.

Steps to Improve Problem Solving in Programming

Right mindset.

The way to approach problems is the key to improving the skills. To find a solution, a positive mindset helps to solve problems quickly. If you think something is impossible, then it is hard to achieve. When you feel free and focus with a positive attitude, even complex problems will have a perfect solution.

Making Right Decisions

When we need to solve a problem, we must be clear with the solution. The perfect solution helps to get success in a shorter period. Making the right decisions in the right situation helps to find the perfect solution quickly and efficiently. These skills also help to get more command over the subject.

Keeping Ideas on Track

Ideas always help much in improving the skills; they also help to gain more knowledge and more command over things. In problem solving situations, these ideas help much and help to develop more skills. Give opportunities for the mind and keep on noting the ideas.

Learning from Feedbacks

A crucial part of learning is from the feedback. Mistakes help you to gain more knowledge and have much growth. When you have a solution for a problem, go for the feedback from the experienced or the professionals. It helps you get success within a shorter period and enables you to find other solutions easily.

Asking Questions

Questions are an incredible part of life. While searching for solutions, there are a lot of questions that arise in our minds. Once you know the question correctly, then you are able to find answers quickly. In coding or programming, we must have a clear idea about the problem. Then, you can find the perfect solution for it. Raising questions can help to understand the problem.

These are a few reasons and tips to improve problem solving in programming skills. Now let's see some major benefits in this article.

  • Problem solving in programming skills helps to gain more knowledge over coding and programming, which is a major benefit.
  • These problem solving skills also help to develop more skills in a person and build a promising career.
  • These skills also help to find the solutions for critical and complex problems in a perfect way.
  • Learning and developing problem solving in programming helps in building a good foundation.
  • Most of the companies are looking for people with good problem solving skills, and these play an important role when it comes to job opportunities 
Don't miss out on the opportunity to become a Certified Professional with Simplilearn's Post Graduate Program in Full Stack Web Development . Enroll Today!

Problem solving in programming skills is important in this modern world; these skills build a great career and hold a great advantage. This article on problem solving in programming provides you with an idea of how it plays a massive role in the present world. In this problem solving in programming article, the skills and the ways to improve more command on problem solving in programming are mentioned and explained in a proper way.

If you are looking to advance in your career. Simplilearn provides training and certification courses on various programming languages - Python , Java , Javascript , and many more. Check out our Full Stack Developer - MERN Stack course that will help you excel in your career.

If you have any questions for us on the problem solving in programming article. Do let us know in the comments section below; we have our experts answer it right away.

Find our Full Stack Developer - MERN Stack Online Bootcamp in top cities:

NameDatePlace
Cohort starts on 18th Sep 2024,
Weekend batch
Your City
Cohort starts on 9th Oct 2024,
Weekend batch
Your City
Cohort starts on 30th Oct 2024,
Weekend batch
Your City

About the Author

Hemant Deshpande

Hemant Deshpande, PMP has more than 17 years of experience working for various global MNC's. He has more than 10 years of experience in managing large transformation programs for Fortune 500 clients across verticals such as Banking, Finance, Insurance, Healthcare, Telecom and others. During his career he has worked across the geographies - North America, Europe, Middle East, and Asia Pacific. Hemant is an internationally Certified Executive Coach (CCA/ICF Approved) working with corporate leaders. He also provides Management Consulting and Training services. He is passionate about writing and regularly blogs and writes content for top websites. His motto in life - Making a positive difference.

Recommended Resources

Your One-Stop Solution to Understand Coin Change Problem

Your One-Stop Solution to Understand Coin Change Problem

Combating the Global Talent Shortage Through Skill Development Programs

Combating the Global Talent Shortage Through Skill Development Programs

What Is Problem Solving? Steps, Techniques, and Best Practices Explained

What Is Problem Solving? Steps, Techniques, and Best Practices Explained

One Stop Solution to All the Dynamic Programming Problems

One Stop Solution to All the Dynamic Programming Problems

The Ultimate Guide on Introduction to Competitive Programming

The Ultimate Guide to Top Front End and Back End Programming Languages for 2021

  • PMP, PMI, PMBOK, CAPM, PgMP, PfMP, ACP, PBA, RMP, SP, and OPM3 are registered marks of the Project Management Institute, Inc.

Walkthrough

Programming problem solving walkthrough.

A programming problem solving walkthrough is a written guided description of the journey from a problem to a solution. It aims to teach how to solve programming problems in a methodical and thoughtful manner using the model. In other words, the knowledge to be learned is focused on the "how", and not on the programming language per se.

The walkthrough, as a teaching method, is based on two concepts: worked example from learning sciences and literate programming from computer science.

A worked example is a step-by-step demonstration of how to solve a problem. Learning scientists found out that worked examples are most effective for novices (i.e., the audience of a walkthrough), while performing problem-solving is more beneficial for experts. There are multiple ways of presenting and supporting worked examples , and one of the evidence-based techniques is to include sub-goal labeling, which is about labeling groups of steps in the worked example.

Literate programming by Donald E. Knuth is a programming paradigm in which a program is written as interspersed snippets of executable code and text. The text, which is written in ordinary human language, explains the logic of the code and explains the programmer's thoughts and decisions. Thus a program is perceived much more like an essay.

The walkthrough combines these two powerful ideas for learning the craft of problem solving by programming. It uses the programming problem solving model and its supplements to give a framework for establishing the learning objectives, as well as defining the walkthrough's structure and flow.

The learning objective of a walkthrough is rooted in one of the phases (for example, acquiring the ability to use a specific design strategy). That's in addition to the always-present learning objective of mastering the instrumentation of end-to-end problem solving .

Many times the solving process is hidden, and one gets only the final result, the executable code. Therefore, an essential feature of a walkthrough is making the reasoning explicit, as suggested by literate programming. In other words, it brings the solving process to the surface and documents the train of thought of the problem-solver as they go through each of the phases. In fact, a walkthrough aims to prompt self-explanation by the learners.

A similar but different flavor of a walkthrough is one that is developed by the learners. They choose a programming problem and fill in a provided walkthrough template. The learners improve their ability to solve problems by explicitly documenting their own process.

This page was written with Python in mind, with Jupyter Notebook that serves as the medium for the walkthrough. Notebooks are natural for literate programming , with their capability to mix text, media, and code in cells. Nevertheless, a walkthrough is a teaching method which is beyond one programming language or another, and it can also be developed as a source code file.

Few (opinionated) Principles and Practices

A walkthrough is an active learning activity. It is similar to a tutorial in the sense that it is most effective if the reader follows along by actually performing the tasks being described. In our particular case the tasks are based on the phases of the problem-solving model .

For example:

  • Reinterpret the Problem phase - suggest input-output instances.
  • Design a Solution phase - write about choosing a data structure, what attributes make it fit.

While it is important to focus on one particular phase so as not to overwhelm the learner, other phases should not be neglected. To keep the student engaged throughout the walkthrough it is suggested to use less demanding, yet active, tasks.

Tasks suggested by phase appear later on this page.

The walkthrough is designed to achieve teachable moments , in which it leads the learners to a point where they discover or apply a concept, an idea or a technique from the learning objectives.

At the same time a walkthrough must manage cognitive load , with a great focus on the external one.

The walkthrough is a "better version of reality" that focuses on the learning, and not on accurate journaling of the problem solving process . By its nature, this process is often messy and non-linear. Meanwhile, the goal of the walkthrough is to guide the learner through solving the problem in a logical and clear manner, without recording all the twists and turns. In that sense, the walkthrough is a "better version of reality", in which the actual steps are filtered and distilled to support the designer's learning objectives efficiently.

The text and code should be written in expository style . Even if a program has a hierarchical (tree) design, it this might not mean that this structure is the best for its development.

A problem should be solved and explored in a psychologically correct order , following the solver's "stream of consciousness" . The objective is to go through the process of solving, and a walkthrough inherently performs a "linearization" of this path. As Donald E. Knuth wrote:

My experiences have led me to believe that a person reading a program is likewise, ready to comprehend it by learning its various parts in approximately the order in which it was written.

The walkthrough is intended to be perceived as a dialogue with the learner . Of course, this is impossible due to the non-interactive format, but aimed as aspiration.

Walkthroughs are not stand alone but should be considered in context of a unit or a course. After the learners worked on the walkthrough, a wrap-up session (that might include a presentation or live coding of partial or complete solution) should take place.

Use of real-word problems or cover story can increase the motivation of the learners.

It is advised to limit the external permitted materials for the learners.

Checklist / Rubric

This is an opinionated checklist of all the points that a decent walkthrough should fulfill. It refers to the complete walkthrough after a learner performs all the tasks. It is up to the developer to decide which parts are already presented at the beginning and which are left to the learners.

  • Get something working and keep it working:
  • First writing code in cells, testing it and only then encapsulating into functions

Reinterpret the Problem

  • Rephrasing the problem statement in their own words
  • Writing the solution contract
  • Meaning and (Python) type
  • One or few input-output pairs of concrete instances (it doesn't need to be comprehensive right now, it is not the Test phase)

Design a Solution

  • Ultimately, a walkthrough should break down the problem into hierarchical sub-problems; in other words, it should present an outline of the solution decomposed into sub-problems.
  • Following the DRY (Don't Repeat Yourself ) design principle - Identifying repeating sub-problems
  • A mapping between the information in the problem/solution domain to a data-structure (either primitive or composed, flat or nested) in Python
  • Describing the meaning of the data structure, the relationship between its components and the required operation (a.k.a questions)
  • Transforming well the design into code
  • Pythonic Code - Python Idioms
  • Meaningful Names
  • Using Comments
  • Using Helper Functions when needed (e.g., for following DRY)
  • Black box (e.g., trivial cases, simplest non-trivial cases, edge cases, corner cases - but it is not mandatory to write the type)
  • White box - coverage / path-complete
  • Scenario - Using the language of the problem phase/domain
  • Instance - Concrete Input-Output pairs
  • The test case follows the simplicity principle - the instance(s) should be the simplest possible to test the scenario.
  • Following the empirical approach for debugging (reproduce, diagnose, fix, repeat, reflect)
  • Diagnose - Focus on reasoning on the available clues (e.g., the bug itself - input/output and trace-back, reading the code with a critical eye, using the print function)

Evaluate & Reflect

  • Functionality
  • Design & Code
  • Readability, Style & Documentation
  • Alignment between the presented problem solving process and the takeaways
  • Postmortem of the problem solving or debugging process
  • Self-debugging - what the programmer can learn from solving this problem.

Solution Program - Solving the Problem

  • Copy-paste and organize all the necessary code for a complete solution of the problem in one cell or py file, and execute it to solve the original problem. Note that it might require asking the learners to combine code snippets from different parts of the notebook.
  • The code in the solution section is self-contained for execution, and doesn't depend on other snippets of code from the previous steps.
  • This section also contains tests of the solution code.

Tips for Developing a Walkthrough

The Carpentries Curriculum Development Handbook is an excellent resource for how to develop a curriculum in computing and what it says is equally applicable to developing a walkthrough.

First of all, set the learning objectives using the programming problem solving model terminology.

Form a problem - choose an algorithmic one or real-world one.

Solve the problem, document your process based on the model, pay attention to your mistakes and bugs.

Reflect on your problem solving process and try to distill it into steps and teachable moments.

Refactor your code and remove clutter. While it doesn't have to be the best possible, make sure to adjust for the required ability of your learners.

Write an outline of the walkthrough and embed your code in the relevant sections. Validate it with a checklist .

Decide what tasks the learners should do, making sure they align with the learning objectives.

Write the complete text of the walkthrough that guides the learners. It is advised to use the plural first person pronoun "we".

Run a pilot of the walkthrough on a small group of learners.

Repeat and improve!

Suggested Tasks by Phase

  • Phrase the problem in your own words
  • Write three examples of input-output pairs for the problem
  • Write the solution of the problem or of a function (in the docstring)
  • Write a design (either as text or as a diagram) for a problem or a sub-problem
  • Choose a data structure and reason about it
  • Describe how to solve the problem "by hand" for one specific input
  • Solve a Parson's Puzzle (or the two-dimensional flavor ). It can be created and embedded in Jupyter Notebook with http://parsons.problemsolving.io
  • Write code according to a design (either done by the learner or given in the walkthrough)
  • Draw an environment diagram
  • Answer questions about it
  • Write a docstring to a function
  • Give meaningful names for variables in the code
  • Extract its design (e.g., write a "design tweet" with a maximum of 240 characters)
  • Discuss its design - why did the solver choose that particular design and not another, especially pay attention to the data structures
  • Write test cases for the problem or function
  • Fix a bug in a given piece of code
  • Describe a bug you had while solving the problem, and explain how you fixed it
  • Evaluate a given piece of code
  • Evaluate your code
  • Reflect on your problem solving process

Repeat & Improve

  • Refactor a given piece of code (e.g., because of speed or design issues)

Additional ideas and inspiration for tasks can be found in the Exercise types chapter from "Teaching Tech Together" and in the Catalog of pedagogical patterns chapter from "Teaching and Learning with Jupyter".

  • A Walkthrough is a written guided description of the journey from a problem to a solution.
  • It aims to teach how to solve programming problems in a methodical and thoughtful manner using the model.
  • The conceptual roots of the walkthrough as a teaching method are the ideas of worked examples and literate programming .
  • It is designed to prompt self-explanation by the learners.
  • Jupyter Notebook serves as the medium, and it includes active learning tasks.
  • Walkthroughs - Open Education Resources
  • Worked and faded examples - MIT Open Learning
  • Skudder, B., & Luxton-Reilly, A. (2014, January). Worked examples in computer science . In Proceedings of the Sixteenth Australasian Computing Education Conference-Volume 148 (pp. 59-64). Australian Computer Society, Inc..
  • Lauren Margulieux - Research and Papers - Subgoal Labels and Worked Examples
  • Literate Programming website
  • Knuth, D. E. (1984). Literate programming . The Computer Journal, 27(2), 97-111.
  • Exercise Types - Teaching Tech Together
  • Catalog of Pedagogical Patterns - Teaching and Learning with Jupyter
  • The Carpentries Curriculum Development Handbook

Copyright © 2020 Shlomi Hod. All rights reserved.

results matching " "

No results matching " ".

How to think like a programmer — lessons in problem solving

How to think like a programmer — lessons in problem solving

by Richard Reis

aNP21-ICMABUCyfdi4Pys7P0D2wiZqTd3iRY

If you’re interested in programming, you may well have seen this quote before:

“Everyone in this country should learn to program a computer, because it teaches you to think.” — Steve Jobs

You probably also wondered what does it mean, exactly, to think like a programmer? And how do you do it??

Essentially, it’s all about a more effective way for problem solving .

In this post, my goal is to teach you that way.

By the end of it, you’ll know exactly what steps to take to be a better problem-solver.

Why is this important?

Problem solving is the meta-skill.

We all have problems. Big and small. How we deal with them is sometimes, well…pretty random.

Unless you have a system, this is probably how you “solve” problems (which is what I did when I started coding):

  • Try a solution.
  • If that doesn’t work, try another one.
  • If that doesn’t work, repeat step 2 until you luck out.

Look, sometimes you luck out. But that is the worst way to solve problems! And it’s a huge, huge waste of time.

The best way involves a) having a framework and b) practicing it.

“Almost all employers prioritize problem-solving skills first.
Problem-solving skills are almost unanimously the most important qualification that employers look for….more than programming languages proficiency, debugging, and system design.
Demonstrating computational thinking or the ability to break down large, complex problems is just as valuable (if not more so) than the baseline technical skills required for a job.” — Hacker Rank ( 2018 Developer Skills Report )

Have a framework

To find the right framework, I followed the advice in Tim Ferriss’ book on learning, “ The 4-Hour Chef ”.

It led me to interview two really impressive people: C. Jordan Ball (ranked 1st or 2nd out of 65,000+ users on Coderbyte ), and V. Anton Spraul (author of the book “ Think Like a Programmer: An Introduction to Creative Problem Solving ”).

I asked them the same questions, and guess what? Their answers were pretty similar!

Soon, you too will know them.

Sidenote: this doesn’t mean they did everything the same way. Everyone is different. You’ll be different. But if you start with principles we all agree are good, you’ll get a lot further a lot quicker.

“The biggest mistake I see new programmers make is focusing on learning syntax instead of learning how to solve problems.” — V. Anton Spraul

So, what should you do when you encounter a new problem?

Here are the steps:

1. Understand

Know exactly what is being asked. Most hard problems are hard because you don’t understand them (hence why this is the first step).

How to know when you understand a problem? When you can explain it in plain English.

Do you remember being stuck on a problem, you start explaining it, and you instantly see holes in the logic you didn’t see before?

Most programmers know this feeling.

This is why you should write down your problem, doodle a diagram, or tell someone else about it (or thing… some people use a rubber duck ).

“If you can’t explain something in simple terms, you don’t understand it.” — Richard Feynman

Don’t dive right into solving without a plan (and somehow hope you can muddle your way through). Plan your solution!

Nothing can help you if you can’t write down the exact steps.

In programming, this means don’t start hacking straight away. Give your brain time to analyze the problem and process the information.

To get a good plan, answer this question:

“Given input X, what are the steps necessary to return output Y?”

Sidenote: Programmers have a great tool to help them with this… Comments!

Pay attention. This is the most important step of all.

Do not try to solve one big problem. You will cry.

Instead, break it into sub-problems. These sub-problems are much easier to solve.

Then, solve each sub-problem one by one. Begin with the simplest. Simplest means you know the answer (or are closer to that answer).

After that, simplest means this sub-problem being solved doesn’t depend on others being solved.

Once you solved every sub-problem, connect the dots.

Connecting all your “sub-solutions” will give you the solution to the original problem. Congratulations!

This technique is a cornerstone of problem-solving. Remember it (read this step again, if you must).

“If I could teach every beginning programmer one problem-solving skill, it would be the ‘reduce the problem technique.’
For example, suppose you’re a new programmer and you’re asked to write a program that reads ten numbers and figures out which number is the third highest. For a brand-new programmer, that can be a tough assignment, even though it only requires basic programming syntax.
If you’re stuck, you should reduce the problem to something simpler. Instead of the third-highest number, what about finding the highest overall? Still too tough? What about finding the largest of just three numbers? Or the larger of two?
Reduce the problem to the point where you know how to solve it and write the solution. Then expand the problem slightly and rewrite the solution to match, and keep going until you are back where you started.” — V. Anton Spraul

By now, you’re probably sitting there thinking “Hey Richard... That’s cool and all, but what if I’m stuck and can’t even solve a sub-problem??”

First off, take a deep breath. Second, that’s fair.

Don’t worry though, friend. This happens to everyone!

The difference is the best programmers/problem-solvers are more curious about bugs/errors than irritated.

In fact, here are three things to try when facing a whammy:

  • Debug: Go step by step through your solution trying to find where you went wrong. Programmers call this debugging (in fact, this is all a debugger does).
“The art of debugging is figuring out what you really told your program to do rather than what you thought you told it to do.”” — Andrew Singer
  • Reassess: Take a step back. Look at the problem from another perspective. Is there anything that can be abstracted to a more general approach?
“Sometimes we get so lost in the details of a problem that we overlook general principles that would solve the problem at a more general level. […]
The classic example of this, of course, is the summation of a long list of consecutive integers, 1 + 2 + 3 + … + n, which a very young Gauss quickly recognized was simply n(n+1)/2, thus avoiding the effort of having to do the addition.” — C. Jordan Ball

Sidenote: Another way of reassessing is starting anew. Delete everything and begin again with fresh eyes. I’m serious. You’ll be dumbfounded at how effective this is.

  • Research: Ahh, good ol’ Google. You read that right. No matter what problem you have, someone has probably solved it. Find that person/ solution. In fact, do this even if you solved the problem! (You can learn a lot from other people’s solutions).

Caveat: Don’t look for a solution to the big problem. Only look for solutions to sub-problems. Why? Because unless you struggle (even a little bit), you won’t learn anything. If you don’t learn anything, you wasted your time.

Don’t expect to be great after just one week. If you want to be a good problem-solver, solve a lot of problems!

Practice. Practice. Practice. It’ll only be a matter of time before you recognize that “this problem could easily be solved with <insert concept here>.”

How to practice? There are options out the wazoo!

Chess puzzles, math problems, Sudoku, Go, Monopoly, video-games, cryptokitties, bla… bla… bla….

In fact, a common pattern amongst successful people is their habit of practicing “micro problem-solving.” For example, Peter Thiel plays chess, and Elon Musk plays video-games.

“Byron Reeves said ‘If you want to see what business leadership may look like in three to five years, look at what’s happening in online games.’
Fast-forward to today. Elon [Musk], Reid [Hoffman], Mark Zuckerberg and many others say that games have been foundational to their success in building their companies.” — Mary Meeker ( 2017 internet trends report )

Does this mean you should just play video-games? Not at all.

But what are video-games all about? That’s right, problem-solving!

So, what you should do is find an outlet to practice. Something that allows you to solve many micro-problems (ideally, something you enjoy).

For example, I enjoy coding challenges. Every day, I try to solve at least one challenge (usually on Coderbyte ).

Like I said, all problems share similar patterns.

That’s all folks!

Now, you know better what it means to “think like a programmer.”

You also know that problem-solving is an incredible skill to cultivate (the meta-skill).

As if that wasn’t enough, notice how you also know what to do to practice your problem-solving skills!

Phew… Pretty cool right?

Finally, I wish you encounter many problems.

You read that right. At least now you know how to solve them! (also, you’ll learn that with every solution, you improve).

“Just when you think you’ve successfully navigated one obstacle, another emerges. But that’s what keeps life interesting.[…]
Life is a process of breaking through these impediments — a series of fortified lines that we must break through.
Each time, you’ll learn something.
Each time, you’ll develop strength, wisdom, and perspective.
Each time, a little more of the competition falls away. Until all that is left is you: the best version of you.” — Ryan Holiday ( The Obstacle is the Way )

Now, go solve some problems!

And best of luck ?

Special thanks to C. Jordan Ball and V. Anton Spraul . All the good advice here came from them.

Thanks for reading! If you enjoyed it, test how many times can you hit in 5 seconds. It’s great cardio for your fingers AND will help other people see the story.

If this article was helpful, share it .

Learn to code for free. freeCodeCamp's open source curriculum has helped more than 40,000 people get jobs as developers. Get started

COMMENTS

  1. How to Solve Coding Problems with a Simple Four Step Method

    In this post, we’ve gone over the four-step problem-solving strategy for solving coding problems. Let's review them here: Step 1: understand the problem. Step 2: create a step-by-step plan for how you’ll solve it. Step 3: carry out the plan and write the actual code. Step 4: look back and possibly refactor your solution if it could be better.

  2. CBSE Class 11 | Problem Solving Methodologies - GeeksforGeeks

    Under problem-solving methodology, we will see a step by step solution for a problem. These steps closely resemble the software life cycle . A software life cycle involves several stages in a program’s life cycle.

  3. What is Problem Solving? An Introduction - HackerRank Blog

    Problem solving, in the simplest terms, is the process of identifying a problem, analyzing it, and finding the most effective solution to overcome it. For software engineers, this process is deeply embedded in their daily workflow.

  4. How To Approach A Coding Problem - GeeksforGeeks

    These steps you need to follow while solving a problem: – Understand the question, read it 2-3 times. – Take an estimate of the required complexity. – find, edge cases based on the constraints. – find a brute-force solution. ensure it will pass. – Optimize code, ensure, and repeat this step.

  5. Problem Solving Basics and Computer Programming - IIT

    The first step to solving any problem is to decompose the problem description. A good way to do this would be to perform syntactic analysis on the description. We can do this in four steps. 1. Identify all of the nouns in the sentence. Given the 3 dimensions of a box (length, width, and height), calculate the volume.

  6. How to Develop Problem Solving Skills in Programming ...

    There are specific steps to be carried out to solve problems in computer programming, and the success depends on how correctly and precisely we define a problem. This involves designing, identifying and implementing problems using certain steps to develop a computer.

  7. Computer Programming Problem Solving Process - Germanna

    Step 1 – Identify the problem that must be solved. The first step is to identify the problem that needs to be solved. In this example, the largest number in the list must be found and displayed. Step 2 – Understand what the problem presents. The problem presents a list of numbers.

  8. 10 Steps to Solving a Programming Problem - codeburst

    Here’s my process and some tips to tackling a sample problem that hopefully some of you may find helpful in your journey. 1. Read the problem at least three times (or however many makes you feel comfortable) You can’t solve a problem you don’t understand. There is a difference between the problem and the problem you think you are solving.

  9. Walkthrough · GitBook - Problem Solving

    A programming problem solving walkthrough is a written guided description of the journey from a problem to a solution. It aims to teach how to solve programming problems in a methodical and thoughtful manner using the model.

  10. How to think like a programmer — lessons in problem solving

    — Steve Jobs. You probably also wondered what does it mean, exactly, to think like a programmer? And how do you do it?? Essentially, it’s all about a more effective way for problem solving. In this post, my goal is to teach you that way. By the end of it, you’ll know exactly what steps to take to be a better problem-solver. Why is this important?