PDA

Ver la Versión Completa : Mitos que los programadores creen sobre el tiempo


mamcx
24-01-2013, 00:04:10
Re-encontre este articulo, el cual expone alguna suposiciones erradas a la hora de manipular el tiempo en los programas:

http://infiniteundo.com/post/25326999628/falsehoods-programmers-believe-about-time



There are always 24 hours in a day.
Months have either 30 or 31 days.
Years have 365 days.
February is always 28 days long.
Any 24-hour period will always begin and end in the same day (or week, or month).
A week always begins and ends in the same month.
A week (or a month) always begins and ends in the same year.
The machine that a program runs on will always be in the GMT time zone.
Ok, that’s not true. But at least the time zone in which a program has to run will never change.
Well, surely there will never be a change to the time zone in which a program hast to run in production.
The system clock will always be set to the correct local time.
The system clock will always be set to a time that is not wildly different from the correct local time.
If the system clock is incorrect, it will at least always be off by a consistent number of seconds.
The server clock and the client clock will always be set to the same time.
The server clock and the client clock will always be set to around the same time.
Ok, but the time on the server clock and time on the client clock would never be different by a matter of decades.
If the server clock and the client clock are not in synch, they will at least always be out of synch by a consistent number of seconds.
The server clock and the client clock will use the same time zone.
The system clock will never be set to a time that is in the distant past or the far future.
Time has no beginning and no end.
One minute on the system clock has exactly the same duration as one minute on any other clock
Ok, but the duration of one minute on the system clock will be pretty close to the duration of one minute on most other clocks.
Fine, but the duration of one minute on the system clock would never be more than an hour.
You can’t be serious.
The smallest unit of time is one second.
Ok, one millisecond.
It will never be necessary to set the system time to any value other than the correct local time.
Ok, testing might require setting the system time to a value other than the correct local time but it will never be necessary to do so in production.
Time stamps will always be specified in a commonly-understood format like 1339972628 or 133997262837.
Time stamps will always be specified in the same format.
Time stamps will always have the same level of precision.
A time stamp of sufficient precision can safely be considered unique.
A timestamp represents the time that an event actually occurred.
Human-readable dates can be specified in universally understood formats such as 05/07/11.

mamcx
24-01-2013, 00:10:54
Diantre, y uno sobre mitos sobre nombres:

http://www.kalzumeus.com/2010/06/17/falsehoods-programmers-believe-about-names/


People have exactly one canonical full name.
People have exactly one full name which they go by.
People have, at this point in time, exactly one canonical full name.
People have, at this point in time, one full name which they go by.
People have exactly N names, for any value of N.
People’s names fit within a certain defined amount of space.
People’s names do not change.
People’s names change, but only at a certain enumerated set of events.
People’s names are written in ASCII.
People’s names are written in any single character set.
People’s names are all mapped in Unicode code points.
People’s names are case sensitive.
People’s names are case insensitive.
People’s names sometimes have prefixes or suffixes, but you can safely ignore those.
People’s names do not contain numbers.
People’s names are not written in ALL CAPS.
People’s names are not written in all lower case letters.
People’s names have an order to them. Picking any ordering scheme will automatically result in consistent ordering among all systems, as long as both use the same ordering scheme for the same name.
People’s first names and last names are, by necessity, different.
People have last names, family names, or anything else which is shared by folks recognized as their relatives.
People’s names are globally unique.
People’s names are almost globally unique.
Alright alright but surely people’s names are diverse enough such that no million people share the same name.
My system will never have to deal with names from China.
Or Japan.
Or Korea.
Or Ireland, the United Kingdom, the United States, Spain, Mexico, Brazil, Peru, Russia, Sweden, Botswana, South Africa, Trinidad, Haiti, France, or the Klingon Empire, all of which have “weird” naming schemes in common use.
That Klingon Empire thing was a joke, right?
Confound your cultural relativism! People in my society, at least, agree on one commonly accepted standard for names.
There exists an algorithm which transforms names and can be reversed losslessly. (Yes, yes, you can do it if your algorithm returns the input. You get a gold star.)
I can safely assume that this dictionary of bad words contains no people’s names in it.
People’s names are assigned at birth.
OK, maybe not at birth, but at least pretty close to birth.
Alright, alright, within a year or so of birth.
Five years?
You’re kidding me, right?
Two different systems containing data about the same person will use the same name for that person.
Two different data entry operators, given a person’s name, will by necessity enter bitwise equivalent strings on any single system, if the system is well-designed.
People whose names break my system are weird outliers. They should have had solid, acceptable names, like 田中太郎.
People have names.