A Comparison of C, MATLAB, and Python as
Teaching Languages in Engineering
Hans Fangohr
University of Southampton, Southampton SO17 1BJ, UK
fangohr@soton.ac.uk
Abstract. We describe and compare the programming languages C,
MATLAB and Python as teaching languages for engineering students.
We distinguish between two distinct phases in the process of converting
a given problem into a computer program that can provide a solution:
(i) finding an algorithmic solution and (ii) implementing this in a particu-
lar programming language. It is argued that it is most important for the
understanding of the students to perform the first step whereas the actual
implementation in a programming language is of secondary importance
for the learning of problem-solving techniques. We therefore suggest to
chose a well-structured teaching language that provides a clear and in-
tuitive syntax and allows students to quickly express their algorithms. In
our experience in engineering computing we find that MATLAB is much
better suited than C for this task but the best choice in terms of clarity
and functionality of the language is provided by Python.
1 Introduction
Computers are increasingly used for a variety of purposes in engineering and
science including control, data analysis, simulations and design optimisation. It
is therefore becoming more important for engineering students to have a ro-
bust understanding of computing and to learn how to program. In this paper,
we outline the difficulties in learning and teaching programming in an acade-
mic context including the choice of the programming language. In section 2, we
suggest a distinction between the algorithmic problem-solving part of computer
programming and the efforts to implement the algorithm using a particular pro-
gramming language. In section 3, we describe and compare MATLAB, C and
Python as potential teaching languages and report our experience of them in an
Engineering Department in section 4 before we conclude.
2 Teaching Objectives
We understand the subject of “computing” to broadly represent the usage of
computers and numerical methods to solve scientific and engineering problems.
In the curriculum, we aim to go beyond the usage of dedicated software packages
and to enable students to write their own computer programs to provide insight
M. Bubak et al. (Eds.): ICCS 2004, LNCS 3039, pp. 1210–1217, 2004.
c
Springer-Verlag Berlin Heidelberg 2004