• We have updated the guidelines regarding posting political content: please see the stickied thread on Website Issues.

Any Programmers? Code Decay...

Breakfastologist

Gone But Not Forgotten
(ACCOUNT RETIRED)
Joined
Jul 31, 2001
Messages
916
I work as a web programmer and I have noticed that when I'm working on a complex site or application with a lot of code to it I will sometimes find that files that did work suddenly don't any more and when I look at them, it turns out they have somehow regressed to versions that are not only weeks out of date but could never have worked.

Its easy to think that there is some lame attempt at version control going on, but sometimes this happens on projects where I'm the only person dealing with the code and the versions that are regressed to are ones that no longer exist. It is frequently annoying and seems resistant to scrutiny- the more you watch for it the less it happens. It's like there are annoying pixies swapping files around when you're not looking.

We've coined the phrase "code decay" to describe this effect. I would be intrigued to know whether it happens to anyone else and, given that digital data clearly can't actually decay to older versions, any suggestions as to what is going on.
 
Maybe you should back everything up properly - to disk, to tape and to a remote location - and see if it still decays... if not, then you're sorted, and if one of them does decay, you can revert :p

Seriously though, if all three decayed, it would be a little odd.
 
I've occassionally thought I had something like that going on, but usually it turns out to be a brain-slip on my part. Like UFO reports, there is a miniscule residue of unexplained occurrances that could be something more.


What I usually refer to "code rot" is the seemingly natural state where what was originally simple clean code over time degenerates into a impenatrable snarl of spaghetti with the addition of new features and bug fixes. Short of ripping things out an starting fresh occassionally, I have not discovered a way to prevent this. It almost seems like entropy personified.
 
This is from The New Hacker's Dictionary:

bit rot /n./

Also bit decay. Hypothetical disease the existence of which has been deduced from the observation that unused programs or features will often stop working after sufficient time has passed, even if `nothing has changed'. The theory explains that bits decay as if they were radioactive. As time passes, the contents of a file or the code in a program will become increasingly garbled.

There actually are physical processes that produce such effects (alpha particles generated by trace radionuclides in ceramic chippackages, for example, can change the contents of a computer memory unpredictably, and various kinds of subtle media failures can corrupt files in mass storage), but they are quite rare (and computers are built with error-detecting circuitry to compensate for them). The notion long favored among hackers that cosmic rays are among the causes of such events turns out to be a myth; see the cosmic rays entry for details.

The term software rot is almost synonymous. Software rot is the effect, bit rot the notional cause.
 
I think it happens when your pure ones and zeros get contaimnated with twos.

In 15 years as a support programmer I've certainly seen the effect. It would explain why when I look at someone else's program my first reaction always seems to be "Who wrote this rubbish?"
 
Breakfast said:
I work as a web programmer and I have noticed that when I'm working on a complex site or application with a lot of code to it I will sometimes find that files that did work suddenly don't any more and when I look at them, it turns out they have somehow regressed to versions that are not only weeks out of date but could never have worked.

Hmmm. Not had that, but do have a lot of code that I once understood, but now when look at it don't have a clue how it works.

If your problem lessens with more scrutiny, that would suggest the errors are human and are simply mistakes, i.e. accidently copying over files etc.
 
If your problem lessens with more scrutiny, that would suggest the errors are human and are simply mistakes, i.e. accidently copying over files etc.
It may suggest that t o some people, but knowing that all my file handling skills are perfect :D it seems a lot more likely that the code is being tampered with by some sort of quantum-level entity that has it's waveform collapsed when people look at the area of the hard disk it is trying to attack.

Like UFO reports, there is a miniscule residue of unexplained occurrances that could be something more
That is exactly it- usually I can see how it could be me or one of my colleagues writing over stuff, but just sometimes it seems completely inexplicable.
 
Curiously, I've not encountered any code decay, but I've encountered several instances of code growth, where a program I've not touched for a long time has developed extra features, or something I left incomplete has mysteriously completed itself.

It may well be a poor memory in my case, but it always gives me a spooky feeling when it happens.

Perhaps it could be a form of instrumental transcommunication by deceased programmers, for those times when EVP just isn't good enough? ;)
 
I often come across this, or at least I did in Novemeber and December last year - only to discover it was a colleague who was leaving the company, and wanted to leave a "supprise"!!! Maybe thats the problem.... ;)
 
I have seen this effect; however, I've usually managed to trace it back to:

1) Too many files to keep track of

2) Coding whilst half-asleep -- cut-and-paste
operations result in very odd code when
one nods off for a moment in mid-operation,
and commands given at the terminal prompt
become exceedingly creative

Very rarely, and only if the problem appears on the server rather than on my local computer, the server has been backed up from an out-of-date tape after a catasrophic crash.

After many years, I've learned to annotate the #$% out of all my code and procedures. Now, when something seems to experience "code decay," I can at least find out what I was intending the code to do the first time.
 
Not code, but hardware, but still in the realm of digital stuff behaving in a completely non digital way...

Where I used to work we had several 'dev-kits' for a video game console. These were basically PC cards with the console hardware on them. We always had real difficulty getting them working when they arrived, we would plug them in - no response, plug them in and out, check connectors, get on the phone to the manufacturers etc., no luck. Eventually, after a day or so they invariably started to work.

We worked out that these cards needed a day to 'settle' into their new PC before they would work. From this point on whenever we got a new one we would plug it into the PC, it wouldn't work, calmly wait until the next day, try it again and it would always work.
 
Not sure of it's validity as a bone-fide theory but I love the idea of Entropy as applied to digital code.
 
Plainly weird

Just when I said that "code decay" can be attributed to known phenomena (i.e., sleepiness, bad backup tape, etc.) the following happens -- and it is very strange, indeed.

A couple of months ago, I wrote a Perl program that creates a table containing 9 lines for each date given (so if 3 dates are given, the table containes 27 lines).

This evening, I discovered each date in the table from last month contains 13 lines.

I compared the backup of last month's table to the copy on my computer: the files don't match. The copy on my computer has 13 lines per date -- the backup has 9 lines per date.

I ran the table-writing program, and discovered that, indeed, it writes 9 lines per date. The program never wrote 13 lines per date (although, as it turns out, the extra 4 lines are critical to another program).

I had to write new code in order to generate the extra 4 lines. I checked my logs and my procedural record -- the table-writing program never wrote 13 lines.

I can't explain what's going on here. What with a chapel seeming to have magically appeared along a road I travel frequently (see "Strange Room"), this week is starting out way too oddly.


:eek!!!!:
 
Back
Top