This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Bossman201's profile picture

Pseudocode and you

Started by Bossman201, 09 June 2012 - 12:57 AM
Bossman201 #1
Posted 09 June 2012 - 02:57 AM
Definition of pseudocode: Pseudocode is an informal high-level description of the operating principle of a computer program or other algorithm.
–Taken directly from wikipedia.

This basically says it's code, but simple as it's not ACTUAL code but rather words meant to make programming or understanding code easier. An example:

Program Code

local x = 0

if x == 0 then
x = 1
end

Pseudocode

if variable x equals 0 then
set x to 1

So how often do you guys use pseudocode? Do you use it at all? Give one example of when pseudocode helped you find a bug or design a part of code. I'll go first:

About a week ago, I had no knowledge of the FileSystemAPI and in-game help just did not help so I did what anyone should do, go to Ask a Pro (a rather nice place where MysticT answers all your questions, seriously, I should just start PM'ing him instead.) He gave me a few examples on how to use the fsAPI and I was on my way to making an updater for BossChat. Soon I ran into a problem, I've never used fsAPI! So I typed out what I wanted my updater to do in pseudocode before painstakingly "translating" into program code. Thus, it was completed. Took maybe an hour because I write code slow and pretty much debug every line as I write it, which probably causes more bugs than if I just wrote the entire block of code.

SpoilerFor the record, I no longer consider myself "The new guy on the block" for FileSystem, but I know I'm not an expert on it.
Orwell #2
Posted 09 June 2012 - 04:52 AM
For my studies I sometimes need to code projects of several thousands lines of code. I always start with pseudo code then and with UML too. When you're still figuring out your structure, it's a lot less painful to change some sentences that indicate a task rather than changing dozens of lines of code.
PixelToast #3
Posted 19 June 2012 - 10:33 PM
i never, i just comment then optimize
kazagistar #4
Posted 20 June 2012 - 02:41 PM
Your pseudocode is too low-level for me. If I am going to write pseudocode, it will be at a level of at least a few degrees of magnitude simpler and shorter then the code proper, or I might as well just write the code.
Wukl #5
Posted 24 June 2012 - 04:01 PM
Nope, never. At least, not when developing a program. I sometimes use pseudocode when talking to my friends but it always changes to real code while explaining.
D3matt #6
Posted 26 June 2012 - 03:53 AM
I use pseudocode only for explaining things, generally. I might put something similar in comments in incomplete sections of code, but usually it'll be something like //TODO Make this do that thing.