This post overlaps a little bit with the the previous one, recapping my programming history.
We ended the previous part in 2002 when I finished my Masters and started teaching, but I want to go into a little more detail on my history with scripting languages.
I encountered Matlab for the first time in my second year (in 1998) in a course called CRV220. I still have the study guide so I can say with confidence that we were taught a combination of Turbo Pascal and Matlab. At the time, the Turbo Pascal environment was much nicer than the Matlab one. Even though the Borland IDE was text-based, it had syntax highlighting and step-by-step debugging. It looked like this:
By contrast, in 1998 Matlab was in version 5.2 and looked like this:
We typed Matlab code into Notepad and executed it from this command window. The most impressive part of Matlab was that it could produce graphical output very easily. But the development environment was non-existent. It was, however, very clear that you could solve engineering problems using much less Matlab code than Turbo Pascal. Matlab was also the first language I encountered which had a REPL – you could type commands into the command window one at a time and see the result. I really liked this concept.
In 1998 also bought an HP 48 GL calculator and spent a lot of time programming it do solve problems like balancing chemical equations and so on. We were often allowed to use our calculators in tests, but they were often cleared before we wrote. The HP introduced me to the idea of stack-based languages.
In my final year (in 2000), we did our final year project calculations using a spreadsheet called Quattro Pro, since Excel had not yet achieved the dominant position it currently enjoys. We did not do much programming in our final year.
By the time I started my Masters in 2001, Matlab had just undergone a major rework in the release of version 6, moving to a Java-based workspace and for the first time Matlab was an IDE with an integrated code editor, debugging, and all the features from the Turbo Pascal IDE that I had missed when I first encountered Matlab. I found this new environment quite comfortable and used it happily throughout my Masters work. I used it to do the actual simulation and to produce all the graphs in my dissertation. But I had also bumped up against one of the things that Matlab was not very good at when I was writing the code to make the call graph I posted in the previous part: Matlab was really terrible at text processing.
By 2002 I was completely immersing myself in the Unix way. I had started to see the power of the “small tools doing one thing well” philosophy and spend a great deal of time reading the GNU Info pages for all the various unix tools while also learning about Richard Stalman and the Free Software movement. I was using Matlab on my Linux machine and learning bash. This is when I started learning Emacs, after reading In the beginning was the commandline where Neal Stephenson says the following about it:
“I use emacs, which might be thought of as a thermonuclear word processor. It was created by Richard Stallman; enough said. It is written in Lisp, which is the only computer language that is beautiful. It is colossal, and yet it only edits straight ASCII text files, which is to say, no fonts, no boldface, no underlining. In other words, the engineer-hours that, in the case of Microsoft Word, were devoted to features like mail merge, and the ability to embed feature-length motion pictures in corporate memoranda, were, in the case of emacs, focused with maniacal intensity on the deceptively simple-seeming problem of editing text.”
Teaching
In the first semester of 2002 I was the teaching assistant for CRV210 (the same subject where I had learned Matlab, now moved to the first semester). In the second semester I took over CMO320 (Mass transfer) from a lecturer who had moved to New Zealand. At this point I was done with my Masters and thinking of but had not yet enrolled for my PhD. I barely kept my head above water in that first semester, having to revise the material even as I taught it. In the second go around I started using more computer methods in my teaching, using Excel and Matlab to solve mass transfer problems.
As I did this, I started realising that our students were not well prepared to deal with computer solutions of these problems. I eventually moved over to teaching our computer course.
Other languages
I started evaluating different scripting languages which would be better at the kinds of string processing I had done for the call graph program and came across Perl and Python around this time. The earliest proper Python program I could find in my records was from 2004 and was for creating the same kind of file I used to do the call graph (the GraphViz package). I also learned the classic grep, sed and awk combination for text processing in Linux, motivated largely by reading “Unix Text Processing“
I picked up Fortran around 2005 as I started looking for ways to speed up my simulations. In the process I learned that modern Fortran was not at all like the FORTRAN 77 that people love to mock. It is a pretty decent language for numerical work. I learned R in 2007 while I was looking for better ways to handle statistical graphics. At that time R was the best language to learn for statistical work. Some might say it still is, even though Python has the big momentum for data science as of 2017.
Teaching programming
I settled on teaching Matlab with a strong focus on functional programming. I taught students to avoid scripts and write everything as functions, building functionality up slowly. I taught recursion and scoping before I even handled basic iteration (for loops). I think this made students understand functions a lot better, but it was an unpopular choice. My students tend to view programming more as a necessary evil than the transformative experience I found it to be. They want to solve problems and learn as little programming on the way to those solutions. This made my course feel hopelessly obtuse as I went over problems like computability and logic before simple things like solving a set of equations using the tools.
Moving from Matlab to open source and Python
Not long after I started teaching programming, it became clear to me that students were pirating Matlab at an alarming rate. Part of the problem was that the cheap student version could only handle small matrices. The problem actually became more pronounced after the Mathworks moved over to a more capable student version which required you to send in your proof of registration to get the student discount. Most students found it easier to crack a downloaded version than to deal with the paperwork of getting the student version. The university was also paying a large sum of money to retain Matlab licenses for the lab computers, and we calculated large costs for he research license which we would need to do actual research with Matlab instead of only using it for teaching.
I started gathering support for a move to Python. The first phase of this was to stop renewing our license for Matlab and move to Octave, an open-source reimplementation of Matlab. This allowed lecturers to retain their Matlab code and get used to a less featureful environment (we were back to a single window interface). CRV was taught for the last time in 2008. Our students started attending the MPR212 classes in 2009, which are now still taught to all the engineering students at UP. They moved to Python in 2013 and from Python scripts to Jupyter Notebooks in 2016.
The notebook revolution
Final word
Right now I feel like we made the right bet when we moved away from Matlab. Python is a much more general purpose language and has a large installed base. I think it is a better first language than Matlab and is something that you can see yourself using even when you go to industry. Of course Matlab hasn’t stood still, and is still one of the fastest ways to solve a problem if a toolbox exists for the field you’re in, but I haven’t felt the need to open much else than Python for a very long time.
I’m keeping an eye on Julia as a competitor to Python in the computational space, but so far it seems to lack critical mass. I’m also testing the waters on Rust as a replacement for Fortran for my high speed code, but it also has too little support for the well-established numerical libraries.
I think the last bit of my recap on history will be about simulation environments, moving from Simulink to Modelica, but this post is probably already too long.



