Quick Index
Readers of Algorithms


These assumptions are key to driving our approach to writing algorithms:


Advantages


A few key advantages:


Note that the list above tells us that algorithms have the "best of both worlds":


Steps vs Paragraph


Not This: Paragraph
We do not want to use a paragraph, story-like style. It may read okay, but it's hard for our algorithm client to know where they are.
Open a file browser and then navigate to root the directory. Then in in the file browser, right click and choose action "Create Directory" an when you receive a prompt enter name "foo" and finally hit the "Enter" key.
This: Step-by-Step
We want to go with short, simple steps.

Remember we are assuming the algorithm "user" knows nothing about the task.

The short, simple steps may be used like a "check off" list.

Numbering is optional but can be helpful -- algorithmist's choice (i.e. your choice)


Simple and Short


We want each of our steps to be simple and short.

This helps our human reader, but also remember we will be translating our algos to program code which we know is simple and short (e.g. "for", "if", "else", "while", "object.go()").

More steps is better than less. If we have "too few steps", than the reader will fail to complete the task. And "too many steps" is okay for a starting point -- the task should be successful with the only possibly improvement (later, lower priority) is tuning and optimizing.

Explicit vs Implicit


These are key words in algorithm work:


We want our algorithm steps to be explicit.

Implicit Example
The last step in this algo implicitly assumes that our user knows all the steps required to create a directory.

However, recall that we have assumed that our user is not at all familiar with the given task.
Explicit Example
Here we expand out the implicit step in the previous algorithm so we have the necessary explicit steps for our reader, so they can complete the task.


Communicating Logic to Others


Often in the programming field we will work with non-programmers (e.g. business team members, engineers, test team members, ...).

Algorithms can provide a good means of communicating logical ideas to non-programmers. We cannot expect them to understand a given programming languages specific syntax (that is intended for machines) but in contrast our algorithms are intended for human readers.