1. 5
  1. 9

    Writing a four line program that performs a simple calculation is about equally easy in pretty much any programming language (excluding languages that are intentionally esoteric or special-purpose). A comparison like this really doesn’t tell you anything. Sure, a learner might wonder what float(...) is doing in the Python version. But the same learner might also wonder what the (*, *) is doing on read(*, *) and write(*, *) in the Fortran version.

    Ultimately, learning to program means learning some new stuff, but also realizing that there are certain things you may just need to accept for now and come to understand later. I think this article would have been more interesting if it focused on Fortran being less weird than people assume, rather than trying to argue that Fortran is somehow easier to learn than Python or Julia [1].

    [1] I’ll give you C because of pointers, although even then, the given example isn’t that bad.

    1. 4

      By this logic, BASIC is even better, because it doesn’t contain as much line noise and ceremony, and the entire program fits in 3 lines:

      10 INPUT "Height above sea level(m): ", HEIGHT
      20 DIST = SQR(2 * 6367.45 * (HEIGHT / 1000))
      30 PRINT "Distance to horizon = ", DIST, "km"
      
      1. 3

        I don’t find this piece convincing.

        The author says that

        program horizon
           real :: height, dist
           write(*,*) 'Height above sea level(m): '
           read(*,*) height
           dist = sqrt(2*6367.45*(height/1000.0))
           write(*,*) 'Distance to horizon = ', dist, 'km'
        end program horizon
        

        is easier to understand than

        import math
        height = float(input('Height above sea level(m): '))
        dist = math.sqrt(2*6367.45*(height/1000.0))
        print('Distance to horizon = ', dist, 'km')
        

        primarily because of the import statement and the cast to a float when reading input. I do not find the claim that real :: height is any more intuitive than height = float(input()) the least bit persuasive. Both will require the novice programmer to learn something outside the core formula, which seems to be what the author wants to avoid.

        This strikes me as more of a matter of taste than usability. And it is, naturally, fine to have preferences like this. But “I like that one better” doesn’t strike me as a strong reason to advance one over the other for teaching.