Skip to main content

An introduction to programming in C# for pre-university Maths/Science pupils

Downloaded: 18

Last edit: 10 December 2021

This resource forms part of the Computer Science from the Metal Up series. However, this resource is not intended as an introduction to programming for those studying GCSE or A-level Computer Science; it is intended for sixth form students who have not programmed before but are intending to study Mathematics, Science, or another numerate subject at university. The book takes a radical approach to the subject, adopting the following principles:

  • Teach an approach to programming that is up-to-date with modern programming languages, paradigms, and practices, rather than the approach of most (school) textbooks, which hasn't changed significantly since the early 1980s.

  • Teach students, from the outset, to separate core functionality from input/output, and teach them to write functions in the Functional Programming (FP) style before writing any input/output (as distinct from starting with 'Hello World!'). Then teach them to write input/output (which may be done in more procedural style). The input/output calls functions, never vice versa.

  • Teach writing functions within a REPL (in this case using the C# Interactive window in Visual Studio) rather than the conventional approach (in C# at least) of creating a project with all the accompanying boilerplate.

  • Teach unit testing and refactoring as a basic practice of programming.

  • Use the most up-to-date capabilities of C# (version 8) as would be practiced by professional programmers. (The techniques are no more difficult to master from scratch and are definitely cleaner.)

  • Use examples, albeit simple ones, that are relevant to mathematical or scientific computing. (The book assumes that the student has taken, or is taking, A-level mathematics).

I am very excited by this new approach, and have had some positive feedback from several teachers who have seen an early draft of the first part of the book. I am particularly indebted to John Stout for his detailed feedback and many suggestions of small improvements, all acted upon.

This is, however, still very much a first version. I hope to produce a second version, with more chapters, later this year, hopefully in time for the Autumn term. But I wanted to get a version out now because I know some teachers hope to use it this term during lock-down as it is a self-guided course (though students will need some teacher support to be available.)

As usual, I have produced separate Student and Teacher versions of the book (the latter containing model answers to the exercises) and a simple EAD in which students can record their own answers.

It is also my hope, working with collaborators, to produce broadly-equivalent books for other programming languages including Python. (Normally, I produce most of my resources for both C# and VB in parallel. Sadly, however, I do not know of any good REPL for VB, and this is core to the book's approach.)

Please do give me feedback, and report any errors be emailing me