- 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
Truly old C compilers/linkers required identifiers to be unique within the first 8 characters.
Admin
bool Underscores_are_close_enough_and_currently_supported_by_many_languages = true;
Admin
Man, I am old.When I was young we bitched about Cobol and stupidly verbose it was.....
Admin
retard
Admin
You would never know if it "truly works", BECAUSE YOU COULD NEVER FUCKING READ IT DIPSHIT.
Admin
[quote user="JohnB"]The real WTF: people complaining about naming conventions in an application that truly works.[quote]
That is NOT TRWTF. The RWTF is that you are complaining about people criticizing code on a code-criticism site. Get lost.
Admin
I'll stand by this as decent code. Yes it is a little long in the names, but it is much much better than short names. MUCH better. The trouble with actual comments is they don't get updated. I must admit I would err on the side of this code than not descriptive enough. I would probably try to shorten it down just a tad, but that is readable code.
Admin
Algol 60 did();
Admin
For God's sake just write it in COBOL!
The source code files will be smaller!
Admin
It is possible to write code that doesn't go straight to either extreme. One character variable names and these variable names are equally bad.
Admin
Easy peasy. Just do it in FORTRAN.
Admin
Admin
Danish is a sort of Germanic language too. Here is one "word" that we use to teach our kids.
Sporvognsskidtskinneskraberoverassistentskastetemblemspudsemiddelsdåse.
Translating each word it says Tram Dirt Removal Track Remover Super Intendent Cap Decoration Polishing Stuff Container.
And, obviously, its the container where the superintendent in charge of keeping the tracks of the tram clean of dirt, keeps his polisher for the decoration on his cap.
Its not a word used very often.
Admin
Actually, in order to incorporate the meaning of life, it should be called "defaultSizedIntegerVariableIndexingIntoEmployeesVectorWhichIsAVectorOfEmployeeRecordsEachOfWhichContainsPersonalInformationSuchAsFirstNameLastNameDateOfBirthAndRegisteredResidenceAsWellAsProfessionalInformationSuchAsJobTitleAndSalary_ThisVariableWasAddedByChiefSoftwareArchitectJohnDoeOnTheEveningOfWednesdayNovember12th2008RightBeforeDinner_42"
Admin
Now i understand VB.NET's 1023 characters limit o_o' they were fearing devs would use variable names longer than that if they didn't put a limit...
...holy s**t !
Admin
I had a good laugh at this.
Admin
More like a couple of seconds. Not really longer than with comments, except for reading slowdown caused by CamelCase.
BTW: TRWTF is of course the website, which did not accept my FullyDescriptiveUserName. No way to include more detail or my bio.
... until that maintenance change, which makes the comment become out of sync with what the code does. And you always see the embedded information in every place where the identifier is used, so you have better chances to notice when implementation and intention diverge.
Of course this requires a development environment where tools (autocompletion) make handling such names reasonably easy and where you can easily and reliably rename such things when their meaning evolves.
Refactoring tools I have seen, don't update comments.
Admin
But this one is a society while a gild would be: "Constantinopolitanischerdudelsackpfeifenmachergilde"
Absolutely not! Versuchung = seduction / temptation Versuch = attempt / experiment / trial
So it would be more likely something like this: "Nihilistentheaterkaestchendynamitsprengungsattentatsversuch"
But neither the former nor the latter is outrageous. Maybe adding a "markerschütternd" or a "himmelschreiend" somewhere?)
Admin
Speaking as someone who cut their teeth on C, many, many moons ago, I remember the joys of having to work with a basic text editor so limited in features that having single named variables such as 'i' was a non-starter - image the carnage of a simple "find i"...
Very quickly got into the habit of double-naming, for instance 'ii'. Took me years to stop!
Cheers
Mark
Admin
Why do people always abbreviate "synchronisation" to "synch"? It should be "sync"!!
Admin
Admin
Can't decide on this one. On one hand, this code is VERY descriptive. I can take one look at it and know what it is doing. This code will also be EXTREMELY easy to read when printed out with a black/white printer (try printing source code WITH multiline /**/ comments in black and white). Also, there's no additional comments to maintain in case the logic changes.
On the other hand, the names are a little too long for my taste. Comments would be easy to spot with modern IDEs and syntax highlight. Comments would also help shorten the names of the functions.
I don't know about the history of the OP's company (are the coders lazy? Were comments often out-of-sync?). For all I know, this may be the BEST solution for the company, obtained after decades of trials and improvements. Just like how some posters think the programmer took "self-documenting code" to the extreme, I think some posters are also taking what they learn from Uni to the extreme (all the axioms of software engineering, etc).
To paraphrase Steve McConnell, a crude, working solution is better than an elegant solution that doesn't. Or Einstein's "make everything as simple as possible, but no simpler".
I don't see this as a WTF. In fact, I'd very much like to meet this lead programmer, shake his hand, and listen to his thoughts on software development.
Admin
That's not camelcase, that's a camel stampede.
Admin
Admin
Decade of design. Obsolete, perhaps.
Admin
My best shot, what I've found in code was the name of an interface:
ICanBeAChildControl
Admin
Refactoring solves this little problem. At least in statically typed languages.
Admin
"Beethoven, Mozart, Chopin, Liszt, Brahms, Panties...I'm sorry...Schumann, Schubert, Mendelssohn and Bach. Names that will live for ever. But there is one composer whose name is never included with the greats. Why is it that the world never remembered the name of Johann Gambolputty de von Ausfern-schplenden-schlitter-crasscrenbon-fried-digger-dingle-dangle-dongle-dungle-burstein-von-knacker-thrasher-apple-banger-horowitz-ticolensic-grander-knotty-spelltinkle- grandlich-grumblemeyer-spelterwasser-kurstlich-himbleeisen-bahnwagen-gutenabend-bitte-ein-nürnburger-bratwustle-gerspurten-mitz-weimache-luber-hundsfut-gumberaber-shönedanker-kalbsfleisch-mittler-aucher von Hautkopft of Ulm?"
It's actually quite readable without the CamelCase, which means that the lexer in the OP is to blame...
Admin
haha, YES!
Admin
So, he's a Rod Johnson/Spring disciple....what of it? ;)
Admin
Wow. I've always argued that code that is self-commenting is always better than similar code that has comments. This totally proved me wrong.
Admin
This kind of code is descriptive but does not tell you WHY the code was written. For that you need comments !!
Admin
Wow, methods and constants a line long, but they still don't manage to say what they do. My question is how do you tell someone that long method names does not equal self documentation. I have a feeling this guy came from a school of thought that would consider
well documented code.
Admin
Not that it helps the original issues but using '_' instead of upper-casing separate words may help minutely.
CodeThatDocumentsItselfSoWellItDoesNotNeedComments vs code_that_documents_itself_so_well_it_does_not_need_comments
But that's just me.
Admin
Reminds me of the DBASE III days.. there were no such thing as function calls or subroutines... if you wanted to create a subroutine, you essentially created a new code file and called it.
Which was fine, until you realized that DOS 3.2 didn't support more than 99 files open at a time, and after nesting about 5 or 6 files deep you were stuck.
The eventual solution.... LOTS OF SPAGHETTI CODE in each FILE.
Admin
I'm really surprised he didn't name the enum more clearly.
I would have half expected to see InventoryIntegrationDirectionEnumerators.<enum choice here>
for each of the case choices.
I must say, I like the idea... hate the implementation. Oh, and can't you compile the comments out of the code which begs the question of why not put comments in the code?
I was hoping this was an article on someone developing some self-documenting module that could create some real documentation, you got me good!
Admin
Reads like a legal document. Kind of a Lose-Lose situation.
Admin
I think I might know who wrote this, at least I've seen this exact kind of naming before, anyone here read "Beautiful Code"?
captcha: modo
Admin
If(You.Sacarstic) Me.Laughing(); else Me.Punch(You);
Admin
You PC guys are unbelievable!! Us MAINFRAME guys started the meaningful field/data names which leads to uncommented code back in the 70's. At least you are finally realizing the need.
Admin
I don't think that code's as bad as you're making it sound.
Your lead developer's combination of (long procedure names + no comments) is definitely a lot more helpful than (short procedure names + no comments).
Whether his system is more or less helpful than (short names + good comments) depends on the quality of the comments.
I imagine we can all agree that (long names + good comments) would be the best way to make code self documenting.
Admin
My god...
It looks like... COBOL!
Admin
Laughing my ass off broseph!
Admin
I imagine that an English thesaurus and dictionary would go far in getting programmers to name their functions properly.
Admin
Correction: November 8, 2008 was a Saturday, not a Wednesday.
Admin
Re: CodeThatDocumentsItselfSoWellItDoesNotNeedComments 2009-09-23 09:53 • by AdT (unregistered)
To you sir, I am correcting you. November 8, 2008 was a Saturday, not a Wednesday!!!!!!!!!!!!!!!! Open your ears man!
Admin
Uh, no. This something we definitely do NOT need. We've been programming for a very long time without them, and sacrificing the principle of longest substring for parsing code is too heavy a cost to make in exchange for what exactly? Not having to think as hard when naming methods and variables? Ruby solves this problem with the underscore convention. Camel case isn't a terrible solution either.
Man. I'd like to see somebody write a language that allows spaces in method and variable names.
Admin
I have no fkn idea what anyone is talking about here.
Admin
TheCodeNeedsDocumentation = TRUE; if(TheDeveloperOverConfident() OR HeWantsToMakeFunOfYou()) URScrewedTryingToUnderstandTheProgram(); else URScrewedTryingToUnderstandTheProgram();
Admin
we_can_emulate_whitespace_with_underscores_and_have_clear_writing = true; # Unix programmer.