There are often several reasons why we might use, and or define a pre-defined process our self.
First, it is that there is some code being provided by a third party. This could be a library you found online to help you out, something that the language provides for you, or even a vendor providing code that you can use and implement into your own projects. I’ve often incorporated code from vendors and other outside resources so I don’t have to write it myself. I may not have time, the skills, to a bit of both. Therefore, we will utilize outside resources, and we need to show that.
Second, there are times that a series of steps may not seem obvious as to what they do. Therefore, we want to collect those steps into a single manageable call. This call can be easily identified by giving it a meaningful name. There are times that it might be a single step, and other times it might be 100 steps, the goal is to make it easier for people to read and understand.
The third and final reason, is that we need to perform the same series of steps more than once, and not necessarily in a row. So I might so some action, let’s say check on some sensors, then do other things, then check on sensors again. Since this isn’t part of a loop (necessarily), putting the code in a predefined process makes it easier, as I only have to define it once. It has the added bonus of if I need to update the code, I only have to update it one time at that one place.
This is a process called DRY or Don’t Repeat Yourself. You’ll see us mention it all over the place through our your different classes. A good programmer, whether it’s scripting, or full software engineering isn’t lazy… they’re “efficient”.
What is in a Predefined Process
Well, you may not know. Especially if you get this from a 3rd party such as a vendor. However, if you get this from a teammate, or it is something your wrote yourself, then you might find yourself incorporating other components we’ve already seen such a linear logic, decisions, as well as repetitions (loops).
You may even find yourself calling other predefined processes. So anything you’ve seen already, you may very well see within a predefined process.
Often these processes will be in a separate diagram, and given a name, that way we have an easy way to call them.
Incorporating a Predefined Process Into a Flowchart
A predefined process looks similar to a process block. The difference is that there are vertical lines. One on each end of the process block, that define that this is predefined somewhere else. We will then place the name of our process inside of the block.
If the block returns a value, you will usually specify a variable to capture the value. e.g. data = myprocess()
Inside the parenthesis (which are optional), you may pass data to the process that it needs to do its job.
Predefined Flowchart Processes was originally found on Access 2 Learn
One Comment
Comments are closed.