[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Say No to global-by-default
- From: Dirk Laurie <dirk.laurie@...>
- Date: Wed, 4 Jul 2018 23:21:56 +0200
2018-07-04 22:58 GMT+02:00 Jakub Jirutka <email@example.com>:
> Unfortunately, based on some replies in this ML, it looks like many
> people really don't understand problems that appear only when you have
> experience from working with someone else's code, trying to understand
> it, debug it or refactor...
I have substantial experience of that. For the first five years of my career,
I modified other people's Fortran 66 programs.
I had a boss who taught me that a specification without code is much better
than code without a specification, because you could always write a
program to match the specs but you could not guess what a badly written
program was supposed to do.
There was no such thing as an undefined name.
Global variables were achieved by COMMON statements. You simply
copied twenty lines of unreadable declarations to the top of every
subroutine, whether it used one or fifty of those names. Or none.
A typo in the name of a variable was by far the easiest mistake to find.
Following logic through goto statements, that was much harder.
What I learnt was that understanding and debugging someone else's
code is a PITA in any language, period. No amount of dollar signs on
global variables is going to change that.