Part II: Modern Fortran Features
"Fortran is not dead. It is not even resting. It has simply been getting on with the work while everyone assumed the worst." — a sentiment common on the fortran-lang forum
If Part I could have been written (awkwardly) in FORTRAN 77, Part II could not. These are the features
that make Fortran a genuinely modern language: the ones added in the 2003, 2008, and 2018 standards, the
ones most tutorials skip, and the ones that turn a collection of subroutines into well-engineered
software. Modules replace the global chaos of COMMON blocks with real namespaces and explicit
interfaces. Derived types let you build your own data structures. Object orientation — yes, Fortran has
it — lets you write frameworks and abstractions. Pointers give you dynamic structures when you truly
need them, and the wisdom to prefer allocatable when you don't. And a proper approach to strings and
to error handling turns fragile programs into robust ones.
This is where your code stops looking like a translated physics equation and starts looking like software an engineer would be proud to maintain. It is also where the running project grows a spine: by the end of Part II your heat solver is split into clean modules, its data lives in a purpose-built derived type, and it validates its inputs and fails loudly and clearly when something is wrong.
What You Will Learn
Chapter 8 — Modules. The foundation of modern organization: use, public/private access,
submodules, and why modules retired COMMON and INCLUDE.
Chapter 9 — Derived Types. Build your own data structures, with components, type-bound procedures, and allocatable components.
Chapter 10 — Object-Oriented Fortran. Type extension, polymorphism, select type, and abstract
interfaces — and an honest account of when OOP helps scientific code and when it hurts.
Chapter 11 — Pointers and Targets. Pointer assignment, association status, dynamic structures, and
the case for preferring allocatable.
Chapter 12 — Strings and Text. Deferred-length characters, the string intrinsics, internal files, and text parsing — modern string handling versus the old fixed-length pain.
Chapter 13 — Error Handling and Debugging. iostat/stat/error stop, the debugging compiler
flags, gdb and valgrind, and the defensive patterns that keep numerical code honest.
How This Part Fits
Part II assumes all of Part I. Chapters 8 and 9 (modules and derived types) are load-bearing for the whole rest of the book — the numerical, performance, and parallel parts all organize code as modules operating on derived types. Object orientation (Chapter 10) and pointers (Chapter 11) are deeper and can be skimmed by the Scientist and HPC tracks on a first pass; error handling (Chapter 13) no one should skip.
Time Investment
| Chapter | Title | Difficulty | Est. hours |
|---|---|---|---|
| 8 | Modules | Intermediate | 5 |
| 9 | Derived Types | Intermediate | 5 |
| 10 | Object-Oriented Fortran | Advanced | 6 |
| 11 | Pointers and Targets | Advanced | 5 |
| 12 | String Handling and Text | Intermediate | 4 |
| 13 | Error Handling and Debugging | Intermediate | 5 |
| Part II total | ~30 hours |
Begin with Chapter 8: how modules replaced the global mess of COMMON and made large Fortran programs
maintainable.
Chapters in This Part
- Chapter 8: Modules — The Foundation of Modern Fortran Program Organization
- Chapter 9: Derived Types — Building Your Own Data Structures
- Chapter 10: Object-Oriented Fortran — Classes, Inheritance, and Polymorphism
- Chapter 11: Pointers, Targets, and Dynamic Data Structures
- Chapter 12: String Handling, Characters, and Modern Text Processing
- Chapter 13: Error Handling, Debugging, and Defensive Programming