Jump to content

Pseudocode


iyeager

Recommended Posts

Any developers write (draw?) pseudocode before actually hacking out code?

I guess it's the part of me that doesn't want to ignore the text based education I've had, but I've written pseudocode for everything as it helps me think everything out prior to actually writing. However, I can't seem to do it in Labview and I was hoping perhaps some of you could shed some light on how you accomplish the "roughing" out process?

-Ian

Link to comment

Hi Ian

Often I do a bit of pseudocode on a scrap piece of paper before I code something especially if it is a little nested or I want to talk it over with somebody else first. I am not sure I see your problem, after all the whole point of pseudocode is that it is NOT specific to the language you are going to code in.

for example

initialise power meter

initialise signal generator

get frequency list

for each frequency

set signal generator to frequency

get power reading from power meter

check stop button state

if STOP

STOP

plot graph

this can help you plan what you are going to do before you code it up and applies equally well for LabVIEW or C or Python

Danny

Link to comment

Depending on the complexity of the problem, I also start with pseudo-code. On the more detailed level, I keep an uml model together with the code. For state machines, at least a bubble and arrow diagram (using dia, OpenOffice/MSOffice, or simple a paper) will be my starting point. Both get pasted as pictures on the BD. The most 'primitive' form is a simple comment on the BD as Val pointed out.

I think this practice is 'good' and even is encouraged by NI for the exams (I think you get points when just commenting 'this vi will save the data' as much as coding it actually).

Those design comments also serve as documentation later.

Felix

Link to comment

Pseudocode is too close to implementation for it to be much value to me. I'll do pseudocode in text languages when I'm trying to figure out how to implement an algorithm. In Labview I'm usually working at a higher level than specific algorithms. It's fine for single threaded apps, but I haven't had much luck modelling multi-threaded applications with it. Like Felix I'll sketch out state diagrams or flow chart-ish diagrams during design to clarify my thoughts.

Link to comment

I have to agree with Daklu. I only start to use any kind of flow-charts/Pseudocode for very large programs. I usually define these when the program must be split up so that multiple developers can work simultaneously. On one project, I used the state chart module fairly effectively for a single developer.

Link to comment

Any developers write (draw?) pseudocode before actually hacking out code?

I have a composition book of descriptions and flowcharts and (pseudo-) state diagrams and UML models and K-maps and ... well, you get the idea. It helps me think through to a good implementation of the system and writing it down ensures that I'll remember (or have a good reference) to what I was thinking a month ago before something interrupted me.

Tim

Link to comment
  • 2 weeks later...
I have a composition book of descriptions and flowcharts and (pseudo-) state diagrams and UML models and K-maps and ... well, you get the idea. It helps me think through to a good implementation of the system and writing it down ensures that I'll remember (or have a good reference) to what I was thinking a month ago before something interrupted me.

Me too - I have an artist's sketch book, a 2B pencil and a good soft eraser :)

Link to comment

I do a lot of block diagram generation (using Dia or Visio) for larger/more complex programs. I find it helps me keep track of what needs to be done and what has been done. Also, I find it's a good way to communicate with others especially managers. They like the pretty colors. I fill completed elements with green.

Jason

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.