Introduction to Programming: Aims and Objectives

This is a statement of the aims and objectives of the course Introduction to Programming taught by Matthew Huntbach in the years 1998-2001. It has been updated slightly since then to keep the links live.

The role of programming in Computer Science

Programming forms the core of Computer Science. Other aspects of the subject are either side-issues, or specialisations from the basic programming core. Therefore Introduction to Programming is the core first-year course in all our Computer Science degrees, and is an essential prerequisite to almost all that follows in the second and third year.

Programming is about writing the instructions which a computer follows to enable it to store knowledge, process knowledge, and communicate knowledge with the outside world. Stemming from storing knowledge we can move into data structures and databases. Stemming from processing knowledge we can move into algorithms and computations. Stemming from communicating knowledge we can move into human-computer interaction and network issues. We can look in more detail at what is actually happening when a computer runs programs, considering how the instructions we write are translated to real changes in the electronic mechanisms of computer machinery. We can step back and consider more generally how we can organise the process of writing computer programs. We can develop mathematics to help us describe and analyse the behaviour of computer programs. We can look at some of the common applications of computers, and methods of programming those applications. We can think of new things we would like computers to do for us, and try and work out how we can write programs to make them do those things.

The aim of an introductory programming course

In a Computer Science degree we aim to teach you skills that will be relevant many years in the future. That is not always easy because we know computers and computing are changing rapidly. The machines, computer applications and even the role of computers in society today are very different from what they were ten, twenty or thirty years ago, and we can be sure that they will be different again ten, twenty or thirty years into the future. That is why we don't see our job as giving detailed training in whatever are the current leading systems on the market. Instead we are concerned with teaching more general principles. However, programming is a practical subject: you will be taught enough to be able to write real working programs, albeit ones on a much smaller scale than those used in industry or sold as commercial software applications.

The important skills which underly programming are abstract ones. The ability to see patterns and to abstract from specific examples to the more general case is crucial. Being able to think logically so you can predict in advance the behaviour of a system working to a fixed set of rules is essential. You need the imagination to be able to take the instructions in a computer program and visualise them as commanding real entities interacting with each other, even though there is nothing to see when it happens.

Skills like this are difficult to teach. Some would say they are skills you either have or don't have, and that is why when we admit students to the degree programme we look first at things like qualifications in mathematics which require similar sorts of skills. However, I believe we can develop these skills through practice. That is why a lot of what is done in Introduction to Programming is not teaching but practice. An Australian Computer Science lecturer who teaches a similar course to this describes it as Problem Based Learning. You will be given examples to practice on to develop your abstract skills. You need to seek out further examples from the textbooks and supporting material. Programming is not something you can sit back and be taught, it is something you have to put your own effort into to learn by experience. In fact a subsidiary aim of Introduction to Programming is for you to learn good working practices: self-motivation, good time management, making use of information sources, thinking and acting rationally, learning how to learn, and learning how to behave and get the best from the adult environment of lecture room, laboratory and community of academics.

Java and object-oriented programming

Introduction to Programming is taught using the Java programming language, but note the course is not called "Introduction to Java Programming". It is about programming in general, and not just programming in Java. Thus a lot of the emphasis will be on programming techniques that are applicable in most standard programming languages. You won't be taught, and won't be expected to know at the end of the course, minute details of the Java programming language. In fact, only those aspects of Java relevant to putting across more general principles of programming will be covered.

Java is a large and complex language, but most of its complexity comes from the extensive library of pre-written code supplied with the language that gives it the ability to produce images on the computer screen, to interact across the internet, and to do various other things. If you wanted to be a professional Java programmer you would need to know more about this, and indeed you will get chance to cover some of it later in your degree programme. However, in Introduction to Programming, I have made the decision to concentrate on "basic Java", making only minimal use of the Java libraries. As a result, the programs you write will seem rather old-fashioned: interacting by reading and writing text to and from the screen rather than through graphical user interfaces. I won't be dealing with the web aspects of Java, even though Java has become known as "the language of the web" and it took over as a leading programming language because of its affinity with web applications. This may seem a little boring, but I believe it's important to get the basics right first without getting distracted by other matters. Once you have a thorough grounding in basic Java, you will be better placed to appreciate what is happening in Java programs that look more exciting when they run and do exciting things over the internet.

