Why did you think this approach would or would not work? Rather one asks the question: ‘How can I fix it?’ and to fix it … A helpful option when you are having programming errors is to explain to someone else what your program should be doing. Programming is the act and art of writing instructions to be executed by a machine. This will highlight the first line of code that will run. It is through debugging that we learn the most about ourselves. This can work with someone who knows nothing about programming, or even an inanimate object (see "rubber duck debugging" from the book The Pragmatic Programmer). Logic errors are usually only discovered when the application behaves in an unusual way (for example, gives a result you weren't expecting). One of the biggest challenges in learning to program is making the transition from natural language to formal language, or, learning to think like a computer. You might get partway through the explanation and have an "a ha" moment where you see where the error is. We can distill programming-related problems into two categories: With algorithms, our goal is to find the most efficient way to perform an operation, such as sorting or searching. The first and most important lesson we receive at a programming course. As you progress in your learning and encounter more complex problems you may have a wide range of viable solutions. IDEs usually can’t detect the problem. Giving directions or following a recipe are exercises in procedural thinking, “[b]ut in everyday life, procedures are lived and used, they are not necessarily reflected on.” Programming is a metacognitive activity. These instructions must follow a predetermined, formalized, set of rules. The processes of iterative development and refactoring are metacognitive. count and Count are interpreted as two separate entities. In the classic How To Solve It, George Polya outlines a methodology for problem-solving in the context of mathematics. The boundaries of the microworld are simultaneously defined by the language and by the learner’s approach to the language. Once you've found where the bug is at, you can check your syntax for errors, or see if there is a problem with your logic. This allows you to "roll-back". Though the technologies were primitive, I learned one fundamental skill that I carried throughout my career: the ability to break complicated processes down into simple steps. We don’t always get it right the first time, which is part of the iterative process and why it’s important to prioritize problem solving as a fundamental skill. Big and small. Each activity, each homework assignment, each project is a microworld. Want to level up your problem solving skills? With complex problems there is typically no one "right" or "wrong" solution; instead you find a range of ideas from less successful to more successful. If that doesn’t work, try another one. An IDE (Integrated Development Environment) like Visual Studio highlights syntax errors and provides hints as to how they might be fixed. So meta! Debugging Buddy (Rubber Duck Programming), ConsoleColor as Parameter (Console Application), Dynamic Button UWP: Navigate Array Content, PadLeft to Indent and Center Text (C# Console), Word Guessing Game: C# Console Application, Numeric Guessing Game: C# Console Application, Creative Commons Attribution 4.0 International License. Problem solving is the meta-skill. These types of errors are generally far more difficult to find and solve. Ultimately, what each of us needs is a better understanding of ourselves. Programming is Problem Solving One does not expect anything to work at the first try. Two approaches new programmers might want to try are walking through the code and experimentation. These are usually much easier to find and correct. Why do you think it does or doesn’t? In many regards, algorithms and automation are one and the same problem. When most programmers are given a programming problem in an interview, they make several key mistakes. A breakpoint is a signal that tells the debugger to temporarily suspend execution of your program at a certain point. We are thinking about thinking. Why don’t we learn procedural thinking from daily life? Bugs are “an intrinsic part of the learning process”, not something to be avoided. 3. But that is the worst way to solve problems! We can easily apply it to programming. Debugging and troubleshooting are a normal part of learning to code; it is common to encounter errors. If the choice is ‘Program or Be Programmed’, the answer is obviously the former, not because of some economic inevitability, but because the primary skill one acquires through programming is problem-solving.