Exercises, examples and other material relating to training module Q101. This topic is presented on public courses
There are certain key concepts in programming in more or less any
modern language - and our resources that relate to these key concepts
are gathered here in this module.
|Articles and tips on this subject||updated|
|4090||Test Driven Development in Python - Customer Comes First|
The Customer comes first!
When you're writing code, you should be thinking of your user. That may be your end user or - if you're writing a module or classes - that might be a fellow developer, set of developers or even yourself. Whichever it is, the important thing is to get it right for them. It ...
|4061||Seamless, integrated IT - we have a long way to go!|
If it's Monday, it must be Cheltenham and almost every night a different bed. This is a week of crisscrossing the UK, with four septate courses / sessions scheduled in five days. The logistical administration is far from easy, showing just how far we still have to go on IT systems in this area. A lift ...
|4003||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, ...
|3954||Lesson 1 in programing - write clean, reuseable and maintainable tidy code|
I often say to delegates that I train that they could write code that makes the dog's dinner look neat:
Really, that's not a good approach to code writing ... for sure, it can be cleaned up ...
... and you can end up with something sparkling tidy ...
... but why not write it tidy in the first ...
|3928||Storing your intermediate data - what format should you you choose?|
Many applications require data to be held at intermediate stages - stored. What format should be used? ... HUGE subject.
1. If there is already an industry standard / draft standard way of doing it, think very carefully before going for anything else. The standard will have been designed with ease ...
|3878|| From Structured to Object Oriented Programming.|
A frequent comment - "I'm very used to conventional / structured programming, but I'm now trying to learn about Object Orientation and I don't understand the idea and I get baffled by all the buzzwords I hear". And a request "Can you help me?"
Yes - I can help you. If you come on a course ...
|3673||Object oriented or structured - a comparison in Python. Also writing clean regular expressions|
Should I go "object oriented" with my code, or use functional coding? That's a big question, and the answer depends on the application you'll be writing, the language you'll be writing it in, the programmers concerned, the expected life cycle of the application, and whether you'll be able to reuse ...
|3548||Dark mornings, dog update, and Python and Lua courses before Christmas|
It's significantly darker each morning as we take Gypsy and Billy out for a morning walk. We're out well before sunrise now, which was at 07:29 on his first morning with us, it is at 08:04 today - just a fortnight later - and will be at 08:16 by 31st December. Only from 1st January does it start getting ...
|3551||Some terms used in programming (Biased towards Python)|
Some of the elements of your program
- typically a keyword followed by series of parameters
- a "unit" of shell / batch / Tcl programming
(You don't really have commands in Python)
Statement - an atomic operational unit of a program
- a "unit" of Python / Perl / PHP / Lua / C etc ...
|3542||What order are operations performed in, in a Perl expression?|
Mathemetical operators in Perl aren't simply performed left to right - very early on your Learning to Program in Perl course you'll learn that multiplications and divisions happen before additions and subtractions, and you'll learn that brackets (also know as terms or lists) happen even earlier. Commonly ...
|3456||Stepping stones - early coding, and writing re-usable code quickly|
First coding ... and people start at the top and work through to the bottom. Example: [here].
Then they find bits of code repeating, and they separate the repeating stuff out into functions. Example : [here].
In order to re-use the repeated stuff in other programs, they then save it to another file ...
|3026||Coding efficiency - do not repeat yourself!|
"If you find yourself repeating something ... there's probably a better way"
"If you find yourself thinking "surely someone's done this before" ... they probably have, and their code is probably available to you"
The things I find myself saying very frequently in courses ... for delegates who are new ...
|2964||An introduction to file handling in programs - buffering, standard in and out, and file handles|
Stdout and Stderr
Programmers typically don't write code to output to the screen / current window, as to to so would be to provide an inflexible system - instead, they output to what's known as "standard out", also known as stdout. Usually stdout defaults to the screen / current window so there's no ...
|2915||Looking up a value by key - associative arrays / Hashes / Dictionaries|
In any substantial programming task, you'll want to store a whole series of values in some sort of table, so that you can process / reprocess / handle each of the elements in turn - and to do that, you'll use a variable construct that's called an "array", or a "list", a "tuple" or a "vector". (The exact ...
|2878||Program for reliability and efficiency - do not duplicate, but rather share and re-use|
When you're writing a new piece of code - especially if you're also quite new to programming - you'll be concentrating so much on getting it to work that you may not be giving too much thought to making it easy look after your code later on (maintainance), nor to sharing a piece of code between programs. ...
|2769||Easy - but for whom?|
1. I wrote a graphing package once - for use on the Tektronix 4051 (so you'll see how old that was!) - and the sales team for whom I wrote it loved it in demonstrations. It asked a series of questions and then drew a graph - just what was needed to introduce customers to the piece of hardware and show ...
|2737||Improving your function calls (APIs) - General and PHP|
Some of the code at the Civil Service Department (CSD) where I worked on manpower planning models some 35 years ago would not have stood up to analysis against modern programming practice (but then ... that WAS 35 years ago). Indeed, some of the code "behind the curtains" didn't even stack up properly ...
|2586||And and Or illustrated by locks|
Lisa and I came across this impressive array of locks on what we have since learned is probably the back gate to the National Grid's Lacock Switching Station, about 3 miles North of Melksham. [picture/details]
Our first reaction was "wow - that must be REALLY secure - what are they doing in there?" ...
|2550||Do not copy and paste code - there are much better ways|
If you find yourself using copy and paste to duplicate a piece of code, take a step back and think again. You're doubling your maintenance work, with two separate sets of code to look after and keep in step from that day forwards.
Are you going to give me the "but I have to change one copy a bit" excuse? ...
|2510||The music of the stock market|
Over this weekend, I have come to realise just how similar the music is to high finance (and that I should take a day off occasionally!). I love the range of applications that I look at ... and on Saturday, I was looking at sequences of stock values at regular intervals, whether they were going up ...
|2415||Variable names like i and j - why?|
Q: Why do people use variable names like "i" and "j" for loop counters? I thought that you were supposed to use longer, desciptive names!
A1: Fortran (FORmula TRANslator) was one of the prevalent programming languages in the 1960s and 1970s, at a time when many programming techniques, algorithms and ...
When I travelled from home to Saudi Arabia in May, 2006, I planned ahead. Flights were booked, course manuals printed, Visa obtained, contacts established, deposit paid (to us for courses), travel insurance in place before I even left home. "Of Course" or "Prudent", I expect you'll say. And I agree ...
|2310||Learning to write high quality code in Lua|
What a wonderful opportunity this week - to train delegates in Lua programming (and Lua, byte for byte, is perhaps the best value language that I train in) but also to be in on the early stages of a project where it's not just a question of training on the language itself, but also in helping provoke ...
|2228||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 ...
|2022||Pre and post increment - the ++ operator|
The ++ (increment) operator in PHP (and Perl, and C, and Ruby) adds one to the value held in a variable and saves the result back in the same variable. But you'll see both $n++; and ++$n; in code. What is the difference?
If you write the ++ in front of the variable name, the variable is incremented ...
|2001||I have not programmed before, and need to learn|
Yesterday was the second day of my Learning to Program introductory course - for delegates who are learning to program - as well as learning a particular language, and (since the target language is C), I wrote a number of new C examples. And these examples were written in front of the delegates to show ...
Stored programs - running from file.
Very fast, but an IQ of zero.
Variable and variable types.
Conditions and conditional code.
Loops and named blocks of code.
Pointers and references.
Compilers and Interpretters.
Program and system design.
If you are looking for a complete course and not just a information on a single subject, visit our Listing and schedule
Well House Consultants specialise in training courses in
. We run
throughout the UK (and beyond for longer courses), and
at our training centre in Melksham, Wiltshire, England.
It's surprisingly cost effective to come on our public courses -
even if you live in a different
country or continent to us
We have a technical library of over 700 books on the subjects on which we teach.
These books are available for reference at our training centre. Also
available is the Opentalk
Forum for discussion of technical questions.