A year ago I announced that I would take over a Fortran lecture at my local university.
This lecture ended roughly one month ago, and I want to share my experience with you. Additionally, I would like to give an outlook what my plans are for the future.
tl;dr: I gave a Fortran course which was nice.
Short introduction, why I ended up taking over this lecture:
I studied Scientific Programming B.Sc. at the Fachhochschule Aachen (University of Applied Sciences), which also had an elective subject: Fortran. The professor for this course retired, and the exercise leader also devoted herself to other projects.
Since there was no person responsible for the Fortran course any more, I offered to assume it. Last year I lead only the exercises, but this year I was responsible for everything.
I wasn’t very well prepared for the course because for a very long time I didn’t know where to start and how to build the course material. In the end, I created slides with Jupyter Notebook. Thanks to Rise and a Fortran Jupyter kernel, I was able to create an interactive presentation with executable code blocks. This was really nice, and the students very much liked it. I wish I had also had the content in text form, as a handout and for self-study, but I had too little time. Instead, I exported the notebook as a PDF and the students said it was enough.
Structure of my course
The course takes place between the winter and summer semesters, 10 dates of 6 h each, and has usually a dozen participants.
I could have done the course the same way as the years before, but I don’t like lectures on programming languages with too much theory (it was 50/50). So, I decided to do as many exercises as possible.
The course ended up being roughly 10% lecture (me explaining a new feature, e.g. modules) and the rest were exercises.
The first lesson was a bit different because I gave a brief introduction to Fortran (features, history, etc.).
After this, we directly started with exercises: The first task was to create a new fpm project and change the output to “Hello, world!”. Then I asked them to try to minimize the code length for the hello-world program. This turned out to be a great idea. It allowed the students to try things out and get a first feeling for possible compiler errors. At this point, they didn’t know a single Fortran keyword.
Then I introduced variables, data types, operators and all the other low-level basics. I always introduced a feature or concept and gave some tasks to try it out.
The chapters were structured like this:
- Setting up a development environment for Fortran programming
- First steps with Fortran (hello world)
- Variable names (and implicit none)
- Numeric data types (up to here on day 1)
- Logical data type
- Character data type
- Loops (up to here on day 2)
- Functions and subroutines (up to here on day 4)
- Modules and
fpm test(up to here on day 5; day 6 I introduced garden by @everythingfunctional )
- Arrays (finished on day 8)
- Derived data types and classes (started on last day)
When I was a student, I hated written exams for programming languages because they do not reflect the real requirements of a programmer. IRL I can look things up on the internet, check compiler errors etc. All this doesn’t work when writing code on paper, which is painful on its own because you cannot easily insert lines you forgot.
Therefore, I tried to build more realistic general conditions: I asked my students to work on a Fortran project in small groups. For appropriate and fair individual grading, we finally had an oral exam where each student had to present the features of their project and I asked questions about the project and Fortran in general.
Here is some feedback I received from the students. It also contains some thoughts about Fortran in general:
Most important knowledge and skills
- efficiently working with arrays
- modern features (e.g. fpm, garden)
- Fortran is fast / sometimes hard to read
- close to the practice
- garden, fpm, stdlib
- good structure
- faster pace
- additional tasks for at home
- arrays earlier
- basics too long/detailed because they are known from previous programming languages
- more focus on complex topics like coarrays
Especially the opportunities for improvement are very valuable for me. I definitely want to have more time for the advanced topics and spend less time on the basics. Furthermore, I think I should introduce static arrays alongside data types to ease some tasks where many similar variables are needed which would perfectly fit into arrays instead of
sum1, sum2, ... sum9.
Someone mentioned that Fortran can be unreadable. I guess this results from some tasks with implied-do loops because they can indeed quickly become a bit messy. Next time I will pay more attention to this.
Finally, I have to rethink what I tell about pointers and put more focus on
The course was taught in German, but I aim to rebuild the entire course carefully in English. From there, I would like to see it getting translated into as many languages as possible.
I think the best thing would be to target programmers who already know at least one other programming language. Later, the course could be extended by a beginners’ chapter, which aims for people willing to learn Fortran as their first programming language.
- course material for self-study and slides for teaching by the end of this year
- content with broad acceptance of the community (best practices etc.), I will do all work on GitHub and ask for your opinion
- course material = full text, using Sphinx with translation tool
- slides = jupyter-notebook or maybe more options
Edit: Added link to “garden” repository