loading...

Pseudo coding

mqshaikh8 profile image Mohammed Shaikh ・2 min read

What is pseudo coding?

Pseudo coding is writing down what you are about to code in plain english. It is an important part of programming, especially for those that are starting out and for programmers that are encountering hard problems. It is also a great way to deal with imposter syndrome.

A lot of problems seem overwhelming as a whole. When I had to make a fake facebook(https://kazam-inc.herokuapp.com/) for my mod 2 project. I was very nervous and I did not know if I could do it. When I broke everything down to small pieces, Alhamdulillah, It looked very easy.

I am going to start learning javascript in my bootcamp next week, so in anticipation of that. I first pseudo coded a simple app then I coded in javascript.

//Ask user some question
//save the user answer
//add the answer as a part of a sentence
//print the formatted sentence

It is important, when pseudo coding, to make each step very simple. A good test to see if the pseudo code is simple enough is that a child 8-11 yrs old can follow the steps and do the action in real life. Another thing to keep in mind is the fact that there should be no code in the pseudo code. After pseudo coding, now we can go step by step and google and write everything.

The first step is to ask the user for input.

prompt("Please enter your name", "");

The above line will prompt the user for their name. Now, we can move on to the next step in our pseudo code. We have to save the input to a variable.

const name = prompt("Please enter your name", "");
const age = prompt("Please enter your age", "");
const language = prompt("Please enter your programming language", "");

We are prompting the user for three different input and saving the input in three seperate variable. Now we can cross off the first two steps.

const formattedString = (`Hello ! my name is ${name} and I am ${age} year(s) old, the programming language I like is ${language}`);

The above code will format the string.

console.log(formattedString);

Last but not least the above code will print it to the user.

Many times people get overwhelmed by an issue they are tackling, especially when encountering a new language. However, if the problem is broken down into small steps and written down, It can helps us understand and solve any problems that we might encounter in a very efficient manner.

Discussion

pic
Editor guide