Most failed programs fail before a single line of code is written: the programmer solved the wrong problem, or started typing before understanding it. This section gives you a set of techniques for getting started on any problem, and the standard steps for turning a solution into a working program.
Understand the problem before solving it
The first and most important step is problem definition: working out exactly what must be done, before thinking about how to do it.
A good test: can you state the expected output for one or two sample inputs? If not, the problem is not yet defined.
Techniques for getting started
Even a well-defined problem can feel hard to start. The following techniques are rules of thumb, also called heuristics: methods that often help, but are not guaranteed to work.
Technique
What it means
Example in software
Don’t start with details
Work out the overall solution first; choose details later
Sketch the screens before choosing a library
Use a specific example
Solve one concrete case by hand, then generalise
Work out 4! by hand before writing a program for n!
Look for similarities
Reuse the approach from a problem you have already solved
“Searching invoices is like searching customers”
Work backwards
Start from the goal and ask what is needed just before it
To print a total, you need a sum; for a sum, you need the list of amounts
Reflect afterwards
Review how you solved it, so the method can be reused
Note what worked in a short design document
Using the computer as a problem-solving tool
A computer cannot understand a problem; it can only follow instructions. So the solution has to be developed in stages, from a human-readable plan to a running program. This process is called program development.
1Develop an algorithm and a flowchart
→
2Write the program in a language such as C
→
3Enter the program using an editor
→
4Test and debug the program
→
5Run it with real data and get results
Program development steps
Skipping step 1 is the most common beginner mistake. Fixing a plan on paper takes minutes; fixing the same mistake inside a large program can take hours.
Key takeaways
Problem definition comes first: state inputs, outputs and conditions precisely.
Heuristics such as specific examples and working backwards help you get started.
Program development has five steps, starting with an algorithm and flowchart.
Testing on small hand-worked examples catches mistakes early.
Practice questions
Answer on paper first, then check. The explanation matters more than the letter you chose.
Question 6 · short answer
Define the problem “find the highest temperature recorded in a week” by stating its input, output and any condition or edge case.
Show worked answer
Input: the seven daily temperature readings. Output: one value, the highest of the seven readings. Conditions: readings can be negative, so the solution must not assume that 0 is a safe starting value for the highest temperature; a safer start is the first reading. Edge case: if some days have no reading, the problem must say whether to ignore them or report an error. A quick check with sample data, such as 31, 29, 35, 33, 30, 28, 34, gives an expected output of 35.
MCA Online notes are made for reading on screen. Open https://mcastudy.online/mcs-201/programming-fundamentals/problem-solving-with-a-computer/ to read this page.