1. Лучший говнокод

    В номинации:
    За время:
  2. Java / Говнокод #5755

    +84

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    transDate = ( ExtBaApiStaging.class.equals( extExcep.getClass() ) )?((ExtBaApiStaging)extExcep).getBeginDate():
    		( ExtRsApiCancel.class.equals( extExcep.getClass() ) )?((ExtRsApiCancel)extExcep).getTransDate():
    		( ExtRsApiWriteCustContact.class.equals( extExcep.getClass() ) )?((ExtRsApiWriteCustContact)extExcep).getTransDate():
    		( ExtRsApiPayAdjust.class.equals( extExcep.getClass() ) )?((ExtRsApiPayAdjust)extExcep).getTransDate():
    		( ExtRsApiChgCustomer.class.equals( extExcep.getClass() ) )?((ExtRsApiChgCustomer)extExcep).getTransDate():
    		( ExtRsApiChgService.class.equals( extExcep.getClass() ) )?((ExtRsApiChgService)extExcep).getTransDate():
    		( ExtRsApiChgBoxData.class.equals( extExcep.getClass() ) )?((ExtRsApiChgBoxData)extExcep).getTransDate():
    		( ExtCLApiIsfMnp.class.equals( extExcep.getClass() ) )?((ExtCLApiIsfMnp)extExcep).getLoadDate():
    		( ExtCLApiNoTruckSro.class.equals( extExcep.getClass() ) )?((ExtCLApiNoTruckSro)extExcep).getLoadDate():
    		( ExtCLApiNsfHoldEcOsa.class.equals( extExcep.getClass() ) )?((ExtCLApiNsfHoldEcOsa)extExcep).getLoadDate():
    		( ExtRsApiSendAHit.class.equals( extExcep.getClass() ) )?((ExtRsApiSendAHit)extExcep).getTransDate() : null;

    Это писала одна тимлид

    tr00_gr1m_doomster, 21 Февраля 2011

    Комментарии (17)
  3. Java / Говнокод #5498

    +84

    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
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    /*
     * Copyright 2003-2009 the original author or authors.
     *
     * Licensed under the Apache License, Version 2.0 (the "License");
     * you may not use this file except in compliance with the License.
     * You may obtain a copy of the License at
     *
     *     http://www.apache.org/licenses/LICENSE-2.0
     *
     * Unless required by applicable law or agreed to in writing, software
     * distributed under the License is distributed on an "AS IS" BASIS,
     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     * See the License for the specific language governing permissions and
     * limitations under the License.
     */
    package org.codehaus.groovy.runtime;
    
    
    public class ArrayUtil {
        private static final Object[] EMPTY = new Object[0]
                ;
    
        public static Object[] createArray() {
            return EMPTY;
        }
    
        public static Object[] createArray(Object arg0) {
            return new Object[]{
                    arg0};
        }
    
        public static Object[] createArray(Object arg0, Object arg1) {
            return new Object[]{
                    arg0, arg1};
        }
    
        public static Object[] createArray(Object arg0, Object arg1, Object arg2) {
            return new Object[]{
                    arg0, arg1, arg2};
        }
    .......................................................
    
        public static Object[] createArray(Object arg0, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7, Object arg8, Object arg9, Object arg10, Object arg11, Object arg12, Object arg13, Object arg14, Object arg15, Object arg16, Object arg17, Object arg18, Object arg19, Object arg20, Object arg21, Object arg22, Object arg23, Object arg24, Object arg25, Object arg26, Object arg27, Object arg28, Object arg29, Object arg30, Object arg31, Object arg32, Object arg33, Object arg34, Object arg35, Object arg36, Object arg37, Object arg38, Object arg39, Object arg40, Object arg41, Object arg42, Object arg43, Object arg44, Object arg45, Object arg46, Object arg47, Object arg48, Object arg49, Object arg50, Object arg51, Object arg52, Object arg53, Object arg54, Object arg55, Object arg56, Object arg57, Object arg58, Object arg59, Object arg60, Object arg61, Object arg62, Object arg63, Object arg64, Object arg65, Object arg66, Object arg67, Object arg68, Object arg69, Object arg70, Object arg71, Object arg72, Object arg73, Object arg74, Object arg75, Object arg76, Object arg77, Object arg78, Object arg79, Object arg80, Object arg81, Object arg82, Object arg83, Object arg84, Object arg85, Object arg86, Object arg87, Object arg88, Object arg89, Object arg90, Object arg91, Object arg92, Object arg93, Object arg94, Object arg95, Object arg96, Object arg97, Object arg98, Object arg99, Object arg100) {
            return new Object[]{
                    arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19, arg20, arg21, arg22, arg23, arg24, arg25, arg26, arg27, arg28, arg29, arg30, arg31, arg32, arg33, arg34, arg35, arg36, arg37, arg38, arg39, arg40, arg41, arg42, arg43, arg44, arg45, arg46, arg47, arg48, arg49, arg50, arg51, arg52, arg53, arg54, arg55, arg56, arg57, arg58, arg59, arg60, arg61, arg62, arg63, arg64, arg65, arg66, arg67, arg68, arg69, arg70, arg71, arg72, arg73, arg74, arg75, arg76, arg77, arg78, arg79, arg80, arg81, arg82, arg83, arg84, arg85, arg86, arg87, arg88, arg89, arg90, arg91, arg92, arg93, arg94, arg95, arg96, arg97, arg98, arg99, arg100};
        }

    вот такой он - groovy

    xXx_totalwar, 02 Февраля 2011

    Комментарии (11)
  4. Pascal / Говнокод #5194

    +84

    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
    procedure TForm1.Button1Click(Sender: TObject);
    var i,i2,p,g,gg3: integer;
    gg:string;
    gg2: Real;
    begin
    g:=0;
    gg:=intTOstr((Length(Memo1.Lines.Text)));
    gg2:=StrToFloat(gg)/4;
    gg3:=Trunc(gg2);
    gg:=Memo1.Lines.Text;
    for i2:=1 to gg3 do begin
      p:=pos('котэ',gg);
      if p>0 then begin
      Delete(gg,p,4);
      g:=g+1;
      Label1.Caption:=IntToStr(g);
      end;
      end;
    end;

    Алгоритм поиска слова - "котэ" в Memo1.
    УжОс...

    firerap, 09 Января 2011

    Комментарии (6)
  5. Java / Говнокод #4791

    +84

    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
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    http://svn.codehaus.org/groovy/trunk/groovy/groovy-core/src/main/org/codehaus/groovy/runtime/ArrayUtil.java
    
    /*
     * Copyright 2003-2009 the original author or authors.
     *
     * Licensed under the Apache License, Version 2.0 (the "License");
     * you may not use this file except in compliance with the License.
     * You may obtain a copy of the License at
     *
     *     http://www.apache.org/licenses/LICENSE-2.0
     *
     * Unless required by applicable law or agreed to in writing, software
     * distributed under the License is distributed on an "AS IS" BASIS,
     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     * See the License for the specific language governing permissions and
     * limitations under the License.
     */
    package org.codehaus.groovy.runtime;
    
    public class ArrayUtil {
        private static final Object[] EMPTY = new Object[0]
                ;
    
        public static Object[] createArray() {
            return EMPTY;
        }
    
        public static Object[] createArray(Object arg0) {
            return new Object[]{
                    arg0};
        }
    
        public static Object[] createArray(Object arg0, Object arg1) {
            return new Object[]{
                    arg0, arg1};
        }
    
        public static Object[] createArray(Object arg0, Object arg1, Object arg2) {
            return new Object[]{
                    arg0, arg1, arg2};
        }
    
        public static Object[] createArray(Object arg0, Object arg1, Object arg2, Object arg3) {
            return new Object[]{
                    arg0, arg1, arg2, arg3};
        }
    
        public static Object[] createArray(Object arg0, Object arg1, Object arg2, Object arg3, Object arg4) {
            return new Object[]{
                    arg0, arg1, arg2, arg3, arg4};
        }
    
        public static Object[] createArray(Object arg0, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5) {
            return new Object[]{
                    arg0, arg1, arg2, arg3, arg4, arg5};
        }
    
        public static Object[] createArray(Object arg0, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6) {
            return new Object[]{
                    arg0, arg1, arg2, arg3, arg4, arg5, arg6};
        }
    
    ............

    bytes, 30 Ноября 2010

    Комментарии (7)
  6. Java / Говнокод #4726

    +84

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    try {
                    if (field[i][j + 1] == 0) {
                        field[i][j + 1] = 2;
                        fifo.add(new Cell(i, j + 1));
                    }
                } catch (ArrayIndexOutOfBoundsException ignored) {
                }

    Плевать на то что будет стучаться к несуществующему элементу массива, заигнорим и все!

    dexatot, 23 Ноября 2010

    Комментарии (8)
  7. Java / Говнокод #4114

    +84

    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
    for (int hasFirstPass = 0; hasFirstPass <= 1; ++hasFirstPass) {
                    for (int firstPassOffsetLeft = 0; firstPassOffsetLeft <= hasFirstPass; ++firstPassOffsetLeft) {
                        for (int firstPassOffsetRight = 0; firstPassOffsetRight <= hasFirstPass; ++firstPassOffsetRight) {
                            for (int firstPassOffsetTop = 0; firstPassOffsetTop <= hasFirstPass * 2; ++firstPassOffsetTop) {
                                for (int firstPassOffsetBottom = 0; firstPassOffsetBottom <= hasFirstPass * 2; ++firstPassOffsetBottom) {
                                    for (int hasSecondPass = 0; hasSecondPass <= 1; ++hasSecondPass) {
                                        for (int secondPassOffsetLeft = 0; secondPassOffsetLeft <= hasSecondPass * 2; ++secondPassOffsetLeft) {
                                            for (int secondPassOffsetRight = 0; secondPassOffsetRight <= hasSecondPass * 2; ++secondPassOffsetRight) {
                                                for (int secondPassOffsetTop =
                                                        0; secondPassOffsetTop <= hasSecondPass; ++secondPassOffsetTop) {
                                                    for (int secondPassOffsetBottom =
                                                            0; secondPassOffsetBottom <= hasSecondPass; ++secondPassOffsetBottom) {
    
                                                        // ... some processing code
                                                        
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }

    Есть некоторая обработка прямоугольника, проводящаяся в два этапа. Причём на первом этапе отступ от правого и левого края может быть не более 1, от верхнего и нижнего не более 2. На втором этапе наоборот. Каждый из этапов может отсутствовать, в таком случае естественно перебирать варианты отступа для этого этапа не нужно.

    Этот код перебирает все возможные варианты такой обработки.

    burdakovd, 27 Августа 2010

    Комментарии (36)
  8. Куча / Говнокод #3676

    +84

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    <TABLE Border=0 cellpadding=1 cellspacing=1 width=100%>
    <tr><td valign=top width=49%><table Border=0 cellpadding=0 cellspacing=0 width=100% height=100%><tr>
    <td><TABLE valign=top Border=0 cellpadding=0 cellspacing=0 bgcolor=#EEEEEE width=100% height=100%>
    <tr height=1><td align=center colspan=6 class=text2 bgcolor='#91A9B0'>Список подразделений</td></tr>
    <tr height=1><td colspan=6 class='TablHeadText' bgcolor=#EDF1F2><a href='javascript:GoTown(1)'>.. наверх</a></td></tr><tr height=1><td align=center class=TitleName bgcolor=#E0E7E9>&nbsp;</td><td align=center class=TitleName bgcolor=#E0E7E9>Наименование</td><td align=center class=TitleName bgcolor=#E0E7E9>Бранч</td><td align=center class=TitleName bgcolor=#E0E7E9 Title='Группа'>Гр.</td><td align=center class=TitleName bgcolor=#E0E7E9 Title='Форма создания'>Инд. 1</td><td align=center class=TitleName bgcolor=#E0E7E9 Title='Целевая направленность'>Инд. 2</td></tr><tr><td bgcolor=#EDF1F2 width=1 align=right class=link vAlign=top>+</td><td bgcolor=#EDF1F2 class=linktext vAlign=top></td><td bgcolor=#EDF1F2 class='TablHeadText' align=center></td><td align=center bgcolor=#EDF1F2 class='TablHeadText' align=center>ГБ</td><td align=center bgcolor=#EDF1F2 class='TablHeadText' align=center>&nbsp;</td><td align=center bgcolor=#EDF1F2 class='TablHeadText' align=center>&nbsp;</td><td bgcolor=#E0E7E9 class='TablHeadText' align=center>DOH0</td><td align=center bgcolor=#E0E7E9 class='TablHeadText' align=center>РУ</td><td align=center bgcolor=#E0E7E9 class='TablHeadText' align=center>&nbsp;</td><td align=center bgcolor=#E0E7E9 class='TablHeadText' align=center>&nbsp;</td></tr>

    и наверное килобайт 200 такого <td align=center bgcolor=#E0E7E9 class='TablHeadText'> треша

    3.14159265, 09 Июля 2010

    Комментарии (26)
  9. Java / Говнокод #3070

    +84

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    public void setPhones(List<PhoneNumber> phones) throws Exception {
        this.phones = phones;
        this.phones.clear();
        this.phones.addAll(phones);
    }

    Вот такой метод нашёл сегодня в коде.

    asolntsev, 21 Апреля 2010

    Комментарии (10)
  10. C++ / Говнокод #1273

    +84

    1. 1
    2. 2
    3. 3
    char* c=a;
    char* d=b;
    while(*(c++)=*(d++));

    Кажется страус труп предложил. Копирование из буфера PChar b в буфер PChar a.

    guest, 28 Июня 2009

    Комментарии (8)
  11. Java / Говнокод #1784

    +83.9

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    /**
         * проебразует объект <code>o</code> в объект
         *
         * @param o объект
         * @return объект со значением <code>o</code>
         */
        public static Object toObject(Object o) {
            return o;
        }

    Полное отсутствие знаний основ java

    johnsoft, 07 Сентября 2009

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