Home Accessibility Courses Twitter The Mouth Facebook Resources Site Map About Us Contact
 
Python and Tcl - public course schedule [here]
Private courses on your site - see [here]
Please ask about maintenance training for Perl, PHP, Lua, etc
 
Where do I start when writing a program?

Q: Where do I start when writing a program?

A: Start off by thinking about what you want to achieve, and what inputs you have available to you. In other words, look at what the customer provided and what the customer wants to get (yes, you may be your own customer!). If it's too much to think through in one step, split it into a series of stories, and write each stage in turn, frequently refactoring as you go.

As well as the inputs and outputs, think about the major structures you'll use internally within your program - your collection variables (arrays, lists, hashes, dictionaries, tuples ... whatever is available in the language of your choice), and think what is likely to be common code which will allow you to (re)use you own code later, or to call in someone else's stuff from day 1.

When you've given this some thought and you're moving to a coding stage, write your comments first - they will in essence form a textual flowchart, help you identify pitfalls early, and avoid you coding up too many blind alleys.

On today's Perl Course, I went through these principles, in order to start answering the question "what operating system(s) do people who use my website run?" .... you can see my initial (all comments!) design here. I then went on to add some code - a first test or - 'spike' solution - see here. The results of running that program on a recent log file from our own site:

Dorothy-2:perl grahamellis$ perl whatos
There are 80520 good records and 34 mucked up ones
unknown ... 49716
Googlebot ... 9574
Windows NT 5\.1 ... 21230
Dorothy-2:perl grahamellis$


which is very short .. but an excellent demonstration of principle.

Although I am talking about Perl in this note, you'll find that what I've suggested is equally suitable for use in Python, PHP, Ruby, Lua ... indeed, in all the other languages we teach. If what I've written is of interest to you, have a look at our "learning to program in ...." courses, where an extra day on the front of the main course helps newcomers to programming. But if it's stuff you're happy with, start on our ".... programming" courses which assume prior knowledge of things like this
(written 2009-06-11, updated 2009-06-12)

 
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articles
G999 - Well House Consultants - Keynote
  [4588] What teach you in a week stays with you for a decade - (2015-11-29)
  [3164] Brown - or Mrs Sally Brown, accountant from Whitstable? - (2011-02-10)
  [2537] Faster network, but not faster browsing until ... - (2009-12-14)
  [2483] Clustering on Tomcat - (2009-10-30)
  [2384] Looking ahead to the Autumn season of training and accommodation - (2009-08-28)
  [2326] Learn a new programming language this summer. - (2009-08-06)
  [2216] Past Delegate Offer - Summer Holiday / Weekend Break - (2009-06-03)
  [2144] Looking for a career change - Physician to Web Site Designer - (2009-04-28)
  [1975] Well House Manor Hotel - on plan for 2009 business guests - (2009-01-03)
  [1955] How to avoid duplicating web page maintainance - (2008-12-20)
  [1929] 2009 - Hotel, Meeting, Training Course prices - (2008-12-07)
  [1859] Wiltshire at dawn - the tourist trail - (2008-10-29)
  [1857] November and December Public Course Schedule - (2008-10-27)
  [1773] The Longest Possible Day - (2008-08-26)
  [1748] Hotel room prices - Melksham, Wiltshire - (2008-08-11)
  [1676] A warm welcome for visitors from the USA - (2008-06-14)
  [1615] PHP training courses every month - (2008-04-18)
  [1555] Advanced Python, Perl, PHP and Tcl training courses / classes - (2008-02-25)
  [1492] Well House Consultants Training and Hotel - 2008 news - (2008-01-01)
  [1481] The Christmas Letter - (2007-12-22)
  [1414] What we teach - expained for the non-technical - (2007-10-28)
  [1319] Customer feedback - lifeblood of a business - (2007-08-25)
  [1317] 2008 course schedule - Perl, Python, PHP, Linux, Java Deployment, Ruby and more - (2007-08-23)
  [1245] Ensuring that our tutor answers YOUR questions - (2007-06-25)
  [1161] A contrast in room rates and facilities - (2007-04-25)
  [1079] Wilts and Berks - two conference / training rooms in Melksham - (2007-02-14)
  [929] Presenting Melksham - for a weekend away in Wiltshire - (2006-11-17)
  [898] Courses at Well House Manor - (2006-10-19)
  [890] Open - (2006-10-09)
  [845] Course scheduling and Geekmas - are they traditions yet? - (2006-08-26)
  [774] Bed and Breakfast, or Hotel? - (2006-06-22)
  [695] In the hospitality business - (2006-04-23)
  [626] Not just a pretty face to answer the phone. - (2006-02-26)
  [549] 2005 - Come as a student, leave as a friend - (2005-12-31)
  [464] Technical Loneliness - (2005-10-14)
  [452] Is enough enough? - (2005-09-27)
  [428] Swindon - Chippenham - Melksham - Trowbridge - Westbury train service - (2005-08-29)
  [419] Most popular courses - (2005-08-19)
  [360] Spring turns to Summer - (2005-06-26)
  [295] Pricing strategy - simple and fair - (2005-04-29)
  [225] 10 years and counting - (2005-02-23)
  [164] Well House Consultants - review of 2004 - (2004-12-31)

