Mistři v programování na #hovnokod

Podotýkám, že metoda isPaid jen čistě vrací úplně ten samý atribut. Je to tedy $this->paid && $this->paid

return $this->isPaid() && $this->paid;

Anonymous,

Code review comment: Digits here repeat, if you create constant for them and give them self-explanatory name, it would make code more readable and easier to modify, and less prone to errors when refactoring Toto byla uprava

//before
 if (birthDate.length() >= 6) {
                     builder.append(dash);
                     builder.append(birthDate.substring(4, 6));
 }

//after
final int birthDateStrLen = birthDate.length();
  if (birthDateStrLen >= 8) {
             builder.append(dash);
             builder.append(birthDate.substring(6, 8));
   }

Anonymous,


Anonymous,

Oh no...

List<string> CodingList = new List<string>();

for (int i1 = 65; i1 < 91; i1++)
{
    string s1 = (Convert.ToChar(i1)).ToString();
    CodingList.Add(s1);
}

for (int i1 = 65; i1 < 91; i1++)
{
    string s1 = (Convert.ToChar(i1)).ToString();
    for (int i2 = 65; i2 < 91; i2++)
    {
        string s2 = (Convert.ToChar(i2)).ToString();
        CodingList.Add(s1 + s2);
    }
}

for (int i1 = 65; i1 < 91; i1++)
{
    string s1 = (Convert.ToChar(i1)).ToString();
    for (int i2 = 65; i2 < 91; i2++)
    {
        string s2 = (Convert.ToChar(i2)).ToString();
        for (int i3 = 65; i3 < 91; i3++)
        {
            string s3 = (Convert.ToChar(i3)).ToString();
            CodingList.Add(s1 + s2 + s3);
        }
    }
}

for (int i1 = 65; i1 < 91; i1++)
{
    string s1 = (Convert.ToChar(i1)).ToString();
    for (int i2 = 65; i2 < 91; i2++)
    {
        string s2 = (Convert.ToChar(i2)).ToString();
        for (int i3 = 65; i3 < 91; i3++)
        {
            string s3 = (Convert.ToChar(i3)).ToString();
            for (int i4 = 65; i4 < 91; i4++)
            {
                string s4 = (Convert.ToChar(i4)).ToString();
                CodingList.Add(s1 + s2 + s3 + s4);
            }
        }
    }
}

return CodingList;

Anonymous,

public String animalCheck (String animal){
       return this.animals.contains(animal) ? "ano,v zoo je " + (animal) : "ne, v zoo neni " + (animal);
    }

Anonymous,