• wtf (unregistered)

    With intellisense its not that bad.

    not really a big deal

  • Brady Kelly (unregistered) in reply to wtf
    wtf:
    With intellisense its not that bad.

    not really a big deal

    IWasAboutToSayThatButYouBeatMeToItByAVerySmallMargin.

  • Ron (unregistered) in reply to Brady Kelly
    Brady Kelly:
    wtf:
    With intellisense its not that bad.

    not really a big deal

    IWasAboutToSayThatButYouBeatMeToItByAVerySmallMargin.
    IWasAboutToDoThatBut..... errm, nevermind

  • (cs) in reply to Brady Kelly
    Brady Kelly:
    wtf:
    With intellisense its not that bad.

    not really a big deal

    IWasAboutToSayThatButYouBeatMeToItByAVerySmallMargin.

    The goggles! They do nothing !

  • Kharkov (unregistered)

    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...

  • [ICR] (unregistered) in reply to wtf
    wtf:
    With intellisense its not that bad.

    not really a big deal

    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.

  • Jens (unregistered)

    And the variable names he passed are cool too:

    SecurityContext and securityContext differ only in the capitalisation of first letter..

    Brilliant !!!

  • [ICR] (unregistered) in reply to Jens
    Jens:
    And the variable names he passed are cool too:

    SecurityContext and securityContext differ only in the capitalisation of first letter..

    Brilliant !!!

    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.

  • Jens (unregistered) in reply to Jens
    Jens:
    And the variable names he passed are cool too:

    SecurityContext and securityContext differ only in the capitalisation of first letter..

    Brilliant !!!

    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..

  • sweavo (unregistered)

    What language is that, that allows hyphens in identifiers?

    Captcha: I'm not telling, but I laughed when I read it.

  • (cs) in reply to Jens
    Jens:
    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..
    This is a pretty common convention, from my point of view. How do you name single instances of classes?
  • (cs) in reply to Jens
    Jens:
    Jens:
    And the variable names he passed are cool too:

    SecurityContext and securityContext differ only in the capitalisation of first letter..

    Brilliant !!!

    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..

    It's very common, though, in the case where the argument would simply be "some generic instance of this class." Better than "temp" or (God help us) "arg0".

  • wiregoat (unregistered) in reply to Welbog

    Hey, it beats having comments in the code. Those are just ugly.

  • jimjim (unregistered)

    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

  • (cs)

    "Organization copay"

    Wait, what?

  • (cs)

    Where's the wtf? At least they didn't use hungarian.

  • barfman (unregistered)

    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...

  • Jon (unregistered)

    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 :)

  • (cs) in reply to Ron
    Jake:
    Debugging a function with variables named a, a1, a2, a0, aO, al, a1l, al1, aIl, a1I, and al1I is something I wouldn't wish on my worst enemy.
    I would!
  • -j (unregistered) in reply to Jon

    If it encourages code like that, intelisense is neither intelligent nor makes any sense. Probably heresay on a winforum like this :-(

  • Me (unregistered) in reply to Welbog
    Welbog:
    Jens:
    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..
    This is a pretty common convention, from my point of view. How do you name single instances of classes?

    ClassName: Car

    Singleton: aCar

  • David Betz (unregistered)

    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.

  • David Betz (unregistered)

    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.

  • John Doe (unregistered) in reply to Jon

    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

  • (cs) in reply to wtf
    wtf:
    With intellisense its not that bad.

    not really a big deal

    I use vi. I would fall short of being very happy about it.

  • fanguad (unregistered)

    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.

  • anonny (unregistered) in reply to David Betz
    David Betz:
    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.
    So tell me, then: What does it mean?
  • (cs)

    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

  • (cs) in reply to Me
    Me:
    Welbog:
    Jens:
    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..
    This is a pretty common convention, from my point of view. How do you name single instances of classes?
    ClassName: Car

    Singleton: aCar

    That's a reasonable convention, but the difference between the class name and the instance name is still only one letter. Unless your ability to read case-sensitive code has been ruined by reading forums whose members don't capitalize or by case-insensitive programming languages (a WTF by itself), I don't really understand what the problem is with Car car = new Car();

  • ftw (unregistered) in reply to wtf
    wtf:
    With intellisense its not that bad.

    not really a big deal

    The real WTF is that so many developers think like this.

    captcha: LongAndVerboseDoesNotEqualClearAndReadableYouIdiots

  • ArashiNK (unregistered)

    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.

  • (cs) in reply to seymore15074
    seymore15074:
    I use vi. I would fall short of being very happy about it.
    I also wouldn't be very happy about using vi. :)

    (for those with sense of humour failure, I realise I have quoted without the context).

  • alexgieg (unregistered)

    I didn't know German had such a huge influence in modern programming.

  • (cs) in reply to -j
    -j:
    If it encourages code like that, intelisense is neither intelligent nor makes any sense. Probably heresay on a winforum like this :-(
    Excellent mis-spelling: is that "hearsay" or "heresy"? It kinda makes sense either way...

    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 ...

  • Bosshog (unregistered) in reply to snoofle
    snoofle:
    Jake:
    Debugging a function with variables named a, a1, a2, a0, aO, al, a1l, al1, aIl, a1I, and al1I is something I wouldn't wish on my worst enemy.
    I would!

    Me too - I hate that goddamn buckingham.

  • A.J. (unregistered)

    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.

  • Mark (unregistered)

    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!

  • (cs) in reply to daniel c w
    daniel c w:
    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

    Is that supposed to be a malformed Haiku, or just bad poetry?

  • (cs) in reply to sweavo
    sweavo:
    What language is that, that allows hyphens in identifiers?

    English, among others. Presumably the hyphen is there to show us that the line was split for formatting.

  • (cs)

    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!

  • Sam (unregistered) in reply to daniel c w
    daniel c w:
    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
    peopleIWouldPreferNeverToWorkWithBecauseTheyDoNotKnowHowToCode.add(new ProgrammerWhoDoesNotKnowHowToNameProgrammingElements("daniel c w"))
  • Fu King Ugli (unregistered)

    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.

  • (cs)

    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?

  • Anon (unregistered) in reply to Kharkov
    Kharkov:
    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...

    At least with OS/2 if you didn't know the API call name, you could pretty accurately predict what it would be.

  • chuck (unregistered)

    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 :/

  • chuck (unregistered) in reply to rawsteak
    rawsteak:
    DrugStrengthFormCountryManufacturerPharmacyCopayProductPriceFactory

    is that DrugStrength FROM CountryManufacturer?

    What is a country manufacturer doing messing with drug strengths anyway? They should be sticking with what they know: manufacturing countries.

  • Nelle (unregistered) in reply to poochner
    poochner:
    Jens:
    Jens:
    And the variable names he passed are cool too:

    SecurityContext and securityContext differ only in the capitalisation of first letter..

    Brilliant !!!

    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..

    It's very common, though, in the case where the argument would simply be "some generic instance of this class." Better than "temp" or (God help us) "arg0".

    oh the eclipse ...

  • Tim (unregistered)

    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

  • Sam (unregistered)
    class DrugStrengthFormCountryManufacturerPharmacyCopayProductPriceFactory
    {
    
    public DrugStrengthFormCountryManufacturerPharmacyCopayProductPrice
        getSalesOrderProductSupplierCopayDrugStrengthFormCountryManufacturer-
        PharmacyCopayProductPrice (SecurityContext securityContext,
            SalesOrderProductSupplier salesOrderProductSupplier,
            Organization copay)
    

    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:

    class DrugStrengthFactory {
            public DrugStrength getBySale(SecurityContext securityContext, Sale sale, Org org) {[...]}
    }
    class DrugStrength {
            public Country getCountry()[...]
    }
    [...]
    DrugStrengthFactory drugStrengthFactory = new DrugStrengthFactory();
    drugStrength = drugStrengthFactory.getBySale([...]);
    

    And I still think the class names are a little too long in my example....

  • Nutmeg Programmer (unregistered)

    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.

Leave a comment on “Really Descriptive Names”

Log In or post as a guest

Replying to comment #160118:

« Return to Article