P050 - Perl - General
  [4301] Perl - still a very effective language indeed for extracting and reporting - (2014-09-20)
  [4296] Polishing the Perl courses - updated training - (2014-09-17)
  [3911] How well do you know Perl and / or Python? - (2012-11-04)
  [3902] Shell - Grep - Sed - Awk - Perl - Python - which to use when? - (2012-10-22)
  [3823] Know Python or PHP? Want to learn Perl too? - (2012-07-31)
  [3407] Perl - a quick reminder and revision. Test yourself! - (2011-08-26)
  [3332] DNA to Amino Acid - a sample Perl script - (2011-06-24)
  [3322] How much has Perl (and other languages) changed? - (2011-06-10)
  [3093] How many toilet rolls - hotel inventory and useage - (2010-12-18)
  [2971] Should the public sector compete with businesses? and other deep questions - (2010-09-26)
  [2825] Perl course - is it tailored to Linux, or Microsoft Windows? - (2010-06-25)
  [2783] The Perl Survey - (2010-05-27)
  [2736] Perl Course FAQ - (2010-04-23)
  [2504] Learning to program in ... - (2009-11-15)
  [2374] Lead characters on Perl variable names - (2009-08-24)
  [2242] So what is this thing called Perl that I keep harping on about? - (2009-06-15)
  [1897] Keeping on an even keel - (2008-11-21)
  [1750] Glorious (?) 12th August - what a Pe(a)rl! - (2008-08-12)
  [743] How to debug a Perl program - (2006-06-04)
  [400] New in the shops - (2005-08-01)
  [116] The next generation of programmer - (2004-11-13)

Q101 - Object Orientation and General technical topics - Programming Principles
  [4645] What are callbacks? Why use them? An example in Python - (2016-02-11)
  [4632] Remember to ask the question before you listen for the answer - (2016-01-26)
  [4611] Hungarian, Camel, Snake and Kebab - variable naming conventions - (2016-01-03)
  [4325] Learning to program - what are algorithms and design patterns? - (2014-11-22)
  [4206] Writing the perfect program in Tcl? - (2013-11-13)
  [4153] Rooms available tonight - how to code an algorithm from first principles - (2013-08-19)
  [4118] We not only teach PHP and Python - we teach good PHP and Python Practice! - (2013-06-18)
  [4090] Test Driven Development in Python - Customer Comes First - (2013-05-16)
  [4061] Seamless, integrated IT - we have a long way to go! - (2013-04-11)
  [4003] Web and console - same principle, same code - Ruby example - (2013-02-14)
  [3954] Lesson 1 in programing - write clean, reuseable and maintainable tidy code - (2012-12-16)
  [3928] Storing your intermediate data - what format should you you choose? - (2012-11-20)
  [3878] From Structured to Object Oriented Programming. - (2012-10-02)
  [3673] Object oriented or structured - a comparison in Python. Also writing clean regular expressions - (2012-03-26)
  [3551] Some terms used in programming (Biased towards Python) - (2011-12-12)
  [3548] Dark mornings, dog update, and Python and Lua courses before Christmas - (2011-12-10)
  [3542] What order are operations performed in, in a Perl expression? - (2011-12-07)
  [3456] Stepping stones - early coding, and writing re-usable code quickly - (2011-09-24)
  [3026] Coding efficiency - do not repeat yourself! - (2010-11-02)
  [2964] An introduction to file handling in programs - buffering, standard in and out, and file handles - (2010-09-21)
  [2915] Looking up a value by key - associative arrays / Hashes / Dictionaries - (2010-08-11)
  [2878] Program for reliability and efficiency - do not duplicate, but rather share and re-use - (2010-07-19)
  [2769] Easy - but for whom? - (2010-05-18)
  [2737] Improving your function calls (APIs) - General and PHP - (2010-04-24)
  [2586] And and Or illustrated by locks - (2010-01-17)
  [2550] Do not copy and paste code - there are much better ways - (2009-12-26)
  [2510] The music of the stock market - (2009-11-22)
  [2415] Variable names like i and j - why? - (2009-09-22)
  [2327] Planning! - (2009-08-08)
  [2310] Learning to write high quality code in Lua - (2009-07-30)
  [2022] Pre and post increment - the ++ operator - (2009-02-03)
  [2001] I have not programmed before, and need to learn - (2009-01-19)


Back to
Learning PHP, Ruby, Lua and Python - upcoming courses
Previous and next
or
Horse's mouth home
Forward to
Do not re-invent the wheel - use a Perl module
Some other Articles
Why sendmail one way, and pop3 the other?
What is CGI.pm / A dozen new examples
Running a piece of code is like drinking a pint of beer
Do not re-invent the wheel - use a Perl module
Where do I start when writing a program?
Learning PHP, Ruby, Lua and Python - upcoming courses
Revision / Summary of lists - Perl
How important is a front page ranking on a search engine?
Trowbridge - a missed opportunity? Melksham - into the breach?
CSS Style Diagrams - working out where attributes come from
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).

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2019: 404 The Spa • Melksham, Wiltshire • United Kingdom • SN12 6QL
PH: 01225 708225 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.net/mouth/2228_Whe ... gram-.html • PAGE BUILT: Sat May 27 16:49:10 2017 • BUILD SYSTEM: WomanWithCat