- 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
Right on. It was in fact dumb in the first place to name it "bool" in C++. Saving some characters in source code (after all, "int" is one of the most frequently used types) stems from the 1970's when memory was counted in kilobytes and mass storage in megabytes (if at all...) As this is no issue any more, readability (as someone already stated above) is the main concern (and it certainly couldn't have been an issue any more in 1994 when the C++ standard was accepted!) Note that the wrapper classes for "int" and "char" (both legacy types from C/C++) are named "Integer" and "Character" in Java, not without good reason. I prefer verbosity versus "character saving" in source code any time...
Admin
.NET is good, but in a different way: it has Regular Expressions native support ;)
But so does Java - the language used to write the code that is commented here :D
So WTF didn't they use Regex ?? Just imagine the amount of time being saved when writing the code and also in program execution, if using Regex libraries instead of string manipulation routines. Example (a little bit over sized but very likely to occur in some places) ...
Suppose you want to do an insensitive search-and-replace for "MAIL" with "PHONE" in an 1,000,000 characters string, and the target string would appear from 0 to thousands of times. What to do ?? Find first all occurrences then iterate thousands of times to replace them all ? (note that the string changes after doing a replacement so the occurences positions might become invalid ;))
Don't think that the string manipulation is a real solution in this case ... Regex does this much cleaner and faster :)
Admin
It's actually a myth that using full sentences for variables names makes code more readable.
Admin
My experience with CDC machines was different. NOS on those machines used 6-bit characters for uppercase, and lowercase required two-byte (12-bit) shift codes. At 10 uppercase or 5 lowercase characters per machine word, words really were words. But then the CDC machines had no implementation of a character type in hardware, so all string manipulation was done with bit shifting operations.
It was about as hard to do case-insensitivity on those machines then as it is to do case-insensitivity with UTF-8 now.
Admin
and
I'm all for readability, but I don't think that saying "integer x;" instead of "int x;" would help one bit, in the same way that "boolean b;" wouldn't help at all over "bool b;". How long did it take you to learn those abbreviations and internalize them? A day?
Would you recommend removing the "float" type and renaming it "floating_point"? Or even better, rename "double" to "double_precision_floating_point_number"?
You're already essentially abbreviating things. You can't type out everything anyway, so it doesn't hurt to abbreviate things as long as the abbreviations are either standard or completely intuitive. In fact, at some point abbreviations start to help readability IMO, and they at least help save my wrists a tiny bit.
If you want to pick syntax gripes with C++, I can point you to plenty of places that make the difference between "bool" and "boolean", even if you DO still think it wasn't a good idea, look like having to choose between cookies and cream ice cream and chocolate chip cookie dough. Heck, I can point to plenty of places in straight C like that.
Addendum (2007-07-03 15:38): I just came up with another great idea. Let's petition the USPS to drop state abbreviations. After all, it's too confusing. "MO" is a much better abbreviation for "Montana" than "Missouri", "MI" seems to fit "Mississippi" better than "Michigan" (maybe "MG" for the latter would have been better), and I could make other changes.
It's best to leave that confusion behind us.
Admin
I've been writing Pascal for almost thirty years now (currently using GNU and Free Pascal in Mac OS X), am a stickler for formatting and style conventions, and have never heard of "Pascal Case."
Most Pascal coders I know name their variables "toLower" or "toUpper" or "PROCEDURE handMadeParser ( parseString );"
After looking it up, I find numerous references to it, but I've observed it--at least, in any codebase I've ever seen. Too restrictive. Too clunky.
Admin
There's worse. Check out Brainf*ck....
http://www.muppetlabs.com/~breadbox/bf/
Given the choice of writing in that or x86 machine code interfacing with the WinAPI... I'd never write code again.
Admin
You forgot to mention embed codes, which did something even weirder, they were doubly overstruck matching pairs of angle brackets and parentheses..
And the host system that PLATO ran on used the OPPOSITE character set convention, upper case letters were 6-bits, lower case ones were 12. Except for end-of-lines and colons, the rules for which are to horrible to repeat. Unless the file was 8-in-12 in which case all characters were 12 bits.
And what terminal did you have that had a cursor? PLATO terminals generally did not have cursors, as that was too hard to do on a plasma screen.