The European Commission has just announced an agreement that English will be the official language of the EU, rather than German (the other possibility). As part of the negotiations, Her Majesty's Government conceded that English spelling had some room for improvement, and has accepted a 5-year phase-in of new rules which would apply to the language and reclassify it as EuroEnglish. The agreed plan is as follows:In year 1, the soft 'c' would be replaced by 's'. Sertainly, this will make the sivil servants jump with joy. The hard 'c' will be replaced by 'k'. This should klear up konfusion and keyboards kan now have one less letter. There will be growing publik enthusiasm in the sekond year, when the troublesome 'ph' is replaced by 'f'. This will reduse 'fotograf' by 20%. In the 3rd year, publik akseptanse of the new spelling kan be expekted to reach the stage where more komplikated changes are possible. Governments will enkourage the removal of double letters, which have always ben a deterent to akurate speling. Also, al wil agre that the horible mes of the silent 'e's in the language is disgrasful and they should eliminat them. By year 4, peopl wil be reseptiv to lingwistik korektions such as replasing 'th' with 'z' and 'w' with 'v' (saving mor keyboard spas). During ze fifz year, ze unesesary 'o' kan be dropd from vords kontaining 'ou' and similar changes vud of kors be aplid to ozer kombinations of leters. After zis fifz year, ve vil hav a reli sensibil riten styl. Zer vil be no mor trubls or difikultis and evrivun vil find it ezi to understand ech ozer....
ZE DRIM VIL FINALI KAM TRU
Requirements for copy routine...
Q. What do you mean by “copy”?
A. Ummm… copy the contents of the file to a new file.
Q. What about the date/time stamps?
A. No, those don’t need to be copied.
Q. Does the result file have to have the same name?
Q. Can it have the same name?
A. Umm… no.
Q. Do I have to worry about name spoofing? What about the Turkish I?
A. Don’t worry about that.
Q. Does it have to be in the same location? Note that if it is in the same location, it (probably) can’t have the same name. Unless you copy it to itself (another question…).
Q. What about the attributes?
A. Make the attributes the same.
Q. Should I modify the attributes of the source file? If this file copy is part of a backup or archive operation, it’d probably be a mistake to leave the “Archive” attribute on.
A. No, leave them as-is.
Q. What if the source file has the Archive attribute off? If I make it off on the new file as well, it could screw up the user’s backup software.
A. Just make it the same. I don’t care about the user’s backup software.
Q. Well, I’m not sure that’s the best approach to take when thinking about designing software FOR users, but if you say so.
Q. What about compression? It’s a file attribute, but the copy destination may not support compression.
A. Don’t compress the copy.
Q. Even if the source is compressed, and the destination supports compression?
Q. What about encryption? What if the source file is encrypted, but the destination does not support encryption?
A. Don’t encrypt the copy if the destination doesn’t support it.
Q. Mmmmm, sorry, don’t mean to digress, but… that could be a serious security hole. Especially if wherever this file copy function ends up supports arbitrary parameters (directly or indirectly).
A. Look, just copy the damn file.
Q. What about the file creator?
A. Don’t care.
Q. What about the file owner?
A. Don’t care.
Q. What about file permissions? Is there a separate way we should handle inherited permissions and assigned permissions?
A. Forget the permissions.
Q. What operating system will this function be required to run on?
A. Windows XP.
Q. Home, or Pro, or Media Center, or one or more?
Q. What service pack level are we aiming for?
A. Service Pack 2.
Q. Does that mean we don’t have to support any other SP level?
A. Yes, fine.
Q. How will the source file name be supplied?
A. As a parameter.
Q. Is it going to be supplied as a null-terminated string, a counted string, or an object?
A. Null-terminated string.
Q. Is it possible that a NULL pointer will be passed in?
Q. Is it possible that an empty string will be passed in?
Q. Is it possible that a malformed string will be passed in (e.g., no NULL terminator)?
Q. What encoding will the filename be in?
Q. Sorry, umm… Unicode is not an encoding, really. If we’re using Unicode data, it has to have a specific encoding, like UTF-8, UCS-2, UTF-16, etc.
A. Fine. Make it UTF-8.
Q. OK. I’d like to note at this point that it’s a bit of a pain to have to transcode UTF-8 to UTF-16 in order to be able to supply it to Windows API calls.
A. Fine! UTF-16!
Q. Big-endian or little-endian?
A. ARGH. Whichever you want!
Q. Should we accept relative paths, or only fully-specified paths?
A. Only full paths.
Q. Are there any characteristics of the paths we are supposed to accept that I can screen the parameters on?
A. No. The caller will do all screening of paths and file names.
Q. How will the destination file name be generated or supplied? ...
Q. Am I required to support (or allow) an asynchronous copy operation?
Q. How should I report errors? Exceptions? Error codes?
Q. Should I try and handle exceptions from called functions internally, or let them pass through to the caller?
A. Err… let them pass through.
Q. What if the destination file already exists?
A. It won’t.
Q. So the caller ensures that?
A. Right, sure.
Q. So if it does exist, I can just terminate the program, then? Obviously this would be a violation of preconditions, and who knows WHAT is going on.
A. Sure, whatever you want.
Q. What about alternate data streams?
A. Do whatever you want!
Q. Look, I’m sorry if you feel put-upon here, please don’t get hostile. I’m just trying to get a clear picture of the specs I need here. Obviously if I’m going to write a file copy method, instead of using one of the many extant file copy routines in various libraries and frameworks, it’s going to be fulfilling a specialized set of requirements, and I’m going to need to have good answers for these questions. If you want, I can hack something together in a minute, but I’d have to note that there were many unresolved issues as to requirements and purposes.
A. Just copy the damn file!!!!!!!!!!!!!!!!!