How “Planning Ahead” has helped me become a better programmer

If you want to make programming easier, develop a plan in advance.Pseudocode Programming Process (PPP), which I had never used before, was something I recently learned and found to be quite simple to understand. PPP enables you to “Plan Ahead” by reduc…


This content originally appeared on Level Up Coding - Medium and was authored by Kiran Suvarna

If you want to make programming easier, develop a plan in advance.

Pseudocode Programming Process (PPP), which I had never used before, was something I recently learned and found to be quite simple to understand. PPP enables you to “Plan Ahead” by reducing the amount of thinking that must be done when coding. I discovered that planning a project out in advance makes coding much simpler and results in far better code. By making plans in advance, you become proactive and can foresee many potential obstacles in your path.

Before beginning to code, I believe it’s always preferable to have a birds-eye view.

I used to believe that everything is in my head, thus I always found it tempting to go right in and start coding. But that wasn’t a good idea until I learned about PPP.

PPP is described by Steve McConnell in Code Complete as

The term “pseudocode” refers to an informal, English-like notation for describing how an algorithm, a routine, a class, or a program will work, the Pseudocode Programming Process defines a specific approach to using pseudocode to streamline the creation of code within routines.

How do you put it to use?

You’re right, there is no standard pseudocode syntax, there are a few guidelines for its efficient use.

  1. Use simple language for your statements.
  2. The pseudocode should be language-independent; do not employ programmatic syntax; instead, keep it simple.
  3. If necessary, capitalize the key commands like IF and ELSE.
  4. Be sure to indent properly.
  5. Be sure to include a detailed header comment.
  6. Finally, place the code immediately after each pseudocode statement.

Let’s look at a straightforward example.

This routine returns a success or an error message depending on an Email address that is given by the caller routine. If the email is valid, it returns a success message; otherwise, it returns an error message.
# Derive an email regular expression to test the Email address
# IF the email does not adhere to the regex rule. 
# Keep a record of the email and error message by logging
# Return the message "Invalid Email"
# ELSE, if the above condition is false the email address matches the regex, determine to see if the database already contains a similar email address. 
# IF it already does, 
# Keep a record of the email and error message by logging
# Return "Email already exists!" error message
# IF the above criteria are not met, 
# Log the email and success message to keep a record
# Return the success message to the caller

Final Thoughts

PPP assists you to break down a large problem into manageable pieces. It’s an iterative process, you could able to review the pseudocode statements and make changes easily because it’s easier to change the statements than the code itself.

It’s easier to change a line in the blueprint than rip out the wall

You can turn pseudocode statements into code comments, it will benefit code reviewers as well. It makes developer life easy when debugging an issue in the production at 3 A.M.

Inspired by

Complete Code 2 by Steve McConnell


How “Planning Ahead” has helped me become a better programmer was originally published in Level Up Coding on Medium, where people are continuing the conversation by highlighting and responding to this story.


This content originally appeared on Level Up Coding - Medium and was authored by Kiran Suvarna


Print Share Comment Cite Upload Translate Updates
APA

Kiran Suvarna | Sciencx (2022-10-06T14:50:32+00:00) How “Planning Ahead” has helped me become a better programmer. Retrieved from https://www.scien.cx/2022/10/06/how-planning-ahead-has-helped-me-become-a-better-programmer/

MLA
" » How “Planning Ahead” has helped me become a better programmer." Kiran Suvarna | Sciencx - Thursday October 6, 2022, https://www.scien.cx/2022/10/06/how-planning-ahead-has-helped-me-become-a-better-programmer/
HARVARD
Kiran Suvarna | Sciencx Thursday October 6, 2022 » How “Planning Ahead” has helped me become a better programmer., viewed ,<https://www.scien.cx/2022/10/06/how-planning-ahead-has-helped-me-become-a-better-programmer/>
VANCOUVER
Kiran Suvarna | Sciencx - » How “Planning Ahead” has helped me become a better programmer. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/10/06/how-planning-ahead-has-helped-me-become-a-better-programmer/
CHICAGO
" » How “Planning Ahead” has helped me become a better programmer." Kiran Suvarna | Sciencx - Accessed . https://www.scien.cx/2022/10/06/how-planning-ahead-has-helped-me-become-a-better-programmer/
IEEE
" » How “Planning Ahead” has helped me become a better programmer." Kiran Suvarna | Sciencx [Online]. Available: https://www.scien.cx/2022/10/06/how-planning-ahead-has-helped-me-become-a-better-programmer/. [Accessed: ]
rf:citation
» How “Planning Ahead” has helped me become a better programmer | Kiran Suvarna | Sciencx | https://www.scien.cx/2022/10/06/how-planning-ahead-has-helped-me-become-a-better-programmer/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.