Along with the decision to concentrate on "basic Java", I have also decided not to make use of an "Interactive Development Environment" (IDE). Such environments can make some aspects of Java programming easier, as they do some of the routine work and organisation for you. On the other hand, they can look complex as they are designed for more advanced Java programmers who want to do far more than we shall cover in this course. I feel it is important to get a good hands-on feel for how Java works to start off writing your programs from scratch using a text editor ( emacs is recommended, but vi is an alternative), and organise your files using a command-line interface operating system (we shall be using Linux). You will be able to make better use of IDEs in the future if you have started off knowing what happens underneath.

Java is an object-oriented language, and there is a growing consensus in the computing world, both educational and industrial, that computer programming should be thought of primarily in object-oriented terms. In the early days of computers, a computer was a standalone device into which you fed in data, it did some calculations and gave you some output. The emphasis then was on trying to give some structure to the instructions which made the computer do the calculations, so that the instructions as a whole could be broken down into smaller self-contained parts. Being able to divide a program into parts like this made it easier to understand, and the job of programming was made easier if you planned what you were doing by breaking the task down into parts. This was termed "structured programming". Structured programming was seen as the program as one structured entity operating on the data as another, hence the phrase that was used to describe it "Program=Algorithm+Data Structure" ("algorithm" is defined in the on-line dictionary of computer terms as "A detailed sequence of actions to perform to accomplish some task"). In contrast, object-oriented programming sees computing as a large number of entities, each of which has both its own data to hold and instructions to follow, interacting with each other.

Object-oriented programming fits better than structured programming into the modern world where computers are not standalone devices but devices linked with each other and interacting through networks. While performing complex calculations is still one thing we use computers for, these days there is far more emphasis on computer programs that interact with users (and in more advanced applications such as robotics interact more generally with the world around them). Much computer programming now is about bringing together existing components and making them interact rather than designing algorithms from scratch. Computer code libraries, such as that provided with Java, give descriptions of objects in terms of the data they hold and the way they interact with other objects, and computer programming involves making use of these libraries and adding to them by making descriptions of new sorts of objects.

But object-oriented programming should be seen as a descendant of structured programming, and not a rival. Java descends from the structured language C through an intermediate form called C++. C++ is widely used, and has the advantage of combining some of the hands-on direct manipulation of the computer which C gives us, with the object-oriented approach. Java is a purer object-oriented language because, unlike C++, it does not give us ways of escaping from the object-oriented way of thinking. Learning to program in Java means you learn to program in an object-oriented way. One particularly good thing about Java is that it has achieved widespread use in education (it is probably now the most widely used language for introductory programming courses in university departments) while also gaining an increasing share of programming language use in industry. In the past there was often a gulf between languages academic Computer Scientists preferred to use for teaching which never got used in the "real world" and the languages used by industry which academics considered too unstructured t o be suitable for teaching. Having said this, it should not be considered that Java is the ideal. In many ways it is a compromise choice. And we should not be surprised to see some time in the future another language appearing and pushing Java aside, just as Java appeared suddenly in the mid-1990s.

Object-oriented programming shares with structured programming the view that programs should be developed methodically, so that the different parts of them can be isolated, having well-defined behaviours and not interacting in unexpected ways. Since programs used in realistic applications tend to be very large, that is important. A large but poorly-structured program is likely to contain many mistakes since there are far more opportunities for things to go wrong. It is harder to understand how it works and correct the mistakes, and harder to change the program if a new version of it is required. For this reason the Introduction to Programming course will emphasise the development of well-structured programs, and stress the importance of good design. Programming is something you should think about, programs should be designed carefully not just thrown together and then tweaked until they work. A program which works in the sense that it does what was asked, but does it in a way that's hard to understand, is not satisfactory and in assessments will not get full marks.

The details

