Experience of my first Fortran Course

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. :slight_smile:

Prehistory

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.

Preparation

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:

  1. Setting up a development environment for Fortran programming
  2. First steps with Fortran (hello world)
  3. Variable names (and implicit none)
  4. Numeric data types (up to here on day 1)
  5. Logical data type
  6. Character data type
  7. Loops (up to here on day 2)
  8. Branching
  9. Functions and subroutines (up to here on day 4)
  10. Modules and fpm test (up to here on day 5; day 6 I introduced garden by @everythingfunctional )
  11. Arrays (finished on day 8)
  12. Strings
  13. IO
  14. Derived data types and classes (started on last day)

Exam

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.

Feedback

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
  • Most liked

    • close to the practice
    • garden, fpm, stdlib
    • good structure
  • possible improvements

    • 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 associate.

Next steps

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.

My goal

  • 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

29 Likes

It sounds like you did a really good job, well done. And preparing materials for wider release is noble and generous.
Be careful about student feedback, it is full of noise and it is very easy to get the magnitude and sign of the gain wrong! But it is very important to keep records of what you tried and in response to which comments received.
But most of all, make it fun for you to teach, if you enjoy teaching the course it is very hard for students to not enjoy learning. This might be through some advanced topics, but I have also collaborated with colleagues so that there are “follow up” exercises buried in other modules of the degree orograme

2 Likes

Thank you!
Let’s put it like this: Making it fun to teach is necessary, but this alone is not sufficient for students to enjoy learning. Anyway, the students and I both had a great time, and I’m excited about the next time. :slight_smile:

1 Like

Great job. Glad you and the students enjoyed it. And thanks for introducing one of my packages.

As you prepare the materials for broader use, you may consider submitting to the Journal of Open Source Education:

2 Likes

+1

Great job @Carltoffel . Your idea to target programmers who already know at least one other language is good. Usually that means the students have some idea of serial execution.

Then, as I suggested here, starting right away with introducing SPMD parallel programming via coarrays in Fortran with simple examples such as what I pointed to you in this thread. It will be, I feel, the way to go.

That will be, as cliched in pop parlance, “inverting the matrix” for the students and really open their eyes and change their perception of Fortran entirely. You’ll be starting off where the future of coding lies which is mostly parallel programming and placing Fortran right in its midst for the students. You can then work your way down with (possible) concurrent execution (DO CONCURRENT), functional programming, object-oriented, modular programming and the structured coding aspects. You’ll knock them off their seats with what’s possible in Fortran!

2 Likes

I didn’t know what garden is, but I found it here: GitHub - everythingfunctional/garden: For a healthier code base, eat your vegetables

3 Likes