- 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
LMAO!!! Better that having table names like DC00100,PS40200, IV10010 and columns like PSPCX, IVDCX (WTF is is that)... more even when it's you first day at a new job and you have to do views for a client and the deadline is tomorrow on.
Admin
actually you just showed how descriptive "long" names can be, didn't you ?
Admin
why isn't it possible ?
Admin
Well, i a sense you describe the problem yourself. A language must help the programmer by being as strict as possible.. (you say its a WTF that some languages are case-insensitive, so you must agree..) As its only CONVENTION that class'es start with capital letters and instances with lowercase letters, I could easily have car Car in stead of Car car. (I agree, its stupid), but as we have seen, say a couple of thousand times on. say worsethanfailure.com, we already know that many many and many more, programmers out there, are a bit careless when it comes to following convention... Therefore, I vote for case-insensitive languages, to avoid this... well, just my two bits (Bit aBit)
Admin
Yeah, I capiche your thoughts.. But seriously.. dont go around telling folks what THEY have to consider to be WTF's.. Just because Microsoft and Phillips say so, does that make it "the only and most correct way".. Nah... just look at the OS Windows... Thats a WTF on its own, even if they had Car car instead of Car aCar.. And what the Hecks wrong with My prefix, as in MySQL, MyBook, My Computer, My lotsastuff
Admin
I think the proof would take the form of a reductio ad absurdum, and be based on the following observation: If it were to be possible, we'd already be doing so - and we wouldn't need all this nasty nasty computer language stuff.
Admin
I'd prefer using: Car car = new Car(); just seems nicer to me or rather, ICar car = new Ford();
Anyway what I really wanted to say was in C# there is no reason to identify the variable as a singleton. As you would use it the same way. So I'd call the singleton car too.
ICar car = Ford.Instance();
Admin
Admin
Just to add my 2 (Euro) Cents - anything recommended/designed by Philips is most likely a WTF in itself - as anyone who has ever used their microcontrollers knows.
Admin
Argh! AS/400 flashback!
Admin
Were you programming a class in programming class?
(Sorry. Couldn't resist.)
Admin
Admin
Where Id is a 200 digit GRUID (Globally Really Unique Identifier).
Admin
And the official term is not "country manufacturing", it's "nation building".
Admin
Remember that the BASIC interpreters back then were smaller than a typical 'Hello world' program nowadays...
Admin
When I was a student on a placement year, I worked with a guy who was supposed to be an expert in effecient algorithms. (And actually he really did know his stuff) I was given a signal processing algorithm he had written in C (no documentation at all) that needed to be re-worked to work on a vector processor.
Because he was soo concerned with effeciency his code would never calculate the same value more than once, it would calculate the value the first time it needed it and store it in a variable. His naming convention for the variables was:
mp1 = m+1; mp2 = m+2; mm1 = m-1; md2 = m/2;
Despite making the code difficult to read, it worked fine until it came to multiplication. Can you guess what letter he used for multiplication?
When I asked him how I could tell the difference between minus and multiplied, he said you could infer it. mm2 is unlikely to be m-2 and much more likely to be m*2.
That was a long year.
Admin
Ummm... A little too much coffee today? You might want to cut back a little.
How is it better for you to be telling people what to think than it is for someone to tell you how to code?
Admin
Use namespaces, that's what they're for. Well, if that fail code is in C++, that is.
It's like this irritating habit that some companies have to prefix the source file names instead of using sub directories. It's just a makeshift, unpractical and pointless categorization system used where one (directories) already exists.
The guys who argue that with autocompletion (and not intellisense, learn to distinguish descriptive names from marketing ones people) it's not an issue are wrong: it still doesn't make the code readable. Unreadable code == unmaintanable code.
The fact that people persist in using crappy programming languages is another issue entirely.
Admin
Posting IntelliSense as a solution is a better WTF imho (one of the best WTFs so far).
The "naming" is unfortunately like a feeling which cannot easily become a common concern in a common way for all.
I periodically review the code of my developpers with themselves and even though they always agree on my critics (especially on naming) they can still do some minor mistakes if they feel a bit stressed or if they have to do something quickly (which i consider normal/human), but never in that way which is a very critical design issue and kind of insult to potential successors or current colleagues.
If you code in that way you better stop coding. The fact that somebody stops you before you decide it looks like a better option.
PS: Every programmer needs "The Practice of Programming".
Admin
You forgot one:
Admin
IfIsHardToTypeSouldBeHardToRead
YouHaveEIntellisenseToWriteItMaybeButYouDontHaveIntellisenseToReadIt,SoIsYourCodeReadOnly?
Admin
Egad, how rued.
Admin
Wow! Bad memories from that one.
I inherited an inventory/order entry system at an old job that had great table names like those above. BD011A was the job file, BD074A was the bill of lading header file, BD074B was the bill of lading detail file, etc. (Scary that I still remember that stuff.) I should have run away when I saw the names, but I was young and stupid at the time.
Admin
Speak your mind. Speak THY mind! SPEAK YOUR MIND!!!
Admin
CorporationTeeShirtStupidBloodyTuesdayManYouBeenANaughtyBoyYouLetYourFaceGrowLong
Admin
isn't there a limit on the length of names, like 64 or 128 chars?
Admin
Shouldn't that be theCar?
Admin
The stripped shared binary for "Hello, World!" on i386 is 7.8 times larger than the first machine I programmed BASIC on.
Admin
WTF are you on?
Coding standards, and I am happy with a minimalist sub-set of these, are entirely orthogonal to coding.
Choosing your coding standard on the basis that a huge company such as Microsoft or Phillips dictates it to you is tantamount to admitting that you are a worm.
Such a choice also detracts from looking at the lunacy in the OP and going:
What the fuck?
Any chance of ignoring externalities, writing and documenting and testing something that works, and ignoring cretinous directives from above?
No, I thought not.
Admin
OH REALLY? Check out "Practical Guidelines and Best Practices For Microsoft VB and C# Developers" (c) 2005 Microsoft Press:
"Private fields and variable names have no limitation in length... Use meaningful names for fields and variables... Don't use abbreviations that would make the name ambiguous" (p 115)
"Use PascalCase for both public and private methods... avoid underscores, and names longer than 25 characters if the method is public."
It seems to me like this WTF is EXACTLY the kind of thing MS encourages in that book. As far as length goes, they encourage you to go nuts for private stuff, and to exercise just a bit more restraint (25 characters!) for public stuff. They are still caught up on words like meaningful and unambiguous. They are convinced CamelCase and pascalCase are better than those primitive old underscores.
You can say that this WTF is an extreme example, but it reflects the Microsoft mentality about identifier naming: make sure your identifier names communicate everything (wink, wink) about their purpose, even if the result if obnoxious looking.
And variable names can become stale just like comments... naming a variable counterForNextTenIterativeLoops is just as brittle as naming it "i" and commenting it as the "counter for the next ten iterative loops." The minute you add an eleventh loop, the name becomes wrong.
Admin
We all know people who insist on using vi (or vim). They're rooted in the past, but they're happy.
We all know people who use emacs (you, me, etc), and put up with the need to reconfigure the .emacs or .xemacs file on every job because the default doesn't recognise the concept of "mouse up" and "mouse down," and the sysadmin in charge of .profile uses vi/vim.
We all know people who swear by their inadequate, degenerate and unreliable IDE because it offers colour-coding, auto-completion, and all manner of exquisite promises before it dies the death and takes your last two hours' work with it.
Each to his own, I say. I prefer emacs because it's conceptually simple, rock-solid, never lies to me, and has never (short of reading in a file that's bigger than the amount of RAM available) crashed on me.
The results are what matters, not the editor. I think there's a point here: if you really rely on Intellisense to parse an arbitrary CamelCase identifier with around ten or twelve nouns, verbs, adjectives, conjunctives, and have-not, then (a) you're not a programmer and (b) you're an idiot, because Intellisense just won't.
Admin
150+ character variable names. The words have been substituted to remove "intellectual" property.
http://phpabominations.com/archives/4
Admin
Are you a real person? Or just a script that automatically posts a cliched response on the daily WTF every day?
Admin
Singletons: I usually name with "the", as in "theSecurityContext".
For parameters to a function where there's only one object of that kind, I used to use "a" as in "aSecurityContext" but I find that just using "securityContext" is usually more obvious.
Admin
LAWD is dat sum LOLTRAN?
Admin
I once had to look over some code that had the following variable names. 'a', 'aa', 'aaa', 'aaaa'. Then, 'aaaA', 'aaAa' and so forth. Having gotten tired of 'a's he then went on to 't', 'tt' etc. This was in production code. On another project I had to look over VB code where to make variables independent he would mispell the name of the variable he was using before so 'thisVar' would become say 'thesVar'. Excellent.
Peter
captcha: doom ... well the project was I guess.
Admin
Oh god, this is exactly the way a program I use for work is coded, luckily I just need to use it, not rewrite it. The real WTF is that the programmer who wrote that program also has a textbook for VB programming published which tells you to write code exactly like that.
Ewww indeed :/
Admin
You sent Microsoft an email saying that "limited-length strings are a thing of the distant past - please upgrade your base libraries and filesystems accordingly" ?
Admin
Most developers definitely need to learn how to clean up their code's act. But how about something a bit closer to being relevant for coding done in this millenium? Code Complete edition 2 is ok, but even it is still mired in the 80s half of the time. "200 line long functions" are ok, my ass.
Admin
Yes, and with the distinction that many developers will try to correct a screwed-up variable name, whereas they are highly unlikely to fix a comment.
Admin
I'll admit, I'm guilty of using single letters for loops... a strong holdover from the old days of programming where most loop letters were throw-away variables anyway. But what you say here makes perfect sense. You never know when you might need to do a search on those names and single letter variables means you're going to get far too many hits.
I will definitely be working in three letter variable names for my looping and indexing and throw-away variables for clarity and searching sake! :)
(You really can learn stuff off WTF!)
-- Seejay
Admin
Thank you, I did not know this. :D
Admin
well said, wouldn't have minded seeing the rest of the code, SecurityContext is new to the framework and used to tell threads what permissions they have. this programmer isn't half bad if he's using SecurityContext.
Admin
If you're incompetent enough not to fix the comment, it's unlikely that you're competent enough to fix the name of the function.
Admin
Loops are fine as "i" and iterators are fine as "it(n)".
Should you need to use either an external tool like grep (my saviour) or an internal tool like Intellisense, neither one will matter. If they did, we'd be back in the bad old days of Fortran or BCPL. These are local variables.
Outside the (preferably 30 lines or so) member function, they have no meaning at all.
Admin
uuh, that's gonna consume some hard disk space, too :D
Admin
Who posted my code?
Admin
Admin
I actually heartily AGREE with this method of naming variables.
The problem you can come into, though, is that the role of a variable can subtly change (particularly if you are doing RAD), which then renders the name confusing.
The trick is to be descriptive but not toooo specific, which is a juggling act.
But give me long variable names over short ones any day (so long as you either stick to using_lowercase_with_underscores or CapitalisingWordBoundaries or capitalisingLateWordBoundaries. If you Use_A_Mixture_of_the_Two I will frigging GET YOU). ;)
Admin
Why not just search for "\bi\b" or somesuch then, at least in the limited scope that a throwaway variable ought to have? We're not using EDIT.COM here.