Rememberances of code past

I did work at a company where I was helping to port their product from MS-DOS to Unix. One of the mantras at the company was Thou shalt not change code! And they meant it. And it was taken to silly extremes.

One example: filenames. Under MS-DOS the case of a filename given to MS-DOS doesn't matter as MS-DOS will convert it to uppercase, so specifying README or readme gives you the same file. Unix though, is case sensitive so README and readme are two different files. The company decided that all filenames under Unix were to be lower case, but at various points in the code there might be a file specified all in upper case:


dbf=dbopen("BBSUERS.DAT");


What you could not do was change the case of the filename:


dbf=dbopen("bbsusers.dat");


No. That might break. How, I don't know. But the mantra was Thou shalt not change code! So the proper way to do it was:


#ifdef MSDOS
  dbf=dbopen("BBSUSERS.DAT");
#else
  dbf=dbopen("bbsusers.dat");
#endif


Which makes the code harder to follow. Forget:


#if defined(MSDOS)
#  define F_BBSUSERS	"BBSUSERS.DAT"
#elif defined (UNIX)
#  define F_BBSUERS	"bbsusers.dat"
#else
#  error Please define filename for system
#endif

...

dbf=dbopen(F_BBSUSERS);


That's a major code change (even though it doesn't clutter the code flow with compilation changes). I do think that the Unix manager did manage to get:


char c;


changed to


typedef unsigned char Char;

...

Char c;


But that may have been the only concession to Thou shalt not change code! that was made at the company.

For some reason, I'm reminded of this because of Joel. [1] Go figure.

[1] http://www.softwaremarketsolution.com/

Gemini Mention this post

Contact the author