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
 
Learning to program - comments, documentation and test code

Updates material from our courses for newcomers to programming ... we're very happy to help newcomers learn about the basic principles of programming, running an extra day for a very small group on the front of our regular courses for delegates who have programmed before, but in different languages.




In this final session of "learning to program in xxx", I'm going to stress the importance of some of the more mundane elements, but practical requirements of programming.

1. You should comment your code so that the PROGRAMMER who follows behind you (or yourself in a year or two) can understand what has been done, and pick it up, fix issues, and update it. You should also include things like a version number so that you're not left puzzling which version is which, nor fixing an old version

2. You should document your code so that the USER who makes use of it knows how to do so. That user could be someone visiting your web page, running your application, or another programmer calling in elements of your code as part of his program; we've seen the use of library routines during the day so far ... and YOU may be providing such library routines.

3. You should provide SAMPLE / TEST code so that you can test the continued operatation of the application / routines in the future, and ensure that they're still running right when you transfer a copy to a computer running a different operating system.

Comments and documentation are not, entirely, extras that you have to provide in addition to the running code. By a good choice of variable names, and by insetting the code sensibly and spacing it out, you're doing much of than work within the code. And your test code not only helps you get the code right in the first place, but also provides examples of how it should be used for others who'll be making use of your code.
(written 2014-11-22)

 
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articles
Q100 - Object Orientation and General technical topics - Learning to Progam
  [4575] Learning not just what a program does, but how to design it in the first place. - (2015-11-06)
  [4337] Learning to program sample program - past its prime, but still useful - (2014-12-02)
  [4325] Learning to program - what are algorithms and design patterns? - (2014-11-22)
  [4324] Learning to program - variables and constants - (2014-11-22)
  [4323] Learning to program - Loop statements such as while - (2014-11-22)
  [4322] Learning to Program - the conditional statement (if) - (2014-11-21)
  [4318] Learning to Program - how we start to teach you at Well House Consultants - (2014-11-16)
  [4008] Reading and checking user inputs - first lessons - Ruby - (2013-02-17)
  [3895] Flowchart to program - learning to program with Well House - (2012-10-14)
  [3551] Some terms used in programming (Biased towards Python) - (2011-12-12)
  [3120] Learning to write good programs in C and C++ - separating out repeated code - (2011-01-04)
  [2973] Learning to program - where to start if you have never programmed before - (2010-09-28)
  [2898] Programming Standards from the start! - (2010-08-02)
  [2505] I almost put the bins out this morning - (2009-11-16)
  [2504] Learning to program in ... - (2009-11-15)
  [2326] Learn a new programming language this summer. - (2009-08-06)
  [2294] Can you learn to program in 4 days? - (2009-07-16)
  [2286] New to programming? It is natural (but needless) for you to be nervous - (2009-07-14)
  [2092] Tracking difficult bugs, the programmer / customer relationship - (2009-03-20)
  [2048] Learning to program in PHP, Python, Java or Lua ... - (2009-02-19)
  [2001] I have not programmed before, and need to learn - (2009-01-19)
  [1985] Learning to program as a part of your job - (2009-01-10)
  [1963] Best source to learn Java (or Perl or PHP or Python) - (2008-12-28)
  [1605] Learning and understanding scripting programming techniques - (2008-04-08)
  [116] The next generation of programmer - (2004-11-13)

Q456 - Object Orientation and General technical topics - Test Driven Development and Behaviour Driven Development
  [4652] Testing new algorithms in PHP - (2016-02-20)
  [4634] Regression testing - via a very short C testing framework - (2016-01-29)
  [4542] The principle of mocking - and the Python Mock package - (2015-10-17)
  [4457] Test framework for TCL - Tcltest - some examples - (2015-03-11)
  [4387] Regression Testing my website - Cucumber and Watir - (2015-01-07)
  [4380] Behaviour Driven Development / Ruby and Cucumber - (2015-01-02)
  [4374] Test driven development, and class design, from first principles (using C++) - (2014-12-30)
  [4346] A behaviour driven example of writing a Java program - (2014-12-09)
  [4336] Test Driven Development - a first example of principle in C - (2014-12-01)

