1. Список говнокодов пользователя aprishchepov

    Всего: 1

  2. C# / Говнокод #8572

    +120

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    /// <summary>
    /// Calculates and returns a hashcode based on this user's
    /// MarketName and default units. The hashcode should be
    /// unique for each different combination of MarketName and 
    /// units.
    /// </summary>
    /// <returns>An int that may be positive or negative.</returns>
    public override int GetHashCode()
    {
    // A function like this raises innumerable questions.  Why did they over ride the 
    // hash code function?  Why did they use an attribute that is not certain to be unique?
    // why did they not use the one that is going to be unique?  Why did they not cvheck to 
    // see if the thing they were hasing was not null?  When did my life go so far off the rails
    // that I have to deal with code like this?  How many places call this code? Why did they not 
    // include any meaningful comments? Why does it suddenly start breaking after the 3.5 upgrade?
    // in an effort to avoid thinking about those questions, I've justy changed the has to use the 
    // unique user id instead of the retarded defaultuserunits hash.
    System.Text.StringBuilder sb = new System.Text.StringBuilder();
    sb.Append(this.MarketName);
    if (this.DefaultUserUnits != null)
    {
      sb.Append(Utility.StringUtility.GetJSObjectLiteral(this.DefaultUserUnits));
    }
    else
    {
      sb.Append(Utility.StringUtility.GetJSObjectLiteral(this.ID));
    }
      return sb.ToString().GetHashCode();
    }

    aprishchepov, 19 Ноября 2011

    Комментарии (6)