Main Content

Learning to Program - how we start to teach you at Well House Consultants

Archive - Originally posted on "The Horse's Mouth" - 2014-11-16 18:11:57 - Graham Ellis

At Well House Consultans, we offer courses at two levels in a number of programming languages. Our "learning to program in ..." courses are for delegates who have never programmed before, or who are rusty, who lack confidence, or want a refresher of the basic principles. Our "... programming" courses are for delegates who have prior programming experience, but are converting from another programming language to the one that we're teaching at the time. By offering two different starying points in this way, we can ensure that newcomers to programming aren't swamped in the first hours, yet experienced programmers don't have to sit through a day of the basiss.

This module accompanies the "learning to" courses and intentionally leaves out code examples. It's very easy for the tutor on your course to show you "one I wrote earlier", but that doesn't teach you as a newcomer how to write a program for yourself - you need to see the thought process, so it will be done by demonstration. The examples written will be made available to you after the course, and you'll also find code in the following modules of the notes which also apply to the courses where we start with experienced programmers.

So - let's start!

Stored programs ...
* We start with a series of instructions in a text file
* Each instruction is separated from the next somehow
* Instructions are run sequentially
* Possibly wrapped in some sort of named block to say "Start here"

Running a stored program ...
* We need to translate from text to runnable
* That may be through an intermediate process - there are three common ways (compiler, pure interpretter, and virtual machine)
* There will be common code to all / most applications, and that will be loaded from standard libraries

Hello World ... and Hello delegates too
It's traditional on all programming courses for the first example to output the words "hello world" onto the programmer's screen. Of course, that's very much more simple than any practical program but it show you
* How you input the program, what you write and where you store the "source code"
* How (and if) you translate that program into a different format from which yu can run it
* And how you run the program

The tutor will demonstrate this to you, and have you try it out too. It will feel clunky at first. Don't worry about that - you'll speed up later, and there will be lots of other things to learn about in yor chosen language that will make it easier too.

At this point, one of things to think about is how portable your program will be between different computer architectures and operating systems. You may feel it's early to look at this, but right from the start you'll want to know about the portablity and re-usability of your work.

Commenting your code

Also at this point, we'll take a first look at code documentation. "Hello World" really doesn't need too much backup information for the maintenance programmer - either a colleague of yours, or you yourself when you come back and try to remember what you did in 6 months or 6 years time because it needs updating.

* Every language allows for comments in some way or another, and we'll add some to "Hello World".

Comments make no difference to the running of your code, but they make a huge difference later on. You should include information about what the blocks of code do, and also any notes about the environment in which they are designed to run. Version numbers, copyright, and support contact details and terms and conditions are also worth considering in serious code blocks.

As well as programmer's comments, instructions for your user should be provided. Most languages provide you with specific tools and an ability to build these instruction into your source code. And it's very likely too - with modern programmig - that you'll also provide some sort of test suite that lets you and your customers check that the program's functionallity is still working as planned after upgrades and changes.




To see our upcoming public course schedule, take a look [here]. The format above is your starter in each and every language, but it's adapted to the language of choice - we start as we mean to go on!