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  ::  Remove Scroll Bars
  1. <?php
  2.        print "Hello World.";
  3. ?>
It's similar in pseudo code, just without all the detailed stuff.
CODE: Copy / Restore  ::  Remove Scroll Bars
  1.        output Hello World
What would putting in conditions? Well my friend, here is your answer:
PHP:
CODE: Copy / Restore  ::  Remove Scroll Bars
  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  ::  Remove Scroll Bars
  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  ::  Remove Scroll Bars
  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 1.91 Year Ago
 
 
No it's pronounced: "sooh-doh"
 
mikeMarek     Posted 1.91 Year 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
thetrojan01's brainfuck tutorial - from the beginning to the interpreter.
My Experiences So Far with Languages
Selecting Your First Programming Language
[PHP] - Lets kill the complex IF
Basic PortScanner in VB6.0
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
Recently Rated "Programming" Articles
[PHP] - Lets kill the complex IF
thetrojan01's brainfuck tutorial - from the beginning to the interpreter.
Actionscript API
Actionscript Events
My Experiences So Far with Languages
Selecting Your First Programming Language
Vectors in C++
[C++] Templates
Quick Threading Tutorial - C++
Intorduction to memoization.
source codes Categories articles
Browse All
Business & E-Commerce (1)
Databases (1)
Design & Creativity (2)
Hardware (1)
Internet & Web Sites (3)
Life In General (2)
Networking (1)
Operating Systems (5)
Other (2)
Programming (47)
Security (10)
Software Development (5)
Web Development (15)
search Search Inside
Programming
 
 
Latest News About Coder Profile
Coder Profile Poll
Why do you get bored with programming?

Not enough time to do something productive
I run out of ideas
Too hard to show people my creations
Everything i do has too many errors, and it's too hard
I don't get bored!!!


please login to cast your vote
and see the results of this poll
Latest Coder Profile Changes
Coder Profile was last updated
1.29 Year Ago
Official Blog :: Make A Donation :: Credits :: Contact Me
Terms & Conditions :: Privacy Policy :: Documents :: Wallpapers
Version 1.46.00
Copyright © 2007 - 2010, Scott Thompson, All Rights Reserved