For 2023 - we are now fully retired from IT training. We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.
Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!
I am also active in many other area and still look after a lot of web sites - you can find an index ((here)) |
From flowchart to program - code design for the newcomer
 We'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?
 Programs 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.
 Then 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 [747] The Fag Packet Design Methodology - (2006-06-06) [1345] Perl and Shell coding standards / costs of an IT project - (2007-09-11) [1513] Perl, PHP or Python? No - Perl AND PHP AND Python! - (2008-01-20) [1607] Learning to program in Perl - (2008-04-11) [1850] Daisy the Cow and a Pint of Ginger Beer - (2008-10-21) [1853] Well structured coding in Perl - (2008-10-24) [2327] Planning! - (2009-08-08) [2715] Uploading an image, document or pdf via a browser (php) - (2010-04-10) [2834] Teaching examples in Perl - third and final part - (2010-06-27) [3329] Perl from basics - (2011-06-20) [3366] Specification, Design, Implementation, Testing and Documentation - stages of a (Java) programming project - (2011-07-21) [3895] Flowchart to program - learning to program with Well House - (2012-10-14)
Some other Articles
How can I do an FTP transfer in Python?Passing optional and named parameters to python methodsBusy weekend of contrasts.Hangers, luggage and possessionsFrom flowchart to program - code design for the newcomerFlying Colours!Catching the fishes first?On this day ... one PHP script with three usesAway to train - but still around by video for Melksham meetingsStepping stones - early coding, and writing re-usable code quickly
|
4759 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, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96 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).
|
|