P711 - An Introduction to Standards in Perl
  [3398] Perl - making best use of the flexibility, but also using good coding standards - (2011-08-19)
  [2875] A long day in Melksham ... - (2010-07-17)
  [2688] Security considerations in programming - what do we teach? - (2010-03-22)
  [2375] Designing your data structures for a robust Perl application - (2009-08-25)
  [1863] About dieing and exiting in Perl - (2008-11-01)
  [1853] Well structured coding in Perl - (2008-10-24)
  [1728] A short Perl example - (2008-07-30)
  [1555] Advanced Python, Perl, PHP and Tcl training courses / classes - (2008-02-25)
  [1395] Dont just convert to Perl - re-engineer! - (2007-10-18)
  [1345] Perl and Shell coding standards / costs of an IT project - (2007-09-11)
  [1221] Bathtubs and pecking birds - (2007-06-07)
  [1047] Maintainable code - some positive advice - (2007-01-21)
  [965] KISS - one action per statement please - Perl - (2006-12-05)
  [945] Code quality counts - (2006-11-26)
  [743] How to debug a Perl program - (2006-06-04)
  [668] Python - block insets help with documentation - (2006-04-04)
  [242] Satisfaction of training - (2005-03-11)

H115 - Designing PHP-Based Solutions: Best Practice
  [4691] Real life PHP application using our course training MVC example - (2016-06-05)
  [4641] Using an MVC structure - even without a formal framework - (2016-02-07)
  [4118] We not only teach PHP and Python - we teach good PHP and Python Practice! - (2013-06-18)
  [4069] Even early on, separate out your program from your HTML! - (2013-04-25)
  [3926] Filtering PHP form inputs - three ways, but which should you use? - (2012-11-18)
  [3820] PHP sessions - a best practice teaching example - (2012-07-27)
  [3813] Injection Attacks - PHP, SQL, HTML, Javascript - and how to neutralise them - (2012-07-22)
  [3539] Separating program and artwork in PHP - easier maintainance, and better for the user - (2011-12-05)
  [2679] How to build a test harness into your PHP - (2010-03-16)
  [2430] Not just a PHP program - a good web application - (2009-09-29)
  [2221] Adding a newsfeed for your users to a multipage PHP application - (2009-06-06)
  [2199] Improving the structure of your early PHP programs - (2009-05-25)
  [1794] Refactoring - a PHP demo becomes a production page - (2008-09-12)
  [1694] Defensive coding techniques in PHP? - (2008-07-02)
  [1623] PHP Techniques - a workshop - (2008-04-26)
  [1533] Short and sweet and sticky - PHP form input - (2008-02-06)
  [1490] Software to record day to day events and keep an action list - (2007-12-31)
  [1487] Efficient PHP applications - framework and example - (2007-12-28)
  [1482] A story about benchmarking PHP - (2007-12-23)
  [1391] Ordnance Survey Grid Reference to Latitude / Longitude - (2007-10-14)
  [1390] Converting from postal address to latitude / longitude - (2007-10-13)
  [1389] Controlling and labelling Google maps via PHP - (2007-10-13)
  [1381] Using a MySQL database to control mod_rewrite via PHP - (2007-10-06)
  [1323] Easy handling of errors in PHP - (2007-08-27)
  [1321] Resetting session based tests in PHP - (2007-08-26)
  [1194] Drawing hands on a clock face - PHP - (2007-05-19)
  [1182] Painting a masterpiece in PHP - (2007-05-10)
  [1181] Good Programming practise - where to initialise variables - (2007-05-09)
  [1166] Back button - ensuring order are not submitted twice (PHP) - (2007-04-28)
  [1052] Learning to write secure, maintainable PHP - (2007-01-25)
  [936] Global, Superglobal, Session variables - scope and persistance in PHP - (2006-11-21)
  [896] PHP - good coding practise and sticky radio buttons - (2006-10-17)
  [839] Reporting on the 10 largest files or 10 top scores - (2006-08-20)
  [572] Giving the researcher power over database analysis - (2006-01-22)
  [563] Merging pictures using PHP and GD - (2006-01-13)
  [426] Robust checking of data entered by users - (2005-08-27)
  [394] A year on - should we offer certified PHP courses - (2005-07-28)
  [340] Code and code maintainance efficiency - (2005-06-08)
  [261] Putting a form online - (2005-03-29)
  [237] Crossfertilisation, PHP to Python - (2005-03-06)
  [123] Short underground journeys and a PHP book - (2004-11-19)

