Representative Methods



  • These are some gems I found once in a codebase I had to maintain:

    public virtual bool Se(bool condition, ref bool result)
    {
        if (condition == true) result = true;
        else result = false;
        return result;
    }

    Where "se" is a portuguese word meaning "if".

    There was also this one:

    public virtual bool IsBigger(int number1, int number2, ref bool result)
    {
        if (no1 > no2) result = true;
        else result = false;
        return result;
    }

    The library that had these methods was full of others such as "CalculateMod10", "CalculateMod11" etc. (and all the methods to get a modulus return strings). Lots of methods were just someone reinventing a square wheel, such as trying to get the day of the week without using any existing classes or structures - this was .NET, but could have been anything else and the code I've seen still wouldn't be justifiable. There was also a method called "ApplySecurity" that does nothing but returning the value 1 as an integer. Go figure.



  • [quote user="Renan "C#" Sousa"]public virtual bool Se(bool condition, ref bool result)
    {
        if (condition == true) result = true;
        else result = false;
        return result;
    }[/quote] 

     

    OMG I love that it both takes a ref bool and returns a bool.

    bool b = Se(i >= 100, ref b);



  • Best of the sidebar.



  • "OMG I love that it both takes a ref bool and returns a bool."

     AND THEY'RE THE SAME MOTHERFUCKING VALUE!

     Edit: One day, they're going to invent a reverse execution debugger that can trace all the way back into the mind of the programmer and KILL HIM, KILL HIM GOOD!



  •  Oh, how I hate those retarded "programmers" that copy-paste one retarded design everywhere simply because it works.[quote user="Renan "C#" Sousa"]Where "se" is a portuguese word meaning "if".[/quote]I have to maintain an application full of non-english variables and I rage when I see this crap. And the friggin thing is in my native language.

    For the love of god lern2english

     



  • [quote user="Renan "C#" Sousa"]There was also a method called "ApplySecurity" that does nothing but returning the value 1 as an integer. Go figure.[/quote]It's called "forward compatibility".

    @DOA said:

    For the love of god lern2english
    Truth be told, I also sometimes write mixed-language variables and functions, but that's only when it is impractical to translate business domain names.



  • @DOA said:

    I have to maintain an application full of non-english variables and I rage when I see this crap. And the friggin thing is in my native language.

    For the love of god lern2english

     

    What may be worse is the use of "color" in some places and "colour" in others (for example). I know I am sometimes guilty of this when I'm not paying attention.



  • @Zemm said:

    @DOA said:

    I have to maintain an application full of non-english variables and I rage when I see this crap. And the friggin thing is in my native language.

    For the love of god lern2english

     

    What may be worse is the use of "color" in some places and "colour" in others (for example). I know I am sometimes guilty of this when I'm not paying attention.

     

    I personally didn't really like seeing all kinds of native words for variable names a new dev introduced in an existing, English codebase. In this specific color/colour case what I hate is that I try to use UK-English as much as possible, so hate it when I "have" to make a construction like Color colour = Color.Lime;



  • @pbean said:

    I personally didn't really like seeing all kinds of native words for variable names a new dev introduced in an existing, English codebase. In this specific color/colour case what I hate is that I try to use UK-English as much as possible, so hate it when I "have" to make a construction like Color colour = Color.Lime;
     

    I think Microsoft should invent some kind of technology where any programmer who uses the Color.Lime constant gets slapped in the face. I'm not sure exactly how it would work, but I believe the payoff would be immense.



  • @blakeyrat said:

    @pbean said:

    I personally didn't really like seeing all kinds of native words for variable names a new dev introduced in an existing, English codebase. In this specific color/colour case what I hate is that I try to use UK-English as much as possible, so hate it when I "have" to make a construction like Color colour = Color.Lime;
     

    I think Microsoft should invent some kind of technology where any programmer who uses the Color.Lime constant gets slapped in the face. I'm not sure exactly how it would work, but I believe the payoff would be immense.

    Make it delete all the files in the project, commit changes and then bluescreen the pc.



  • @XIU said:

    Make it delete all the files in the project, commit changes and then bluescreen the pc.
     

    +1 win



  • @DOA said:

    I have to maintain an application full of non-english variables and I rage when I see this crap. And the friggin thing is in my native language.

    For the love of god lern2english

     

    A little bit of knowledge is a dangerous thing.  You would be suprised at how many engineering words and phrases get simplified to unprintible four letter variables and function names by previous authors of  the simulation code that I am updating.

    Most recently, we had a "Capacitor Unit" stripped of it's "apacitor" and another chosen vowel... Used about 64 times in the simulation.

    Saith the compiler:  [code]I don't know how to handle 'c***'[/code]


Log in to reply