[mercury-users] Records

Fergus Henderson fjh at cs.mu.OZ.AU
Fri Nov 5 15:27:57 AEDT 1999


On 05-Nov-1999, Richard A. O'Keefe <ok at hermes.otago.ac.nz> wrote:
> Concerning field operators, why has no-one suggested the COBOL/Algol 68
> approach?  Instead of
> 
> 	Object <some strange symbol> FieldName
> 
> how about
> 
> 	FieldName of Object

I used to work with a group of COBOL programmers once; they disliked that
syntax so much that they did not use it, even though using it would have
made their programs much easier to maintain.  They preferred to write

	DATA DIVISION.
	WORKING STORAGE SECTION.
	01  WS-EMPLOYMENT-RECORD.
	    03  WS-EMPLOYMENT-START-DATE.
	        05  WS-EMPLOYMENT-START-YEAR    PIC 99.
	        05  WS-EMPLOYMENT-START-MONTH   PIC 99.
	        05  WS-EMPLOYMENT-START-DAY     PIC 99.
	    03  WS-EMPLOYMENT-END-DATE.
	        05  WS-EMPLOYMENT-END-YEAR      PIC 99.
	        05  WS-EMPLOYMENT-END-MONTH     PIC 99.
	        05  WS-EMPLOYMENT-END-DAY       PIC 99.

	PROGRAM DIVISION.
	...
	IF WS-EMPLOYMENT-START-YEAR < WS-EMPLOYMENT_END_YEAR ...

rather than

	DATA DIVISION.
	WORKING STORAGE SECTION.
	01  WS-EMPLOYMENT-RECORD.
	    03  START-DATE.
	        COPY "DATE.WS".
	    03  END-DATE.
	        COPY "DATE.WS".

	PROGRAM DIVISION.
	...
	IF MONTH OF START-DATE OF WS-EMPLOYMENT-RECORD <
	   MONTH OF END-DATE OF WS-EMPLOYMENT-RECORD ...

When I suggested that they use the second style, they complained about
the verbosity of the "OF" syntax, saying that COBOL was already
excessively verbose and that using "OF" would make it unbearable.

But I guess these programmers were just not much keen on abstraction.
Yes, their Y2K costs were rather high.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list