0

I need to create a flowchart for one of my algorithms and one step is calling a function (that I don't wish to explain in the flowchart) and assigning the returned value to a variable.

float x = get_random(0,1);

I am wondering if I should use rectangle or (non 90 degree) paralellogram in this case.

On wikipedia I find:

rectangles: Process. This shape is used to show that something is performed. Examples: "Add 1 to X", "replace identified part", "save changes", etc....

paralellogram: Input/Output. Involves receiving data and displaying processed data. Can only move from input to output and not vice versa. Examples: Get X from the user; display X.

While I do suspect it's not file system IO or std IO, it does fit "Involves receiving data". Which symbol should I use?

1 Answer 1

0

Fundamentally, I/O is for communicating externally, i.e. with other processes (or with humans) whether that is done via channels/pipes/sockets, or via disc files.

(Herein I use the word process in the sense of processes as programs running on an operating system. I realize that the word process, in flowcharting, is used for the notion of any computation such as using a procedure or doing an assignment statement, so there's opportunity for confusion; so, I'll use the term computation instead for that notion.)

Reading/writing to a file is an indirect method of communicating with another process, often a future process/run of the same program, yet still, potentially to multiple other programs (some not yet running).

Computation, internal to the process, is processing and doesn't qualify as I/O. Function calls represent processing rather than I/O, even though there are values returned.

Still, we have to draw a line somewhere as in many modern languages, I/O is done via function calls. So, I'd say that if the call is a black box (because it is in a library that you don't own/control), and known by language or its standard libraries to perform I/O I'd describe it as I/O. If the call is a white box that can be described by its own flowchart, I'd mark its use as processing here, and describe its I/O in its own flowchart. And otherwise, I'd describe calls as processing.

On that basis, the call to get_random appears as processing rather than I/O that is communicating with an external (past, present or future) process.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.