Coder Profile - Show off your skills, get a coder profile.
 
 
 
Introduction to Pseudo Code
Programming
When starting to develop new systems, sometimes it is good to work through it before you actually start writing it. Or maybe you run into a problem while writing a code and it's very hard to sift through it. So, the ideal solution would be to pseudo code it, or in other words, simplify writing statements in the margin.

So, comparing codes, here is what a simple script would look like that ouputs text in PHP:
Code Copy / Restore
  1. <?php
  2.           print "Hello World.";
  3. ?>
It's similar in pseudo code, just without all the detailed stuff.
Code Copy / Restore
  1. output Hello World
What would putting in conditions? Well my friend, here is your answer:
PHP:
Code Copy / Restore
  1. <?php
  2.           $a = (String) "hello";
  3.           $b = (String) "hellos";
  4.  
  5.           if($a === $b)
  6.                     print "Yep.";
  7.           else
  8.                     print "Nope.";
  9. ?>
Pseudo Code:
Code Copy / Restore
  1. A = hello
  2.           B = hellos
  3.  
  4.           IF A IS B THEN
  5.                     OUTPUT Yep.
  6.           ELSE
  7.                     OUTPUT Nope.
If you are firmiliar with Visual Basic, you can see the similarities between the two languages. Next I will show you a bit more advance code in Pseudo code.
Code Copy / Restore
  1. // Dummy code
  2.  
  3.           X = 1
  4.           Y = 10
  5.           daytime = TRUE
  6.  
  7.           OUTPUT Is it daytime?
  8.           CASE daytime OF
  9.                     TRUE : output "Yes"
  10.                     FALSE : output "No"
  11.           END CASE
  12.  
  13.           FOR XY = 1 TO 10
  14.                     output "Count" + XY
  15.                     IF X > 2 THEN
  16.                               output "X is good to go!"
  17.  
  18.                     IF Y < 20
  19.                               output "Y is good to go!"
  20.           END FOR
So, this is a basic example that does just about nothing but output text. Keep in mind, you can do quotes around output strings if you want. It really helps when you get into longer code to do this. Pseudo Code is different in a lot of different ways, and every person puts their own spin on it, since it is not an "official language". It does have guidelines though, that many sites have outline, like this one: http://users.csc.calpoly.edu/~jdalbey/SWE/pdl_std.html

Psuedo code does a lot for you when you are working on big programming projects and can be a life saver when trying to solve problems. This helps when you don't want to write actual code, just work through it faster without the necessary work.


Posted By Izzmo
Please login to rate coding articles.

Click here to register a free account with us.
Comments
Please login to post comments.
 
Izzmo     Posted 178 Days Ago
 
 
No it's pronounced: "sooh-doh"
 
mikeMarek     Posted 178 Days Ago
 
 
Very nice! Gotta love psuedo code, huh? :P

Just one question.... How is it pronounced?

I say it like this:
("swade-o code")

Is that right?

Cheers,
-Mike
Page 1 of 1
More Articles By This Author
Introduction to Pseudo Code
Recently Posted "Programming" Articles
N-Queens-Series Part I (Only the fittest survive)
Currying in JavaScript: Fun for the Whole Family!
[PHP] Create A Unique Page Hits Counter
Actionscript Events
Actionscript API
Quick Threading Tutorial - C++
C++ And Me (A Love Story)
First look at C
Introduction to Pseudo Code
Integrating your website with PHP
Recently Rated "Programming" Articles
[C++] Templates
Quick Threading Tutorial - C++
Intorduction to memoization.
N-Queens-Series Part I (Only the fittest survive)
[PHP] Create A Unique Page Hits Counter
Currying in JavaScript: Fun for the Whole Family!
Actionscript Events
First look at C
if/else, switch/case and ?/: Statements In Actionscript 2.0
Actionscript API
source codes Categories articles
Browse All
Business & E-Commerce (1)
Databases (1)
Design & Creativity (1)
Internet & Web Sites (1)
Life In General (2)
Operating Systems (3)
Other (2)
Programming (48)
Security (10)
Software Development (5)
Web Development (15)
search Search Inside
Programming
 
 
Part of the MyPingle Network
Development Blog :: Make A Donation :: Contact Me
Terms & Conditions :: Privacy Policy :: Documents
Version 1.44.00
Copyright © 2007 - 2008, Scott Thompson, All Rights Reserved