- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Someone needs to make a joke about "Irish Girl"'s "Pi".
Admin
In Ancient Greece, pi was 5 or 80. The Ancient Greeks used letters for numbers, like the Romans did. Capital pi was used for 5 and lower case pi (with the symbol ʹ after it to indicate it was a number and not a letter) was used for 80.
See http://en.wikipedia.org/wiki/Greek_numerals
Admin
At least, today (3/14) is the π-Day: http://www.exploratorium.edu/pi/
Admin
Pie XII was a pope (french pronounciation) http://en.wikipedia.org/wiki/Pope_Pius_XII
Admin
Admin
THAN! THAN! not THEN! Using comparatives goes with THAN. Using time goes with THEN.
AAAAAAAAARRRRRRGGGGGHHHHHH!
(ok, I'll try to calm down now.)
Admin
Have you ever seen a plausible use-case that involves naked constants representing state and does not involve the state machine itself? I have, and they're horrible designs.
If you have to use Java, at least work with its ability to hide attributes/constants such as READY and ACTIVE within the class foo. Conceptually, they have no meaning outside that class. Why leak them and pollute other name-spaces?
Having replaced "acceptable" with "manageable," can we now agree to replace "manageable" with "sensible"?
Addendum (2008-03-14 14:40): OK, I've taken a cold shower and I understand your point. I'll try to restate mine:
Code should be written, as far as possible, to assist comprehension by the reader. (Well, that's APL out, for a start, then.) There are any number of war stories in C/C++/other languages where importing the wrong header can silently change the meaning of TRUE or FALSE. After being burned often enough, people tend to avoid this sort of confusion.
I suggest that "DTD" and "XML" are reasonably constrained names, given the semantics of what you are doing.
I suggest that "PI" is not -- even if it's buried in the middle of a class, as a local, finalized, variable.
I suggest that any normal person, looking at a class that uses "ACTIVE" and "READY", would think "Aha! State machine!."
They would be unlikely to think of probiotics (for the first one) or (ahem) the Irish Girl reclining on a futon for the second one.
There are a million and one alternatives to PI, encapsulated or otherwise. There are rather less alternatives to "XML", "DTD", "READY" or "ACTIVE".
To quote Chinua Achebe, "Things fall apart." Try to avoid this propensity.
Admin
Unfortunately that is the name defined in the XML standard ( See: http://www.w3.org/TR/REC-xml/#sec-pi ). Naming the constant anything different could cause confusion for those familiar with the XML standard.
I still only see a WTF in that the poster didn't have the curiosity to figure out what it was. (Or that he just thought it was funny so he'd post it here.)
Admin
That's nice, and irrelevant. The class in question deals with HTML, and not XML.
(And, no, it's not even a general SGML parser. If you check out the GNU Classpath documentation on the class they point out that a large number of constants within the DTDConstants class aren't actually used for anything. But they were in the standard API once, and due to Sun's refusal to ever break backwards compatibility with anything except JDBC, they'll be in there forever.)
Admin
[quote user="real_aardvark"]If you have to use Java, at least work with its ability to hide attributes/constants such as READY and ACTIVE within the class foo. Conceptually, they have no meaning outside that class. Why leak them and pollute other name-spaces?[//quote] You mean, like: if(myobj.getState() == MyClass.READY){...}
[quote]I suggest that "DTD" and "XML" are reasonably constrained names, given the semantics of what you are doing.
I suggest that "PI" is not -- even if it's buried in the middle of a class, as a local, finalized, variable.[/quote]
From my perspective, the value judgement is different. It's more important for users of the class to have a consistent set of names which corresponds to the existing XML literature. Replacing PI with, say "PROC_INST" while preserving the other names would be bad, as would renaming all of the constants to customized versions.
[quote]I suggest that any normal person, looking at a class that uses "ACTIVE" and "READY", would think "Aha! State machine!."[/quote]I happened to vaguely have an object representing a network client in a NIO system in mind, actually.
[quote]To quote Chinua Achebe, "Things fall apart." Try to avoid this propensity.[/quote] I have to admit I didn't really enjoy that book.
Admin
I believe 12 is referring to the length of the value, not the value itself.
Admin
Briefly: (1) PI is instantly recognisable to the general public and to otherwise ignorant math guys, any of whom might be expected to use computers. Do not cause brain-fart on this one unless absolutely necessary. (2) DTD and XML are instantly recognisable to programmers. I find it hard to believe that anybody would be so obtuse as to re-use them in the middle of a library/massive great jar construct, but I could be wrong. A different case, I think. (3) The existing XML literature is wrong. Wrong! goddamnit!
Well, (3) might need a bit of justification. Given that I assume that nobody in their right minds would misuse PI as a constant that refers to anything other than π, then you can apply my grumpy old man attitude just as much to the XML standards as you can to these interminable Java packages.
As in "(so) client does not see (NIO-created) socket close with SO_TIMEOUT ... Category java:classes_nio"? Aha! State machine! My rates are quite unreasonable. Well, at least you've read it, which diggs you way up in my estimation. Even knowing who he is makes you a +1 with gold star and, probably, purple colon.Actually, I rather enjoyed it until the end, which I thought was a bit of a cop-out.
Admin
Admin
0 = no 1 = yes 2 = maybe
havent you heard of fuzzy logic??
Admin
Hum... since this is part of the DTD class, maybe it is short for Processing Instruction (PI is actually a common abbreviation for this in the DTD/XML world). Mystery solved, maybe you should do some research before condemning things you dont understand. ;-)
Admin
But anyhow, thanks for the pointless input. Come back and see us soon!
Admin
PI = Processing Instruction 12 = Ordinal number of the Procesing Instruction token
(there is a list of tokens, in what it seems to be a parsing program)
where is the wtf?
Admin
Disregarding that this wasn't even about the mathematical PI, in the context of my integer-based geometry class for one project, i defined PI within that module as 512. I don't see what's wrong with that. Namespaces, man.
Admin
Oh my... this post is a total disgrace...
Admin
1 Kings 23 "Now he made the sea of cast metal ten cubits from brim to brim, circular in form, and its height was five cubits, and thirty cubits in circumference. "
The "circular in form" is the relevant phrase here.
And I'm not sure how 1 Kings 26 "It was a handbreadth thick, and its brim was made like the brim of a cup, as a lily blossom; it could hold two thousand baths," is supposed to improve the situation. If I take something circular in form 10 cubits across (circumference of 31.4... cubits), and deform the circle to be lily-shaped but still 10 cubits across, then the perimeter will get longer, not shorter.
Admin
The sea (basin) measured 10 cubits (180 inches) from rim to rim and 30 cubits (540 inches) measured its circumference, according to I Chron 4:2. According to I Chron 4:5, it was a handbreadth (4 inches) thick. If you assume "rim to rim" to be the outer dimension and 30 cubits' circumference to be around the inside of the top edge, those numbers work perfectly. Certainly the,engineers and scribes of Solomon's day knew pi wasn't 3. Nor did they try to declare it so.
Admin
the,engineers -> the engineers (darn phone). 180 - (540/3.14) = 8 = 2 handbreadths. Q.E.D.
Admin
"I Chron" -> "II Chron." I shouldn't post late at night.