Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Here's an "interview question" that while ostensibly about hardware really does inform a software design principal as well.

Computers used to (still do I guess, somewhere) use magnetic tape reels to store data. There was a plastic accessory you could attach to a tape reel called a "write-enable ring". If the tape had such a ring, the tape drive allowed writing to the tape... if not, it only allowed read access.

Why was the choice to design the system in this way? Why not have a "write protect ring" instead, with the opposite effect?

share|improve this question
2  
Just get up and walk out of the interview. –  kirk.burleson Jan 11 '11 at 13:18
5  
@kirk.burdeleson - Why? It's an interesting question with significant parallels in software development (that is that all defaults should be non-destructive). People on here push the quit/walkout button really quickly but it's almost always a non-optimal move, certainly in the first instance (and usually in the second and third instances too). –  Jon Hopkins Jan 11 '11 at 13:26

3 Answers 3

You want all "destructive" actions to be the result of a concious decision by the operator. You never want something "destructive" to happen by accident (as much as possible, anyway). So you make the ring a "write-enable" so that it requires a concious decision by some one that they want to destroy whatever contents is currently on the tape by adding the ring. If they forget to add the ring, the worst that'll happen is they'll get a "tape cannot be written to, it's not write-enabled" error message. If it was a "write-protect" ring, then worst that can happen is someone forgets to add the ring and overwrites critical data by accident.

It's a similar situation if you're programming a dialog box (say). Generally, you make the default button the "least destructive" action. For example, if you have a "Do you want to save before quitting?" dialog box, the options are "Save", "Don't Save" and "Cancel" - with "Cancel" the default. If someone just blindly hits "enter" then the program does the least destructive thing: doesn't save, and doesn't quit without saving.

Another analogy with web programming: you always put a "destructive" operation behind a POST (or DELETE or other non-GET) request. The idea is that if a bot comes along and crawls your site, you don't want it accidentally deleting posts or clearing data just by issuing GET requests: the destructive stuff is only initiated by a concious action by a human.

share|improve this answer
    
I notice that your answer and Dan McGrath's answer are exact opposites! From your POV, It doesn't matter whether the there's a write enable ring or a write protect wrong, so long as the tape is shipped in write protect mode. (If it's more convenient for the manufacturer to ship one piece of plastic, and you disconnect it to change the protection, then by your reasoning, it should be a write-protect ring.) –  Ken Bloom Jan 11 '11 at 4:31
1  
Affirmative action required for destruction is always the way to go. –  Dan McGrath Jan 11 '11 at 4:33
1  
Ken, that assumption only holds if the manufacture is shipping with data on the media. If you assume the manufacture ships blank media, then it doesn't necessitate this be the case since no 'destructive' action can occur regardless of the write-protect settings. –  Dan McGrath Jan 11 '11 at 4:37
    
Also, it is easy for the ring to fall off then it is to, errr, fall on(?). This would make the write-enable ring be a better solution even taking into account Dean's great answer. –  Dan McGrath Jan 11 '11 at 4:41
1  
@Dan McGrath: "it is easy for the ring to fall off then". Nope. They had to be mushed into a slot on the tape reel. You often had a hook or a small box where you kept them. And the folks that "hung tapes" were disciplined about pulling rings out of every tape that got unmounted. Or they got fired. –  S.Lott Jan 11 '11 at 12:26

Generally, you want to write to something before you make it read only.

Doing it this way allows you to have the ring built on it during the manufacturing process, then manually remove (and discard) once you have written to it.

Doing it the other way means they need to distribute 2 separate parts to start with, then attach something the first time you need to use it.

share|improve this answer
3  
This is another good point. I remember VHS tapes worked the same: you remove the little tab to make it read-only (and put electrician's tape on to make it writeable again...) –  Dean Harding Jan 11 '11 at 4:21

This is an example of "fail safe" design. This is where is something breaks or loses power the system goes to a state where (theoretically) nothing bad can happen.

If the ring should fall off, the tape is now write protected and can't be overwritten.

It takes a conscious thought and a check to ensure that the tape can be put into a "destructive" mode.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.