Problem Solving and Pseudocode
Learning Competencies
By the end of this primer, you should be familiar with and able to explain:
- Why problem-solving is an important skill to have as a developer.
- A variety of problem-solving techniques you can use today (starting with pseudocode).
Summary
As a developer, before you even start to code, you need to take the time to think of ways you might approach a problem you are trying to solve. You'll need to learn to look at problems, look at the information you have and figure out how you will get to where you want to be. You will need to learn how to take a problem, break it down into smaller parts, and build your way towards a solution.
Throughout your journey in Web Development, you will be confronted with a range of problems you need to solve. It is essential that you are equipped with the right skills to approach these problems.
Time Box
Activity | Time |
---|---|
Research | 30 minutes |
Practice | 1.5 hours |
Reflect | 30 minutes |
Problem Solving
Problem-solving is a key skill you will utilise as a developer. Sprint 1 covered some basic techniques:
- Reading error messages
- Check
foundations-help-desk
Discord channel - Ask a search engine (Google, DuckDuckGo, Brave Search)
- Asking your peers for help
- Asking coaches for help.
Now you know a bit of JavaScript it's time to introduce more techniques you can use:
- Pseudocode
- The rubber ducky method
- Use
console.log()
- Trying something
- Improving your process with reflection.
Pseudocode
Many of the techniques mentioned above can be applied to all sorts of (non-technical) problems, but pseudocode is coding specific and incredibly useful to help you think through your code.
Pseudocode is not actual code but rather comments that tell you how the code will eventually look. It is informal, plainly written steps that form your code's rough draft or outline.
Pseudocoding involves taking a little time before you get into writing the code to break down your plan into small steps. This means you don't have to worry about making the whole thing work at once but can instead focus on just coding one step at a time. This can be useful for helping you break down a complicated problem but can also be used if one developer needs to leave instructions for another to complete the code later.
Because pseudocode is the steps rather than the code itself, you don't need to include the fine details of what needs to happen. It's a bit like recalling a recipe. You know you don't need all the details immediately. You just need to know the necessary ingredients and can work the rest out when you get to it. For example, to make brownies:
// put butter, sugar, and cocoa in a bowl and then microwave// add eggs and vanilla and mix through// add flour and mix until thick// bake!
You can see that we didn't include any details, just general steps.
Once you have written pseudocode, you may find you need to change the order of steps, or you might discover that you have forgotten some and need to add them in - and that's okay! This is only a first draft, and it will inevitably change as you come to write the code itself.
Research
From the list of problem-solving techniques (above), if there are any techniques you have never heard of before - take 30 minutes to research these. Practice using as many of them as possible when completing the Kata challenges. Keep notes as you'll describe your problem-solving adventures in your technical blog this sprint.