Y212 - Python - Code testing, patterns, profiles and optimisation.
  [4716] Profiling your Python program - (2016-11-01)
  [4618] Pytest - second example beyond hello world - (2016-01-08)
  [4617] Pytest - starting example - (2016-01-07)
  [4540] Unittest of a Flask application including forms - (2015-10-15)
  [4538] Flask and unittest - hello web app test world - (2015-10-15)
  [4470] Testing in Python 3 - unittest, doctest and __name__ == __main__ too. - (2015-04-21)
  [4446] Combining tests into suites, and suites into bigger suites - Python and unittest - (2015-03-01)
  [4344] Python base and inherited classes, test harness and unit testing - new examples - (2014-12-07)
  [4090] Test Driven Development in Python - Customer Comes First - (2013-05-16)
  [3658] Using Make for a distribution - (2012-03-17)
  [3478] Testing your Python classes with the unittest package - how to - (2011-10-14)
  [3464] Passing optional and named parameters to python methods - (2011-10-04)
  [3442] A demonstration of how many Python facilities work together - (2011-09-16)
  [3441] Pressing ^C in a Python program. Also Progress Bar. - (2011-09-15)
  [2616] Defining a static method - Java, Python and Ruby - (2010-02-01)
  [2123] Using Python with OpenOffice - (2009-04-09)
  [1148] Python decorators - wrapping a method call in extra code - (2007-04-15)
  [1146] __new__ v __init__ - python constructor alternatives? - (2007-04-14)
  [1140] Python GTK - Widget, Packing, Event and Feedback example - (2007-04-09)
  [235] Preparation for a day's work - (2005-03-04)

U196 - Testing and Development in Lua
C239 - C and C based languages - Putting it all together
  [4559] When do I use the this keyword in C++? - (2015-10-29)
  [3810] Reading files, and using factories to create vectors of objects from the data in C++ - (2012-07-21)
  [3252] C++ - unknown array size, unknown object type. Help! - (2011-04-17)
  [3069] Strings, Garbage Collection and Variable Scope in C++ - (2010-11-25)
  [3067] Using C and C++ functions in the same program - how to do it - (2010-11-24)
  [2851] Further C++ material - view new or old - (2010-07-04)
  [2674] Make and makefiles - a commented example to help you learn - (2010-03-12)
  [2673] Multiple Inheritance in C++ - a complete example - (2010-03-12)
  [2646] Compile but do not run PHP - syntax check only - (2010-02-22)
  [925] C++ - just beyond the basics. More you can do - (2006-11-14)
  [836] Build on what you already have with OO - (2006-08-17)

R212 - Ruby - Test::Unit
  [4389] Cucumber example - test::unit, scenario outlines, datafile driven test - (2015-01-09)

J715 - Putting the Java Language Together
  [4430] The spirit of Java - delegating to classes - (2015-02-18)
  [2735] Type checking, Java arrays and collections - (2010-04-23)


Back to
Learning to program - what are algorithms and design patterns?
Previous and next
or
Horse's mouth home
Forward to
Good, stable, reliable local businesses
Some other Articles
Java - factory method, encapsulation, hashmap example
Does Santa Claus need a CRB check?
Folk music train, Westbury to Swindon round trip, 14th December 2014
Good, stable, reliable local businesses
Learning to program - comments, documentation and test code
Are administration / review charges on hotel guests acceptable?
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/4326_Lea ... -code.html • PAGE BUILT: Sat May 27 16:49:10 2017 • BUILD SYSTEM: WomanWithCat