Training, Open Source Computer Languages

This is page http://www.wellho.net/mouth/3461_Fro ... comer.html

Our email: info@wellho.net • Phone: 01144 1225 708225

From flowchart to program - code design for the newcomer

First do a flowchartWe're all used to seeing little flow chart diagrams on instrtuction sheets and in books - telling us things like whether we should call the doctor for our sick child, or let him/her sweat it out. So - for newcomers to programming - flowcharts are a natural way of drawing out what the program needs to do. But how to translate such a diagram into a program?


The straighten it outPrograms are written as a series of instructions within a file - line by line, and the two lins coming down the page as shown in my first diagram isn't possible - so the first stage is to redraw the flowchart into a single line, as I've done here on the right. The lines are all joining the same boxes, but those boxes have been moved above each other and there are some jumps around.


Add coding constructsThen you can start to see the structure of your code. The decision boxes are going to be "if" statements, with an "else" before the second of the sets of boxes that we stacked in the second stage. And there you have your first program structure to hand.


Progressing on further ... if you have one of the vertical stacks jumping BACK to the decision box, you'll be looking at a loop (with a world like "while" replacing "if"), and if each of the boxes performs a substantial task, then you'll want to write the code for it really simply as a call to a function which you'll write - programming at a macro level, and you can then separately flowchart and "solve" each block in turn. You're headed - without even realising it - for a structured programming technique ...
(written 2011-09-29)

 
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articles
Q904 - Object Orientation and General technical topics - Analysing a Programming Task
  [3895] Flowchart to program - learning to program with Well House - (2012-10-14)
  [3366] Specification, Design, Implementation, Testing and Documentation - stages of a (Java) programming project - (2011-07-21)
  [3329] Perl from basics - (2011-06-20)
  [2834] Teaching examples in Perl - third and final part - (2010-06-27)
  [2715] Uploading an image, document or pdf via a browser (php) - (2010-04-10)
  [2327] Planning! - (2009-08-08)
  [1853] Well structured coding in Perl - (2008-10-24)
  [1850] Daisy the Cow and a Pint of Ginger Beer - (2008-10-21)
  [1607] Learning to program in Perl - (2008-04-11)
  [1513] Perl, PHP or Python? No - Perl AND PHP AND Python! - (2008-01-20)
  [1345] Perl and Shell coding standards / costs of an IT project - (2007-09-11)
  [747] The Fag Packet Design Methodology - (2006-06-06)


Back to
Flying Colours!
Previous and next
or
Horse's mouth home
Forward to
Hangers, luggage and possessions
Some other Articles
How can I do an FTP transfer in Python?
Passing optional and named parameters to python methods
Busy weekend of contrasts.
Hangers, luggage and possessions
From flowchart to program - code design for the newcomer
Flying Colours!
Catching the fishes first?
On this day ... one PHP script with three uses
Away to train - but still around by video for Melksham meetings
Stepping stones - early coding, and writing re-usable code quickly
4254 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86 at 50 posts per page


This is a page archived from The Horse's Mouth at http://www.wellho.net/horse/ - the diary and writings of Graham Ellis. Every attempt was made to provide current information at the time the page was written, but things do move forward in our business - new software releases, price changes, new techniques. Please check back via our main site for current courses, prices, versions, etc - any mention of a price in "The Horse's Mouth" cannot be taken as an offer to supply at that price.

Link to Ezine home page (for reading).
Link to Blogging home page (to add comments).

© WELL HOUSE CONSULTANTS LTD., 2014: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 899360 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.net/mouth/3461_Fro ... comer.html • PAGE BUILT: Sun Mar 30 15:20:58 2014 • BUILD SYSTEM: WomanWithCat