- 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
With intellisense its not that bad.
not really a big deal
Admin
Admin
Admin
The goggles! They do nothing !
Admin
It reminds me of the naming conventions issued by IBM in the OS/2 programming documentation.
The only issue I ever had with this kind of descriptions was that the MS Pascal compiler truncated names after 64 characters, and to have function names differing only after this limit...
Admin
Not to type, but to read and understand is still quite difficult. Personally I tend to use names longer than I should, but I have a limit of about half that.
Admin
And the variable names he passed are cool too:
SecurityContext and securityContext differ only in the capitalisation of first letter..
Brilliant !!!
Admin
That's not too bad. With a consistent naming convention and colour syntax highlighting it's pretty easy to tell the class name apart from the variable name.
Admin
oh ok, I just realised that it was the classname and the variablename that differ in first letter.. still not a bright thing to do..
Admin
What language is that, that allows hyphens in identifiers?
Captcha: I'm not telling, but I laughed when I read it.
Admin
Admin
Admin
Hey, it beats having comments in the code. Those are just ugly.
Admin
its easy to get long names in classes when you have to use prefix and suffixes, in example:
some_package_name_some_sub_package_class_name_data_replicated
Admin
"Organization copay"
Wait, what?
Admin
Where's the wtf? At least they didn't use hungarian.
Admin
yeoooooowwww!
That's a lot of reading. Verbosely uglier than anything I've had the luxury of seeing, thanks for sharing.
Give someone an inch, they take a mile...
Admin
the only wtf is perhaps using long variable names that don't make any sense. If they are that long and make perfect sense then I wouldn't mind it. The other WTF is the poster probably hasn't heard of intelisense :)
Admin
Admin
If it encourages code like that, intelisense is neither intelligent nor makes any sense. Probably heresay on a winforum like this :-(
Admin
ClassName: Car
Singleton: aCar
Admin
OK, actually that's a great name. You want them to be self describing. Per the Microsoft Coding requirements, that's flawless. It's very common in a well-factored system.
Admin
Er actually, nevermind that can't be Microsoft code. The name casing is in that obsolete Java-style camelCasing. So, I guess the name sucks as you don't do those long names in Java.
Admin
No, I think the real WTF is that there are multiple classes with a ton of functions with ridiculously long names that all vary by one or two words.
And I just looking at the function name again it has some words repeated like "product" and "copay".
getSalesOrderProductSupplierCopayDrugStrengthFormCountryManufacturerPharmacyCopayProductPrice
Now imagine a function like the following. I bet intellisense really helps when your trying to differentiate the two.
getSalesOrderCopayProductProductSupplierCopayManufacturerDrugStrengthFormPharmacyPrice
Admin
I use vi. I would fall short of being very happy about it.
Admin
That looks a lot like our code base... fortunately most of our class names are about 50-75% that length, although for many it doesn't really matter, since they've already passed the point of being reasonable.
For extra fun, try combining long class and variable names with an 80-character line limit (we do). Any variable assignment takes at least 2 lines, and most function calls take 4-5 lines.
Ugh.
Admin
Admin
I do not think it is a F. Fail to see what's so bad about it. I would actually write that kind of code.
p.s.: I do also not tink it is a W or a T
Admin
Admin
The real WTF is that so many developers think like this.
captcha: LongAndVerboseDoesNotEqualClearAndReadableYouIdiots
Admin
I'd rather have the long obnoxious name than the short uninformative one. Though actually, once in high school, I used the long obnoxious name in a programming class. The rest of my classmates stopped copying my code after that.
Admin
(for those with sense of humour failure, I realise I have quoted without the context).
Admin
I didn't know German had such a huge influence in modern programming.
Admin
Your point is sound, though: anybody defending this "Kingdom of the Nouns" approach because tools can understand it (after all, a tool wrote it) is either disingenuous or insane. Taking "Intellisense" as a case in point, what possible use could the auto-complete mechanism be in an environment like this?
The Intellisense goggles, they do nothing ...
Admin
Me too - I hate that goddamn buckingham.
Admin
It's only 94 characters long. The longest we have is 147 characters: SubscribingSystemImplementationServiceIsSubscribingSystemImplementationServiceInDataSubscriptionContractSystemImplementationServiceDestination and that's handily beating our second largest which has only 110 characters: DeliveryUniformResourceLocatorIsDeliveryAddressForDeliveryUnderDataSubscriptionContractEmailAddressDestination
Oh, did I already mentioned that we use model driven application developement? It's such a blessing (but to whom, I don't know).
A.J.
Admin
People, its simple.
a. We need to be descriptive, so hungarian is crap, but b. We need to be succinct, so we need short names
Ergo: use namespaces, which are descriptive, but only appear at the top of the file (include/import) and then have short class and function names!
So.... ...ok I give up, I have absolutely no idea how you would break down this monstrosity of a name!
Admin
Is that supposed to be a malformed Haiku, or just bad poetry?
Admin
English, among others. Presumably the hyphen is there to show us that the line was split for formatting.
Admin
DrugStrengthFormCountryManufacturerPharmacyCopayProductPriceFactory
is that DrugStrength FROM CountryManufacturer? I understand everyone has their own naming conventions, but at least spell it right! I had a friend who worked at a Chinese-owned database company working on the state's welfare system, and "October" was commonly referred to as "Octrober." She sometimes got errors in her code because of it!
Admin
Admin
I used to work on a pharmacy application that was eerily similar. Close to eight thousand classes all generated from some monstrous Rational Rose models. Jeeze, what verbose class and function names they used and those only grew longer when the classes were generated!
There were times I'd sit down in front of the computer and think I was looking at a strings dump or that Visual Studio had barfed garbage onto the screen then realize it was the actual code before me. It just all ran together.
Of course regenerating the basic classes was a breeze whenever the model changed but writing, editing, merging, or debugging additional code more than negated all the time savings. Fortunately for me our firm's contract was not renewed.
From what I understand the big pharma that hired us took one look at the code and trashed it all, throwing several million down the drain. Then they started over with a reasonable model with sensible naming and, though they also generated a lot of code, it was easily readable and editable.
Admin
There are only two authoritative C# coding standards that I'm aware of, Microsoft's and Philips'. They both specify that for variables representing a generic instance of a class with unknown purpose, the correct name for the variable is the lowercase version of the class name.
Not "aThing". Not "theThing". Not "someThing". Not "myThing". Not "_thing". Not "iCanHasThing". Just "thing".
Furthermore, it's perfectly acceptable to declare a public property name identical to its type name. The .NET system classes do this frequently, for example, DateTime.DayOfWeek. This makes sense because, well, it makes sense. A date occurs on some day of the week, and a day of the week is... a day of the week.
There's absolutely nothing wrong with having a class named SecurityContext, and in another class, having a private field named securityContext, a public property named SecurityContext, and a constructor with argument SecurityContext securityContext. What else would you call the ctor argument - securityContextForThisInstanceButMaybeNotExclusively? Maybe securityContextThatHappensToBeUsedHere? Or perhaps securityContextUsedToInitializeAPrivateField"?
Silly prefixed versions like _securityContext or mySecurityContext add absolutely no new information and are therefore just useless cruft. The fact is, we have a class whose name specifies its purpose intrinsically; we don't need any more identifying information! It's not like an int, which could either be a record count or the current room temperature; it's a SecurityContext, which is... um... the security context. Duh?
Yes, this is illegal in VB. That's why VB and C# and every other language on the planet all have different coding conventions. But seriously folks, don't go around telling people how to code in their language based on conventions from your preferred language.
Capiche?
Admin
At least with OS/2 if you didn't know the API call name, you could pretty accurately predict what it would be.
Admin
What's really sad is how the ridiculously long class name is just a string of not-really-related nouns, signaling (to me anyway) that the class is likely to be just an aggregate of a bunch of data that doesn't really belong lumped together in one class. Yay for OO design :/
Admin
What is a country manufacturer doing messing with drug strengths anyway? They should be sticking with what they know: manufacturing countries.
Admin
oh the eclipse ...
Admin
they probably put everything in the same package too. Packages would make this quite somewhat decent. I'm always amazed by the number of people who don't use packages to as part of a classes "name".
drugstrength.forms.country.manufacturer.pharmacycopay.ProductPriceFactory
Admin
I would love to take a stab at what this does. My guess is that the class itself represents different ways to get Drug Strength Forms. (Hence the java convention of DrugStrengthForm...Factory.) Information in the DrugStrengthForm includes the following bits of information: Country, Manufacturer, Pharmacy, Copay, Product, Price. (Or maybe just country manufacturer, pharmacy, copay, and product price. Isn't collocation fun?) Who knows why they would put this information in the class name?
One way to get a Drug Strength Form is by the combination of a SecurityContext, a SalesOrderProductSupplier, and an Organization object (named copay for some reason). The Sales Order contains a Product and a Supplier (or just a "Product Supplier.")
But it's a poor naming convention at best. If I want to know what's in a class, I can look at the darn definition or even use (ick) introspection. Hell, if they are using Java beans or annotations, this is pretty damn simple. If they have different DrugStrengthForms with different bits of information, have a class that returns "null" for bits of information that aren't available.
Imagine if the code looked like this:
And I still think the class names are a little too long in my example....
Admin
CIRCA 1974, a co-worker ported a payroll system from COBOL to Data General Fortran. Although the compiler would accept 32 character variable names, they had to be unique within the first 24 (IIRC). Obviously, we were not using punch cards.
It was a real shock to go back to IBM Foratran IV and 6 char variable names at my next employer.