Generic Code
Generic code, otherwise known as Pseudo-code, is simply writing out the logic of your program in plain text. This can be as basic as:
Start Program
Get Input From User
Perform Calculations
Display Results
End Program
or, for those wanting something a bit more complicated:
Begin Program
' Declare variables to hold user data.
string user_name
integer user_age
' Get user's name and age.
Print Please enter your name:
, Store to user_name
Print Please enter you age:
, Store to user_age
' Echo input back out to screen.
Print Thank you,
, user_name, !
Print The age you entered was:
, user_age, .
Print
' Echo message out to user before terminating program.
Print Press any key to end program...
End Program .
Well, that's neat, but why would I do that?
Pseudo-code is normally used in conjunction with UML during the planning stage of your program. Note the implied suggestion here: plan before you code! While it is possible to simply sit down and start hacking out code in your favorite editor, it is a bad habit to get into.
In my personal experience, lack of planning always led me to redundant code and/or bad logic. The time I wasted going back and forth between errors could have been dramatically lessened if I had simply spent a little more time planning out what I wanted my program to accomplish.
This seems like a lot of work...
At first, it probably will be. After all, if you knew what you were doing, why would you be in class? Silly...
What I believe you will eventually discover is that the process of diagramming and pseudo-coding becomes second nature. You will be able to put together a mock-up of your program quickly, present it for approval, and be coding in short order. And THAT, my friends, makes potential employers happy... :)

Subscribe
Categories
Navigate
Random Quote
There are no comments for this entry.