Journal Articles

CVu Journal Vol 1, #3 - Feb 1988
Browse in : All > Journals > CVu > 013 (15)

Note: when you create a new publication type, the articles module will automatically use the templates user-display-[publicationtype].xt and user-summary-[publicationtype].xt. If those templates do not exist when you try to preview or display a new article, you'll get this warning :-) Please place your own templates in themes/yourtheme/modules/articles . The templates will get the extension .xt there.

Title: Structure, Part 3

Author: Martin Moene

Date: 28 June 2010 08:52:00 +01:00 or Mon, 28 June 2010 08:52:00 +01:00

Summary: 

Body: 

In this series we have been considering how to achieve structure in our programs and have identified some key issues:

To produce a structured program we must:-

Understand the problem.

Now, we have said nothing so far about how you are solving the problem, the algorithm or methods you are using, but concentrated on how you go about laying out the chosen method.

So perhaps it is worth stating that, before you begin any sort of work, you must fully understand WHAT you are trying to do and HOW you are going to do it. The best structure in the world will do nothing if the algorithm is wrong. However, if the algorithm is wrong, if you've structured your program well, finding and fixing the problem will be a lot less painful.

Thinking back to our original problem. If we realise late on that our algorithm for opening the lid of the kettle is wrong, then we only have to change the detail INSIDE that procedure. Where it's called from, the body of the program, remains the same. Structure has helped us. We don't need to go through 200 lines of code looking for affected lines.

This early stage of thinking of the problem and deciding on the algorithm and then laying out the broad steps is crucial. It's the most difficult part of the whole process. Get things wrong at this point and you make work for yourself later on. I'm going to say that again because it's important. Get things wrong at the initial algorithm and main body stage and you make work for yourself later on. So take the time to think it through.

Here are some tips to make this easier.

For trivial tasks these steps are easy. The more complicated the task, the more essential it becomes to do each correctly.

Having done this on the top level then really the same procedure can be repeated for lower and lower levels.

The story so far..

Structuring then makes use of several key points:

Next time we'll consider how the choice of data type can help us in structuring.

Notes: 

More fields may be available via dynamicdata ..