A Perspective on Language Wars
Computing Laboratory, University of Kent at Canterbury,
Canterbury, Kent, CT2 7NZ
The choice of programming language to teach and, in particular, the choice of language to teach first, has been seen by many academics to be of paramount importance and has become a highly emotive issue. In particular, deciding a suitable first language has proved to be both very difficult and highly divisive in academic departments. The perspective of this paper is, though, that the ensuing debates are often poorly focused. In particular, the programming language decision is not actually the central issue. The emphasis should not be on deciding a particular language to teach, but rather on deciding a theory or methodology of programming to teach. Three classes of programming methodologies predominate: teach structured imperative programming, teach 00 based design and programmming or teach a (semi formal) theory of programming. This paper highlights the arguments for each of these approaches. Tllis paper is not though intendend to prescribe a particular methodology, rather it is merely to stimulate debate on this issue.
Programming plays a central role in computer science and consequently the topic occupies a similarly central role in the teaching of the subject. The choice of programming language to teach and in particular, the choice of language to teach first, has been widely perceived to have a significant infiuence on the programming style adopted by students. Thus, the choice of language has been seen by many academics to be of paramount importance and has become a highly emotive issue. In particular, deciding a suitable first language has proved to be both difficult and divisive in academic departments; it seems to be the case that almost all departments have been through some form of 'language war' at some time or another. There has been a recent spate of such language wars arising from the move away from traditional imperative teaching languages (exemplified by Pascal) towards languages which support modern software engineering features (such as abstract data types and object oriented concepts).
However, there seems to be very little consensus as to the most suitable first programming language to teach. This was borne out in a recent survey of teaching languages in the UK (Jones,1993) and also in a workshop on the topic organized by the British Open University (OU,1993) (more of these in section 2). This paper reflects on this confused setting by giving a personal perspective on these language debates. This perspective has arisen largely as a response to the Open University Workshop (OU,1993) and draws extensively from the presentations made and discussions held at that workshop.
The paper though is less concerned with the relative merits of particular languages, and more with the mechanisms by which language debates are carried out. Specifically, it is argued that the central consideration when re-evaluating introduction to programming courses should not be programming languages. In fact, the continuing emphasis on the relative merits of programming languages can be seen to blur the actual central issue, which is the consideration of the programming methodology (or paradigm) to teach. This position has been advocated a number of times in the past, notably a related argument was made recently by D.J. Andrews (Andrews,1993). However, language wars centred solely on programming languages seem still to predominate.
The paper is structured as follows: section 2 presents background on the first language debate. Section 3 discusses why methodologies should be considered rather than languages. Section 4 describes the choice of possible methodology to teach and finally, section 5 presents some conclusions.
2. Background- The First Language Debate
2.1. First Language Choices
As highlighted earlier there seems to be very little consensus as to the most suitable first programming language to teach. At a Workshop on the topic organized by the Open University (OU,1993) at least 16 different first languages and programming notations were advocated. Included amongst these were traditional imperative languages, such as Turbo Pascal (Traxler,1993); more modern imperative languages, such as Modula-2 (Cater,1993), Modula-3 (Robinson,1993), Ada (Wichmann,1993) and Extended Pascal (Joslin,1993); fully fledged object-oriented languages, such as Eiffel (Weedon,1993), C++ (Lee,1993), Omega (Blaschek,1993) and Cool (Weber,1993); and more formally oriented languages and notations, such as ML (Robinson,1993) and VDM (Pronk,1993). Furthermore, there seemed to be significant disagreement as to the relative benefits of the proposed languages. In fact, many of the points made in the presentations were contradictory, with certain language features being highlighted as essential by some presenters and the same features being viewed as inherently dangerous by other presenters.
A survey performed on behalf of the University of Hull (Jones,1993) also suggests a certain diversity of opinion on this issue. Specifically, the survey revealed that 10 different languages were being taught amongst 39 different U.K. university departments (an unpublished informal survey performed on behalf of the University of Teeside implied a somewhat more significant diversity of choice). (Jones,1993) suggests that common language choices are Pascal and Modula-2 from the imperative language setting; Miranda and SML (/ML) from the functional language setting and C++ from the object-oriented setting. In addition, (Jones,1993) implies that Pascal remains the most extensively taught first programming language; being taught in 12 of the 39 departments sampled. Although, comparison of the 1993 survey with a previous survey, performed in 1989 (Furber,1992), suggests that there has been a significant swing away from Pascal within the last 5 years (this conclusion is also indicated by the University of Teeside survey). This swing can to some extent be accounted for by a not insignificant increase in the teaching of functional languages (in particular, Miranda) and object-oriented languages (almost exclusively C++).
2.2 The Argument against Traditional Imperative Languages
It has been widely argued that the traditional imperative languages, such as Pascal, C or the Algol languages, do not satisfy the needs of current introduction to programming courses, e.g. (Lee,1993). The grounds for this view are:
1. Traditional imperative languages encourage teaching of the 'nuts and bolts' of programming in a bottom-up manner: introducing language features and then showing how to use these features. Consequently, they are purely concerned with the implementation phase of software development and importantly, they encourage the view that programming is solely about implementation. In particular, they do not encourage consideration of the specification and design phases of software development, which are so important in modern software engineering theory (see figure 1).
2. (Very closely related to the above point) Traditional imperative languages do not support modern software engineering principles. They offer powerful mechanisrns for control abstraction, but only lirnited support for data abstraction. In particular, they do not support abstract data types or the object oriented paradigm.
Despite the industrial pull of C (which would on vocational grounds be a very sensible choice) the literature on the choice of first language is overwhelmingly opposed to the language. In particular, the language has obtained a significantly worse press than Pascal, e.g. (Andrews,1993). This is on the grounds that C is syntactically inelegant, type unsafe and
generally it enables too many unstructured low level programming tricks. Furthermore, despite the number of departments that are using it, C++ is also generally seen in the literature as a poor choice, e.g. (Andrews,1993) and (Robinson,1993), since firstly it inherits the bad features of C and secondly it does not offer a pure model of object orientation. On the other hand, the general opinion is that Pascal is a good clean and elegant language, butt it is out of date.
3. Methodologies Versus Languages
The decision currently facing computing departments is what language to replace their traditional imperative teaching language with and this decision seems to be generating as much controversy in departments as previous language debates have generated. This is not suprising since comparative languages has always been an area that engenders heated debate and diverse opinions amongst computer scientists. Perversely, comparative language debates also seem to have a great attraction. Thus, even if it was not the original intention, re-evaluations of introduction to programming courses seem to get drawn into debates centring on the relative merits of specific programming languages.
However, the programming language decision is really not the major issue. At least it is not the first debate that should be settled. The continued attraction of comparative language debates can be seen to blur the actual central issue, which is the consideration of the programming methodology (or paradigm) to teach. It has been argued many times that the emphasis should not be on teaching programming by simply working through a particular language syntax (construct by construct), but rather by teaching a theory or methodology of how to program (hence, structured programming courses are taught, rather than Pascal courses). A notable recent proponent of this position is D.J. Andrews (Andrews,1993), who particularly argues that languages are likely to be transient, while teaching 'how to program' as a theory of programming teaches a skill which is long lasting and universally applicable.
Clearly, even if a programming methodology is focused on, some syntax and semantics is needed in order to express student problem solving. This syntax and semantics is likely to be executable, although this does not have to be the case. Thus, the constructs of a particular programming language or notation must be presented to students. However, the important issue is how these constructs are presented and what the emphasis of the teaching is. As D.J. Andrews states:
"Learning programming is the main activity, learning a language should be done 'en passant', a sort of 'Oh, and by the way, this is how you express these ideas so you can run your program on a computer"'
The vital issue is to make it completely clear that programming is not tied to a particular language, it is a universal activity.
Learning languages seems to have greater significance in students minds than the topic is worth. Specifically, as emphasised by (Andrews,1993), to experienced computer scientists once a couple of languages from a particular class of programming language (imperative, functional, etc) has been learnt the task of learning a new language is almost trivial, it is merely a matter of learning the new syntax to express the principles that are already known, i.e. to sit down with the manual. It is really the underlying principles of classes of languages that need to be emphasised, these principles are often blurred in first language teaching where students can find it hard to differentiate between fundamental language principles and specific language syntax. Thus, there should be as much emphasis on teaching how to learn new languages as being taught specific languages. Comparative language courses that compare the principles of programming in different classes of language have a significant role to play in helping students to learn how to learn new languages.
However, despite the recognition that programming should be taught methodologically language wars centred on programming languages seem still to predominate; this is unfortunate. Discussion of the relative merits of different programming methodologies must be made before specific languages are considered. In addition, it is my belief that having clarified the particular programming methodology that will be taught, a programming language which fits into that methodology can be found relatively easily. In particular, the criteria for a suitable language will arise naturally out of the choice of programming methodology.
4. The Choice of Methodology
Although, as previously indicated, there is great diversity amongst the languages proposed, in terms of basic methodologies advanced there is far less diversity. In fact, three general classes of programming methodology predominate:
1. Teach structured imperative programm1ng
2. Teach 00 (based) design and programming
3. Teach a (semi formal) theory of programming
We will consider each of these separately.
Teach structured imperative programming;. This is currently the approach most commonly followed in first year programming courses. Although there is a significant emphasis on structured programming as a methodology, construct by construct teaching can also feature extensively in these courses.
There are a number of arguments for this approach. Firstly, it is well known and has been taught successfully for many years, and hence, additional resourcing requirements are minimal. In addition, there is the argument that the nuts and bolts of programming languages must be taught, since they are the tools of computing. Software engineering principles and issues of programming methodology can be tackled at a later stage once the basics have been mastered.
Teach 00 based design and programming. A number of departments are looking in this direction. In particular, (Lee,1993) is a strong advocate. The full object oriented paradigm should not be taught straight away. However, students should certainly be taught about data abstraction and information hiding; inheritance and class hierachies can be left until a later stage. A typical course is the inital programming course described in (Lee,1993), which presents abstract data types as a mechanism for design through data abstraction; emphasising separating issues of specification from issues of implementation. These principles are extended with the 00 concepts of class, object, inheritance and dynamic binding in 2nd year courses.
A number of benefits can be seen to accrue from this approach:
• Design (through ADTs and 00 principles) is emphasised rather than implementation programming and is highlighted as a major concern of programming/system development.
• This approach ingrains immediately in the student fundamental software engineering principles and practice.
• 00 principles and practice are currently amongst the most influential software engineering paradigms. Thus, this methodology enables teaching practice to reflect actual (professional) practice.
• Such 00 based introduction to programming courses prepare students for later courses which consider programming in the large and the full 00 method.
Teach a (semi formal) theory of programming. This actually turns out to be quite a broad category which we will subdivide into three. However, common objectives and emphasis unite these three. Techniques that fall into this category include teaching VDM (Pronk,1993), ML (Robinson,1993) and Dijkstra's theory of weakest preconditions (Andrews,1993). The notations advocated for this methodology are often non-executable.
Importantly, the approach teaches algorithm specification design and development first and then how to realise algorithms in a programming language later. The notations are typically formal in nature, although, any mathematics presented to first year students is trivial and it is suggested that the mathematical flavour does not put first year students off.
Three varieties of this methodology are:
1. Functional Programming. The functional programming paradigm offers a style of programming that is conducive to correct programming and lends itself to mathematical analysis of algorithms. (Jones,1993) indicates that a number of departments see functional programming as a very suitable vehicle for introducing programming, (Robinson,1993) for instance.
2. Formal Specification. (Pronk,1993) presents an introduction to programming course in which the specification language VDM is the initial vehicle for expressing algorithms. Specification in VDM is placed within a complete system development model from natural language requirements to modula-2 implementation. Importantly, (Pronk,1993) argues that students who learn implementation programming first experience difficulties abstracting from the details of the programming task when considering abstract specification in later software engineering courses. He argues that students become 'addicted' to writing code. By presenting specification first the abstract view can be considered before low level programming has been ingrained.
3. Theory of Programming. (Andrews,1993) strongly advocates an approach based upon Dijkstra's theory of programming (Dijkstra,1993). Specification is taught using pre and postconditions and 'the rules of programming' are presented in terms of the rules of pre and post conditions. Specifications are implemented using a simple 'side-effect free' language, but the emphasis throughout is on the theory and not the language. The language-independent introduction to programming presented by (Bornat,1987) is a similar approach.
The arguments for this approach are:
it does not give the impression that programming is about any particular programming language, but rather, that it is a theory which can be realised using any language. This is not so true of the functional language category, which can become focused on a particular language.
it encourages students to specify and design and to do this with regard to the correctness of their programs. In particular, it should force students to design their programs with pencil and paper, rather than trying out partial designs in an ad hoc manner.
it teaches students to view programs as formal descriptions of abstract algorithms and that there is a mathematical theory underlying the development of programs.
it offers a starting point for the teaching of rigorous approaches to software development in later parts of the course.
it is likely to be almost totally new to all students. Thus, no students would have a head start (or more dangerously would perceive themselves to have a head start). It is important that beginners do not feel at a disadvantage and that experts are not bored .
Clearly, each of these approaches to software development will be considered at some stage during a computer science course, but what should be taught up front (first) as the accepted view of programming? A significant issue is student expectations of an introduction to programming course. Students expect to learn languages (not necessarily methodologies) and, moreover, to learn languages that are marketable (and will look good on their CV). First year students generally believe the subject is purely about the nuts and bolts of programming: that programming is implementation and nothing else. Does an introduction to programming course, then, confront student expectations or does it conform to them? At some stage during a computer science course a students misconceptions of what programming is must be confronted. In addition, it would seem to be most natural to confront that expectation sooner rather than later, in order that students misconception about the subject are not nurtured. The argument against the structured programming course is that it does not confront students expectations to a large enough extent and not in a way that reflects current software engineering practice. In contrast, both the 00 methodology and the theory of programming confront students with a view of programming which will be quite new to them.
Choosing between teaching an 00 methodology or a (formal) theory of programming is most likely to be made on the basis of personal taste. The former of these presents a practical approach to system development which reflects current professional practice, while in the latter, even if the formalism taught is minimized, the theoretical and mathematical is emphasised. It is central to both methodologies that unstructured system development is very difficult and highly problematic. However, the formal theory proposes that these problems arise from a lack of precision, while the 00 approach suggests that these problems arise from incorrect structuring of systems during development.
In addition, teaching more than one methodology in parallel or in close juxtaposition has many virtues. In particular, (Petre,1994) suggests that programming methodologies should be viewed as reference models for program development; i.e. they prescribe particular strategies for solving problems, and that experienced programmers select between many methodologies during program development. The role of the teacher should then be to present many methodologies and to present these methodologies in juxtaposition in order that students can select from the available methodologies and distinguish between their relative merits. Juxtaposition of a formal theory and an OO methodology would offer a powerful contrast for students.
This paper firstly describes the language options available for use in introduction to programming courses. These options have arisen mainly out of the presentations made at (OU,1993). I have argued that the first decision to make is not a choice of programming language, but rather clarification of the exact theory or methodology that should be taught. This is the real decision and the point at which the most debate should be undertaken. This paper seeks to stimulate the required debate by describing the three methodologies that could potentially be suitable for introduction to programming courses. These are:
1. Teach structured imperative programming
2. Teach OO based development and programming
3. Teach a (semi) formal theory of programming
The paper highlights the main arguments for each of the approaches. Picking a particular methodology is not, though, the intent of this paper, and such a decision will often be taken by departments on grounds of personal taste and for practical reasons (the availability of resources and such like). However, it is important that a debate takes place and it is focused on the correct issues. Language wars that focus purely on languages are misguided, but those that focus on programming methodologies are constructive and worthwhile.
(Andrews,1993) D.J. Andrews 'Teaching Programming and Teaching Programming Languages', Workshop on the Choice of Programming Languages, British Open University, Milton Keynes, September 1993.
(Blaschek,1993) G. Blaschek 'Omega', Workshop on the Choice of Programming Languages, British Open University, Milton Keynes, September 1993.
(Bornat,1987) R. Bornat Programming from First Principles, Prentice-Hall International Series in Computer Science, 1987.
(Cater,1993) S. Cater 'Modula-2 as the First Programming Language: Five Years Experience', Workshop on the Choice of ProgrammingLanguages, British Open University, Milton Keynes, September 1993.
(Dijkstra,1993) E.W. Dijkstra 'A Discipline of Programming', Series in Automatic Computation, Prentice-Hall, 1976.
(Furber,1992) D. Furber 'A Survey of the Teaching of Programming to Computing Undergraduates in U.K. Universities and Polytechnics', The Computer Journal, Vol. 35, pp 530-533, 1992.
(Jones,1993) J. Jones and E. Pearson 'An Informal Survey of Initial Teaching Languages in UK University Departments of Computer Science', University Computing, vol 15, pp 54 57, 1993.
(Joslin,1993) D. Joslin 'Extended Pascal', Workshop on the Choice of Programming Languages, British Open University, Milton Keynes, September 1993.
(Lee,1993) P.A. Lee and R.J. Stroud 'C++ As an Initial Programming Language', Workshop on the Choice of Programming Languages, British Open University, Milton Keynes, September 1993.
(OU,1993) Workshop on the Choice of Programming Languages, British Open University, Milton Keynes, September 1993.
(Petre,1993) M. Petre 'Programming Paradigms and Programming Culture: Implications for Teaching', Workshop on the Choice of Programming Languages, British Open University, Milton Keynes, September 1993.
(Pronk,1993) K. Pronk and P.G. Kluit 'VDM-SL as a prelude to a language', Workshop on the Choice of Programming Languages, British Open University, Milton Keynes, September 1993.
(Rodinson,1993) P. Robinson 'From ML to C via Modula-3', Workshop on the Choice of Programming Languages, British Open University, Milton Keynes, September 1993.
(Traxler,1993) J. Traxler 'Initial Programming Language Choice: A Review of the Factors', Workshop on the Choice of Programming Languages, British Open University, Milton Keynes, September 1993.
(Weber,1993) M. Weber 'CooL (Combined object-oriented Language): An Overview', Workshop on the Choice of Programming Languages, British Open University, Milton Keynes, September 1993.
(Weedon,1993) R. Weedon 'Eiffel- A Pure OO Language for 'leaching', Workshop on the Choice of Programming Languages, British Open University, Milton Keynes, September 1993.
(Wichmann,1993) B. Wichmann 'Why Ada is For You', Workshop on the Choice of Programming Languages, British Open University, Milton Keynes, September 1993.