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
 
Web and console - same principle, same code - Ruby example

Courses for newcomers to programming start with showing the mechanism of how to enter a program, how to prepare that program to be run, and how to actually run it. We then show them how to read an input (usually from the keyboard), calculate, save values into variables and resuse them a few lines later, and output resuts. That's a tried and tested formula for getting something up and running quickly, and that "something" being a useful program. But it's a very long way indeed from a web application, which is what many delegates are writing these days ... or that's how it looks.

And so - at the end of the first day of our "Learning to program in ..." courses, we take the code that we've written and put it into context - take it a step further, and a small step to being recognisable in their environment. It's helpful in putting stuff in context, and it's motivational in that it helps delegates see where they're going.

How STDIN and STDOUT can be harnessed through a web server• In First Principles terms, keyboard to screen is the same thing as browser input to browser output via a web server - both are using Standard In and Standard Out - the process's main IO channels.

• In First Principle terms, reading from a file is just like reading from the keyboard - it's a stream of data from which the next line's returned each time you do a read.

And applying those first principles, a program that goes keyboard to screen can rapidly be converted to going data file to browser window. I've put a program that I wrote at the end of the very first day of programming for delegates this week, which runs on both a web server (via CGI) and stand alone from the keyboard. Source is [here].

Being a "first day program", I've used straightforward language elements rather than shorter / more efficient ones that come later in the course, and this has lead to a degree of repetition which - in the longer term - I would frown upon as each repeat doubles up the changes and testing needed when the program needs alteration.

Being a "dual use" program, I've not put any specifics / HTML formatting into it ... such things would come in an applicaton program, leaving an API for the data handling clean for any environment.
(written 2013-02-14, updated 2013-02-15)

 
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articles
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)
  [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)
  [2228] Where do I start when writing a program? - (2009-06-11)
  [2022] Pre and post increment - the ++ operator - (2009-02-03)
  [2001] I have not programmed before, and need to learn - (2009-01-19)

R114 - Ruby on the Web
  [4502] Reading and parsing a JSON object in Ruby - (2015-06-01)
  [3773] Ruby on the web - a simple example using CGI - (2012-06-22)
  [3623] Some TestWise examples - helping use Ruby code to check your web site operation - (2012-02-24)
  [3432] 3 digit HTTP status codes - what are they, which are most common, which should be a concern? - (2011-09-11)
  [3431] Ruby at both extremes of your website - (2011-09-10)
  [2607] Answers on Ruby on Rails - (2010-01-30)
  [2605] Ruby on Rails - a sample application to teach you how - (2010-01-30)
  [1891] Ruby to access web services - (2008-11-16)


Back to
Images of Melksham you havent seen before
Previous and next
or
Horse's mouth home
Forward to
Annual Accounts - a big job for a small business
Some other Articles
Which database should I use? MySQL v SQLite
Ruby / SQLite3 example program, showing JOIN v LEFT JOIN
New guest ... becoming returning guest
Annual Accounts - a big job for a small business
Web and console - same principle, same code - Ruby example
Images of Melksham you havent seen before
Helping search engines with appropriate 400 error codes
9 years, and 4000 articles on
Handling failures / absences of your backend server nicely
Travelogue - from the Netherlands to London via Hook and Harwich
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/4003_Web ... ample.html • PAGE BUILT: Sat May 27 16:49:10 2017 • BUILD SYSTEM: WomanWithCat