I once was asked to make a game like Hangman that I realized was “Evil Hangman” only after I read through the instructions (it was a trick! Sometimes I’ll even try explaining the problem to a friend and see if her understanding of my explanation matches the problem I am tasked with.
You don’t want to find out halfway through that you misunderstood the problem. The better you understand the problem, the easier it will be to solve it.
You understand the problem, the logic, basics of the syntax, etc.
If you see someone else’s code or have someone to guide you, you can follow along.
See if you can reduce any steps or if you are repeating any steps.
Even after you’ve worked out general steps, writing out pseudocode that you can translate into code will help with defining the structure of your code and make coding a lot easier. You can do this either on paper or as comments in your code editor.It’s easy to start reading the first few lines in a problem and assume the rest of it because it’s similar to something you’ve seen in the past.If you are making even a popular game like Hangman, be sure to read through any rules even if you’ve played it before.Refer back to the problem to make sure you are on track.When you have your pseudocode ready, translate each line into real code in the language you are working on. If you wrote it out on paper, type this up as comments in your code editor. Then I call the function and give it some sample sets of data we used earlier.By doing this, I catch any issues before I get too far.Below is an example of what values I would check when I am first starting out. Sometimes new developers will get hung up with the syntax that it becomes difficult to move forward.I use them to see if my code returns the results I want.You can also write tests to check if the actual output is equal to the expected output. This helps me check if the values and code are behaving as expected before I move on.If you’re starting out and find blank screens to be daunting or distracting, I recommend doing it on paper. For our problem, there are many different ways to do this.Pseudocode generally does not actually have specific rules in particular but sometimes, I might end up including some syntax from a language just because I am familiar enough with an aspect of the programming language. For example, you can use Either way is fine as long as you are writing it out line-by-line and understand the logic on each line.