S T R U C T O R I Z E R - User Guide
Use Cases > Design with Internal Refinement

Another scenario is the algorithm design by stepwise refinement within Structorizer. You may start like in the Design for External Refinement use case but instead of immediately exporting the sketch you might switch to "Comments plus texts?" display mode and continue by filling in instructions that obviously implement the described steps:

First step in stepwise internal refinement: obvious generic instructions

Note that the placed instructions above are not language-specific but both generic and executable in Structorizer. They will be translated to all supported export languages, usually.

In some cases, expressions with built-in Structorizer functions or or built-in procedures may immediately fit. These are good for testing purposes but may not be portable to all export languages, however, so it is up to you whether you indulge to the temptation:

Second step in stepwise internal refinement: built-in stuff

Where the implementation is more complex, the silver bullet will be a routine call, i.e. a delegation of the solution to a subdiagram. (It is most easily done by filling in a procedure call or assignment with function call, then transmuting the Instruction element into a Call element (and eventually making use of the "Edit subroutine ..." menu item to create the required subroutine diagram):

Third step in stepwise internal refinement: delegation

After deriving the matching routine diagram, you should complete the routine header and fill in the routine comment specifying its task and interface:

Fourth step in stepwise internal refinement: specification of subtasks

Then you might switch back to "Switch text/comments?" mode and start over on this refinement level, i.e. by decomposing the (sub-)task into steps described with expressive comments and so on until your intended level of refinement is achieved or all parts are implemented by executable elements:

Fifth step in stepwise internal refinement: refinement of subtasks

Most important activities:

Recommended preferences: