Matthias Noback
matthiasnoback.bsky.social
Matthias Noback
@matthiasnoback.bsky.social
https://matthiasnoback.nl

Work: Freelance programmer, trainer, writer, public speaker, consultant
Topics: object-oriented and Domain-Driven Design, architecture, refactoring, Test-Driven Development, pair/mob programming
Languages: PHP, Fortran
With 2 model kits in my portfolio it was time to start my own website/trademark! Noback Ship Models nobackshipmodels.com
October 6, 2025 at 7:53 AM
Reposted by Matthias Noback
Alright, let's make it official…

I am super-proud to tell you that I have finally published the print version of my book: "Legacy Code: First Aid Kit" 🎉 📕 🥲
September 17, 2025 at 2:14 PM
New #Fortran post: "Errors and error handling - Part 7 - Fatal errors" matthiasnoback.nl/2025/07/fort...

Almost everywhere in our code should we allow errors to bubble up to higher abstraction levels, until we get to the point that we'd like to terminate the program. How to do that properly?
Fortran - Errors and error handling - Part 7 - Fatal errors
Stop with error code, error message, and stack trace
matthiasnoback.nl
July 21, 2025 at 7:19 AM
New #Fortran post: "Errors and error handling part 6: Guarantees" matthiasnoback.nl/2025/07/fort...

If we want guarantees that data in a DT is correct, we have to use a custom constructor. Such a constructor then needs another Either return type so it can return a validated instance or an error.
Fortran - Errors and error handling - Part 6 - Guarantees
The Evidence Pattern
matthiasnoback.nl
July 18, 2025 at 7:00 AM
New #Fortran post: Errors and error handling part 5: Error propagation matthiasnoback.nl/2025/07/fort...

We redesign the error value so lower-level errors can be "wrapped" inside higher-level errors.
Fortran - Errors and error handling - Part 5 - Error propagation
Error propagation and nesting
matthiasnoback.nl
July 17, 2025 at 6:56 AM
New #Fortran post: "Errors and error handling - Part 4 - Using an Either type" matthiasnoback.nl/2025/07/fort...

We consider a problem that involves parsing and find a solution to deal with errors: a parse function that returns an "Either" type, containing an error, or the expected result.
Fortran - Errors and error handling - Part 4 - Using an Either type
Dealing with parse errors
matthiasnoback.nl
July 16, 2025 at 6:14 AM
New #Fortran post: Preventing edge cases with types matthiasnoback.nl/2025/07/fort...

We look at an alternative solution for calculating the average of an empty list; only offer such a procedure for a non-empty list.
Fortran - Errors and error handling - Part 3 - Preventing edge cases with types
An alternative: the non-empty list type
matthiasnoback.nl
July 15, 2025 at 7:50 AM
New #Fortran post: "Errors & Error Handling Part 2 - Optional Results matthiasnoback.nl/2025/07/fort...

Instead of returning a success flag and use an intent(out) argument to return the actual function result, we implement an optional return value using an abstract derived type and two subtypes.
Fortran - Errors and error handling - Part 2
Optional results
matthiasnoback.nl
July 11, 2025 at 7:14 AM
New #Fortran post "Errors and error handling, part 1: Exploration": matthiasnoback.nl/2025/07/fort...

The first part in a series about dealing with errors: we explore some common approaches and what their downsides are.
Fortran - Errors and error handling - Part 1 - Exploration
Exploring our options
matthiasnoback.nl
July 10, 2025 at 7:18 AM
One extra #Fortran post for today: "Functional Programming Concepts - Reduce" matthiasnoback.nl/2025/06/fort...

Having discussed filter and map which transform arrays into new arrays, we still need another function: reduce, which transforms arrays into single values.
Fortran - Functional Programming Concepts - Reduce
Reducing arrays to a single value
matthiasnoback.nl
June 30, 2025 at 12:06 PM
New #Fortran post: "Functional Programming - List Type" matthiasnoback.nl/2025/06/fort...

By introducing a list type we can bind the functional-style filter and map functions to a derived type, making it possible to "chain" multiple calls.
Fortran - Functional Programming - List type
Adding filter and map behavior to a list type
matthiasnoback.nl
June 30, 2025 at 7:35 AM
New #Fortran post: "Fortran - Functional Programming Concepts - Map" matthiasnoback.nl/2025/06/fort...

After discussing filter functions, now it's time to work no a map function.
Fortran - Functional Programming Concepts - Map
Transforming arrays
matthiasnoback.nl
June 28, 2025 at 8:47 AM
New #Fortran post: "Fortran - Functional Programming Concepts - Closures" matthiasnoback.nl/2025/06/fort...

Fortran doesn't have good support for higher-order functions and closures, can we replicate them?
Fortran - Functional programming - Closures
Generic filtering
matthiasnoback.nl
June 27, 2025 at 5:55 AM
New #Fortran post: "Functional Programming Concepts - Generic filtering" matthiasnoback.nl/2025/06/fort...

Fortran doesn't support generics, which would allow us to reuse the same filter function for arrays of different types of values. In this post we'll explore a work-around for this problem.
Fortran - Functional Programming Concepts - Generic Filtering
Filtering arrays with other value types
matthiasnoback.nl
June 26, 2025 at 7:16 AM
New #Fortran post: "Fortran - Functional Programming Concepts: Filter" matthiasnoback.nl/2025/06/fort...

Having looked at Object-Oriented programming concepts in Fortran, we now dive into Functional programming concepts. We start with filtering arrays of integers.
Fortran - Functional Programming Concepts: Filter
Introducing functional programming in Fortran with filtering integers
matthiasnoback.nl
June 25, 2025 at 10:24 AM
New #Fortran post: "Enumeration, part 3" matthiasnoback.nl/2025/06/fort...

It's surprising how much there is to explore about enumeration types, but here we are with the final part: we further improve the design by making log level an abstract type, and all the concrete levels subtypes.
Fortran: Enumeration, part 3
Adding more behavior and introducing enum subtypes
matthiasnoback.nl
June 20, 2025 at 7:09 AM
New #Fortran post: "Enumeration, part 2" matthiasnoback.nl/2025/06/fort...

We increase type safety by narrowing the integer level argument to a derived type argument. A new factory type helps us separate responsibilities. Finally we compare levels using operator overloading.
Fortran: Enumeration, part 2
Type safety, a log level factory, and operator overloading
matthiasnoback.nl
June 19, 2025 at 7:38 AM
New #Fortran post: "Fortran: Enumeration, part 1" matthiasnoback.nl/2025/06/fort...

We are refactoring the integer parameters for the various log levels that we want to support. We want to accomplish type-safety and ease-of-use (pun intended).
Fortran: Enumeration, part 1
In the post about decoration we declared log levels as follows: module logging_base ! ... integer, parameter, public :: LOG_DEBUG = 0 integer, parameter, public :: LOG_INFO = 1 integer, parameter,…
matthiasnoback.nl
June 18, 2025 at 8:58 AM
New #Fortran post: "Module Design" matthiasnoback.nl/2025/06/fort...

We splitt an existing module into smaller modules and put a façade module in front of the smaller ones, so users only have to deal with a simple programming interface. Finally we fix compilation cascade with a submodule.
Fortran: Module Design
Fortran projects are famous for their large modules. Actually, we may also find very large files in legacy projects written in other languages, like Java, PHP, etc. These projects sometimes have…
matthiasnoback.nl
June 12, 2025 at 10:23 AM
New #Fortran post: Service Composition, part 2: Decoration matthiasnoback.nl/2025/06/fort...

In this post we explore another way of composing abstractions, which is called decoration. We prefix existing log messages with a timestamp and implement optional delegation based on a configured log level.
Fortran: Service Composition, part 2: Decoration
In the previous post we saw how to use an abstraction to compose an aggregation of services of that same abstraction. There we simply delegated a call, adding no specific behavior. But we might as…
matthiasnoback.nl
June 11, 2025 at 1:53 PM
New #Fortran post "Fortran: Service Composition, part 1: Aggregation" matthiasnoback.nl/2025/06/fort...

We are ready to build more features into the logging library, using different styles of composition. First we look at aggregation.
Fortran: Service Composition, part 1: Aggregation
With our new service abstraction logger_t we are able to easily implement more features for our logger. We can do this without affecting current user code, because their code relies only on the…
matthiasnoback.nl
June 10, 2025 at 7:06 AM
New #Fortran post: "Abstract Types and Deferred Procedures" matthiasnoback.nl/2025/06/fort...

We define an abstract type with deferred procedures (in OO language: an interface) for the file logger. Introducing an abstract factory allows clients to decouple and shows us how polymorphism works.
Fortran: Abstract Types and Deferred Procedures
With the new file_logger_t type we were able to model a logger service as a derived type. Now it’s time to make the service abstract. That is, to leave out the implementation detail that it’s a file…
matthiasnoback.nl
June 9, 2025 at 8:18 AM
New #Fortran post: "Modeling Services as Derived Types" matthiasnoback.nl/2025/06/fort...

Derived types (DTs) can also be used for "service objects". We look at a safe refactoring from module state and subroutines to a DT with a data component and a type-bound procedure.
Fortran: Modeling Services as Derived Types
We’ve seen how to define a derived type to represent a point in 2D space. We were able to add a type-bound procedure to it, and finally to make its components private and define a custom constructor…
matthiasnoback.nl
June 5, 2025 at 8:04 AM
New #Fortran article: "Private Data Components and Custom Constructors" matthiasnoback.nl/2025/06/fort...

We make the data inside the derived type private (encapsulation), offer alternative ways for creating new instances (factory functions), and expose these alternatives as an abstract function.
Fortran: Private Data Components and Custom constructors
In the previous post we have worked on the point_t derived type, turning the module procedure distance into a type-bound procedure: module geometry ! ... type :: point_t real :: x real :: y contains…
matthiasnoback.nl
June 4, 2025 at 7:33 AM
New #Fortran post: "Type-bound Procedures" matthiasnoback.nl/2025/06/fort... These are the equivalent of class methods, but can surprisingly still be used as regular functions.
Fortran: Type-bound Procedures
In the previous post we defined a derived type point_t with real data components x and y, to represent a point in 2D space. We also wrote a function to calculate the distance between two such points:…
matthiasnoback.nl
June 3, 2025 at 8:39 AM