C# - Why you need to be writing pseudo code
Programming is construction, doesn’t matter if you are building a suburban home, or a skyscraper, they all begin with the same thing… blueprints. Pseudo code is your blueprints for programming, and without it, you’ll find your buildings falling over.
Pseudo code is an extremely important step when working in a team or even by yourself, it makes the entire programming process 100x faster and easier. So, we are gonna learn the why, where, when, and how we need to be writing pseudo code.
Why
There is nothing worse than looking back at your code and forgetting what it does, or even forgetting what you are coding halfway through writing it. Pseudo code solves these problems by simply writing down just the logic of the code you are about to write! Doing so not only gives you a clear plan on what you are trying to program, but how. That way you can always look back at it if you get stuck to rethink your program from the beginning, without having to delete all your code and start over. It’s truly makes a difference having a point of reference when programming, and an even bigger difference when collaborators are involved. On a team, it is vital to be able to communicate clearly what you need a programmer to do, instead of unclear and vague directions by word of mouth. Being able to write, in the actual script, what you need is the easiest, and clearest way to plan and design code.
When
So when is the right time to make pseudo code? The answer is EVERY TIME. You really want to make a habit of writing pseudo code first before any coding because it will always improve your programming, even if you think you know the exact perfect way to code something that will have no errors. How many times has that happened and you were wrong? Writing pseudo code sets you up for ease, efficiency, and success when programming, so ALWAYS do it!
Where
Knowing where to put pseudo code can be matter of personal preference, but you want to make sure that it will be easy for not just you to find, but someone who has never seen your script before to find as well. Which means writing clean, consistent, organized, and efficient pseudo code. If you decide to put it above all your unfinished code, be sure to put it above for all your unfinished code, consistency will be key for understanding a code structure. Be sure to avoid paragraphs of pseudo code, the more efficient you can make it, the more efficient you will make your actual code based of it. Just make sure you are putting in the same effort you are making clean code as you are making pseudo code, it will benefit you in the long run.
How
So how do we make pseudo code anyway? Well, it’s actually super simple! All you have to do is add a couple slashes in front of your code!
You can also put a slash with an asterisk on either end of entire block of pseudo code.
This is called “commenting out” our code, doing this allows us to write whatever we want in our script without it effecting our actual program!
Pseudo code is vital in the programming workflow, I wouldn’t code without pseudo code like how a construction worker wouldn’t build a building without blueprints. So if you don’t already, I hope you find the usefulness of using pseudo code, you and your potential collaborators will thank me.