The exact material in the course varies from year to year. I don't have a fixed set of lectures I will give come what may. I will try to respond to the reaction I get from the class - slowing down or introducing more examples if there's any area it seems the class is finding difficult, dropping things altogether if there's no room for them, or adding new things if I decide on thinking about then that they're important and you ought to cover them. This is why it's important that I do get comments from people on the course - I would like to be able to use the newsgroup for on-going discussions (if you are going to use newsgroups, Emily Postnews's page of misleading tips might be helpful) . If you don't understand something, let me know, or post your concern to the newsgroup.

However, I expect the course to be fairly close to how it was last year and the year before that, which are the two years I've taught it (previous to that it was taught by someone else, with a different emphasis). So past exam papers for 2000 and 1999 give a very good idea of the level I expect you to reach by the end of the course. The local notes that were written for this course also give a good idea of the course content and the topics covered. However, do bear in mind that these notes were written two years ago, and haven't been fully updated. The details of what is taught each year vary in response to how the course is going, and my own continuing study of Java and the best ways to teach programming using it. So I can't guarantee that everything in the notes will be covered in the lectures, or everything in the lectures will be covered in the notes, or that the examples in the lectures will be exactly like those in the notes.

Here's the topics that will definitely be covered:

The minimal use of Java's library is intended to give you a thorough grounding in the "nuts and bolts" of Java before you move on to using those nuts and bolts to build things out of the components provided by the library. The basic principles of object-orientation covered can easily be applied to other languages. The philosophy behind this is that you will concentrate better on these basic principles without being distracted by the great variety of things in Java's library.

How to fail this course

It is a sad fact that Introduction to Programming has a high failure rate. This seems to be common in Computer Science departments - students start, most with an interest in, some claiming significant experience with computers. Yet many end their first year failing, and quite often it's those with the computer experience who fail.

Lecturers don't like to fail students. Apart from it being a poor reflection on ourselves, our livelihood depends on us having a sufficient number of students to pay our salaries. If we throw students out we make life harder for ourselves. So why do we do it? The answer is quality. If we fail students who don't come up to a certain standard, that is a guarantee that the rest have come up to that standard of quality. Queen Mary is part of the University of London and thus keeps to the same standards as the other University of London colleges, such as Imperial, UCL, Kings College. If you are not prepared to put in the work required to reach that standard, and not willing to meet the challenge of rigorous courses that entails, you should have applied somewhere else to do your degree.

So why do students fail? In my experience there is a small number who really do have a natural lack of ability in the subject. They try hard but still don't get anywhere. Our admissions procedures (the author of these notes is also the department's admissions' tutor) try to avoid giving places to people like this by considering qualifications, statements on UCAS forms, interviews and so on. But some still slip through - if you are one of them, sorry! There are also some who suffer genuine personal problems during the year which stop them from succeeding. If you are one of these, tell us (we can't make allowances if we don't know) and don't be afraid to seek help.

But many fail for a variety of reasons and misconceptions that could be avoided. Here are some of them:

How to pass this course

One of the first things to remember is that university is not like school. You are at university because you want to be at university (if you don't, you can obtain a withdrawal form from the Registry). You are working for yourself and will need to motivate yourself. You will have to get used to not being told what to do the whole time, but instead learning to make use of the resources which are available. This course unit and the setting in which it is given provides you with a bundle of resources - make sure you use them to the full. Here are the main resources available: So, as you can see, there are a lot of resources available. Putting together notes and web sites, and preparing and giving lectures is hard work for me, but it's what you (still to some extent aided by the taxpayer) are paying for - make sure you use it. I don't want to be continuously moaning at you throughout the course of the year on the need to work hard, but if I do, remember it's because I want you to pass and do well. We lecturers know from long experience that steady work throughout the academic year is the way to pass a course. This is particularly so in a practical subject like computer programming where you learn by doing it. Computer programming is a difficult subject, but a rewarding one. This course aims to stretch people rather than water down the subject so that everyone can pass (but many will get bored). But you wouldn't have been selected to join the department unless we thought you could do it. If you're a "natural" who can sail through it - great! If you're one of the majority who struggles at times, hang on there, ask questions, seek answers from the resources available, make sure you attend all the lectures, labs and tutorials, and Don't Panic.
Matthew Huntbach
Last modified: 3 March 2006