Best or worst ever function name?



  • From our codebase:
    <FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas><FONT color=#0000ff size=2 face=Consolas>
    void</FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas> um_stop_periodic_flows( um_device_t *pdev, u8_t b_indicate_reset_in_progress );</FONT></FONT>

    <FONT size=2 face=Consolas><FONT size=2 face=Consolas> 

    </FONT></FONT>


  •  

    Timer t;
    

    void um_start_period()
    {
    t = set_interval(6400, um_bleed(rand(10)));
    }

    void um_stop_period()
    {
    remove_interval(r);
    }

    blood um_bleed(int amount)
    {
    return new blood(amount);
    }

     

    i have no idea why this came to my mind upon seeing your post.
    also, i've seen worse but can't remember any specific one.



  • I once worked on a virtual printer driver called "Golden Jet."

    Thinking on it now that project was full of terrible names. I was the culprit who named one of the classes 'CXDGJIPrintOEMUIMXDC.' It made sense at the time.



  • um_stop_periodic_flows(dev, false);
    um_like_save_file_man(file);


  • Not sure if most sexist thread ever.

     

     

    Proceed.



  • We have one called SplitAssAnal, something to do with splitting assimilated analysis data.



    I'm sure that's what the function actually does, but maybe the original dev should've named it better... It does sound painful!



  • Along the same lines, here's a comment I saw once:

    /* Handle floaters by flushing repeatedly until they're all gone. */

    (This was in a page layout engine. "Floaters" are floating images, and "flushing" is the process of finishing a horizontal line of the page and moving on to the next one.)



  • I found a short pointer to a container of unknown data type in our codebase, the delightfully named spUnkContainer.  Don't think I've seen worse in a production environment, though I seem to recall a bash.org post about code that would do something like offload jobs if a queue of high-priority tasks was non-empty:

    if (getHead())

    {

    dropLoad;

    }


  • Trolleybus Mechanic

     I have a report that can either be month-by-month, or cumulative, so it's behavior is controlled by a variable. The dev that wrote the report loves shorthand, and thus the code is just splattered with his @cum. There's @cum_type, and @cum_direction. It's an input/output variable, so you can pass @cum between stored procs. There's some sub reports that will inject their own value into the original @cum, and let it dribble down to the handler below.

     The dev is, of course, completely unaware of what he's dumped into the codebase. I'm not sure if that makes it better or worse.


  • Discourse touched me in a no-no place

    @orange_robot said:

    though I seem to recall a bash.org post about code that would do something like offload jobs if a queue of high-priority tasks was non-empty:

    if (getHead())

    {

    dropLoad;

    }

    This one?

    <ddubb> if there is no local area ID found, drop the load data.
    <ddubb> or, in code form:
    <ddubb> if (!getLAid()) dropLoad();
    <ddubb> line 525 of software that ships tomorrow.
    <ddubb> my work here is done.


  • Thanks a lot. I shall never be able to look at "double CumProductionVolume" with a straight face again.



  • These weren't function names, but a system I worked with many moons ago had some variable with interesting names.  The codebase had been developed by an external software house and then brought in-house.  The external developer wanted to celebrate buying a new car, so he named a central variable in the home-grown threading system "golf_gti".

    Adding to the confusion:  Part of the system calculated an estimate of gas compressibility (i.e. deviations from the PV=nRT ideal gas law), and the formal textbook statement of the formulas involved the Greek letters pi and tau.  For whatever reason, someone involved in this had the bad habit of pronouncing tau as if it were spelled "tor", and then tried-and-failed to express the natural spelling of this in a dialect of BASIC whose parser would lift keywords ("OR" in this case) from variable names.  So he used a different name, and this name made it into the C codebase we were maintaining, along with an understandable misspelling of pi.

    The result?  A classic 'Representative Line':

    double apple, pie;



  •  When I was a student I was handed some code during my placement year with

     

    someType function(someType sometype,someType SomeType, someType Sometype)

    {

    someType SOMETYPE;

    if ((sometype < SomeType) || (SomeType > Sometype) )

    {

      // And on and on the nightmare goes...

    }

      return SOMETYPE;

    }

     Worst name in the sense the function name meant aboslutely *nothing* and the mixed-case variation of the input variables made it an utter ballsache to follow. I think I just gutted it and started again.

     


  • Discourse touched me in a no-no place

    Our hardware can use more than one wide area network at a time (telecoms) and as such there are sections of the configuration labeled wan1, wan2 etc. In (at least my) documentation the number is replaced with x to represent 'any number.' In quite a few places.



  • @PJH said:

    Our hardware can use more than one wide area network at a time (telecoms) and as such there are sections of the configuration labeled wan1, wan2 etc. In (at least my) documentation the number is replaced with x to represent 'any number.' In quite a few places.

    You should name them in base 17 notation... then the sixteenth one would be wang!



  • public boolean checkRunPlugin(String plugin, Data data)

    No comments in the source for this method. The programmers before me seemed to have liked "not logic" as a general pattern. In some places where this method is used, it is commented that this returns FALSE when the plugin should be run.

    Referenced and commented slightly differently in different places:

    // check to see if it should run, it should NOT run if this returns true
    // check to see if we should run the plugin. If this returns true it means we should NOT run the plugin

    Then, sadly, it is used in other places WITHOUT the commenting, which makes one wonder whether the method has some sort of split personality depending on the object's state. Or, if there were a lot of inconsiderate coders in this codebase before me.

    Odds are 50:50 for either case being true, to be honest. Or, perhaps, both.

    As an aside, when I can't decide what a variable is going to represent straight away, I often use 'blah' temporarily, then refactor once I realize what the variable should be called. I've only occasionally found that I've forgotten to refactor it.

    Finally, someone at some time created this over-arching class which was supposed to model some real-world process. When they instantiated it for actual use, they named the variable <classname>Thing.



  • @PJH said:

    Our hardware can use more than one wide area network at a time (telecoms) and as such there are sections of the configuration labeled wan1, wan2 etc. In (at least my) documentation the number is replaced with x to represent 'any number.' In quite a few places.

    Would have been funnier if they used 'k' ...



  • One of our applications has a built-in video player. For a while it was used exclusively to watch videos of sewer line inspections (some company takes a remote-control-car with a camera on it and drives it through the sanitary sewer mains to look for leaks, cracks, tree roots, etc.). Internally we call this feature PoopTube and I think the term is used in a couple places in our codebase. End-users don't (or shouldn't) see that term in the final product.


  • Discourse touched me in a no-no place

    @ekolis said:

    You should name them in base 17 notation... then the sixteenth one would be wang
    Sadly, we're unlikely to ever get that high due to the physical restrictions of the equipment.



  • Kinda related.

    At the Lake City Operations Centre, we have a printer named K

    Yes, we really do have a printer named LCOCK.



  •  I spent some time working for A National Company which dabbled in television and radio ratings.  The office network filled with shared folders packed full of huge datasets broken down by demographic group and the type of analysis being performed on them.

     

    Or at least that's why I hope there were so many gigabytes of data in folders called "AnalTeenF", "Anal40-49M" and "Anal65+F".  I tried pretty hard not to prove myself wrong.

     

     

     

     

     


  • Trolleybus Mechanic

    @DCRoss said:

    I spent some time working for A National Company which dabbled in television and radio ratings.
     

    My mother works at An Internation Company that dabbles in the same, as well as product information tracking. Much of her department has been outsourced, and those who remain spend their time correcting the oversea mistakes that come from not having cultural knowledge of the products being tracked.

    To this day, she still needs to clean up the "Jams & Spreads" data so it doesn't track KY Jelly.



  • @Lorne Kates said:

    To this day, she still needs to clean up the "Jams & Spreads" data so it doesn't track KY Jelly.

    I don't know about you, but I definitely associate KY Jelly with spread and jam.



  • @morbiuswilters said:

    @Lorne Kates said:
    To this day, she still needs to clean up the "Jams & Spreads" data so it doesn't track KY Jelly.
    I don't know about you, but I definitely associate KY Jelly with spread and jam.
    Zing!



  • I've encountered a few of these over the years. I added them to a page I found in a (basically the) wiki. One of the others there reads

      CRect  rectUm;	//  darn near killed'em

    I'm glad that whoever wrote it left the comment; otherwise I'd have got completely the wrong impression.



  • @zelmak said:

    public boolean checkRunPlugin(String plugin, Data data)

    No comments in the source for this method. The programmers before me seemed to have liked "not logic" as a general pattern. In some places where this method is used, it is commented that this returns FALSE when the plugin should be run.

    Referenced and commented slightly differently in different places:

    // check to see if it should run, it should NOT run if this returns true
    // check to see if we should run the plugin. If this returns true it means we should NOT run the plugin

    Then, sadly, it is used in other places WITHOUT the commenting, which makes one wonder whether the method has some sort of split personality depending on the object's state. Or, if there were a lot of inconsiderate coders in this codebase before me.

    Odds are 50:50 for either case being true, to be honest. Or, perhaps, both.

    As an aside, when I can't decide what a variable is going to represent straight away, I often use 'blah' temporarily, then refactor once I realize what the variable should be called. I've only occasionally found that I've forgotten to refactor it.

    Finally, someone at some time created this over-arching class which was supposed to model some real-world process. When they instantiated it for actual use, they named the variable <classname>Thing.

    But... where's the dirty word?



  • I once worked together with some German developers. They used Hungarian notation: g = global, u = unsigned, mmi= related to the MMI part of the code. This resulted in a global variable named gummiLautsprecher - which in German means "rubber loudspeaker".


Log in to reply