Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. It's a jungle in there

It's a jungle in there

Scheduled Pinned Locked Moved The Weird and The Wonderful
24 Posts 14 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R RobCroll

    I feel your pain. I've just finished going through a similar process. After a while you stop getting annoyed and start laughing. The one that made me laugh most was:

    public class OrderName
    {
    public String getName {
    return "Order";
    }
    }

    That was the class in totality. One method that returned a hard coded value. [EDIT] I just found a better one:

    for (int i = 1; i < 2; i++) {
    //Code was here
    }

    "You get that on the big jobs."

    modified on Sunday, August 14, 2011 10:23 PM

    G Offline
    G Offline
    GibbleCH
    wrote on last edited by
    #21

    Reminds me of things like this...

    for (int i = 0; i < 5; i++) {
    switch (i) {
    case 1: {

        }
        case 2: {
    
        }
        case 3: {
    
        }
        case 4: {
    
        }
        case 5: {
    
        }
        default: {
    
        }
    }
    

    }

    1 Reply Last reply
    0
    • G GibbleCH

      I was refactoring a horribly written app. Tons of duplicated code. Crazy amounts of dead code (~30-50%). And my personal favourite, was a method that went something like this.

      public void Some_Method()
      {
      try
      {

      }
      catch (Exception x)
      {
          LogException(x);
      }
      

      }

      Fortunately, or not, this method was never called...but I sure am glad the catch block was there....just in case that empty try block failed.

      R Offline
      R Offline
      richard_k
      wrote on last edited by
      #22

      This code feels like some Zen koan or something.. If a tree falls in the forest but no one is around, does it make a noise?

      1 Reply Last reply
      0
      • F Fabio Franco

        Naerling wrote:

        Perhaps the empty Catch is also VB6 inspired... OnErrorResumeNext

        Is it just me or everytime someone talks about bad code, "VB" shows up? :sigh:

        "To alcohol! The cause of, and solution to, all of life's problems" - Homer Simpson

        C Offline
        C Offline
        cpkilekofp
        wrote on last edited by
        #23

        Fabio Franco wrote:

        Is it just me or everytime someone talks about bad code, "VB" shows up? :sigh:

        It's just you - the worst code was (and may still be) written in C/C++ by former BASIC, COBOL, and FORTRAN programmers still new to Dykstra's "GoTo Considered Harmful" dictum...which didn't prevent them from abusing every feature in the language. I spent years cleaning such code, and still don't think I got everything fixed the way it should be (e.g. readable). BASIC, COBOL, and FORTRAN all allowed really bad code to be developed, real "spaghetti" code, but recasting the same engineering in C (or, worse by two or three orders of magnitude in this age of templates, C++) permits monstrosities to be created that even the coders may not be able to understand after a month or two working on other projects. Worse, with macros, you can make C/C++ look like BASIC or FORTRAN...perhaps even COBOL, though I've never seen anyone sick enough to try that (yes, I've seen examples of the other two practices, and it just makes you ill to see it if you ever loved C). As for On Error Resume Next....what other language system can anyone name that is as ubiquitous as BASIC, COBOL, FORTRAN, or C that allowed a non-in-line interrupt-style error handler to be constructed? Yes, the only one that comes to my mind, as well, is BASIC. On Error GoTo was a huge advance for its time; On Error Resume Next was, really, just a way to allow "old-fashioned" error handling (checking output variables and return values for error conditions) to be used or not. Most of the cocks-of-the-progamming-walk who complain about the foibles of this feature just weren't around to complain about it in 1968 when Dartmouth BASIC was released; if it seems a dated feature now, well, OF COURSE IT IS. Hmmm, does this count as a rant? :laugh:

        F 1 Reply Last reply
        0
        • C cpkilekofp

          Fabio Franco wrote:

          Is it just me or everytime someone talks about bad code, "VB" shows up? :sigh:

          It's just you - the worst code was (and may still be) written in C/C++ by former BASIC, COBOL, and FORTRAN programmers still new to Dykstra's "GoTo Considered Harmful" dictum...which didn't prevent them from abusing every feature in the language. I spent years cleaning such code, and still don't think I got everything fixed the way it should be (e.g. readable). BASIC, COBOL, and FORTRAN all allowed really bad code to be developed, real "spaghetti" code, but recasting the same engineering in C (or, worse by two or three orders of magnitude in this age of templates, C++) permits monstrosities to be created that even the coders may not be able to understand after a month or two working on other projects. Worse, with macros, you can make C/C++ look like BASIC or FORTRAN...perhaps even COBOL, though I've never seen anyone sick enough to try that (yes, I've seen examples of the other two practices, and it just makes you ill to see it if you ever loved C). As for On Error Resume Next....what other language system can anyone name that is as ubiquitous as BASIC, COBOL, FORTRAN, or C that allowed a non-in-line interrupt-style error handler to be constructed? Yes, the only one that comes to my mind, as well, is BASIC. On Error GoTo was a huge advance for its time; On Error Resume Next was, really, just a way to allow "old-fashioned" error handling (checking output variables and return values for error conditions) to be used or not. Most of the cocks-of-the-progamming-walk who complain about the foibles of this feature just weren't around to complain about it in 1968 when Dartmouth BASIC was released; if it seems a dated feature now, well, OF COURSE IT IS. Hmmm, does this count as a rant? :laugh:

          F Offline
          F Offline
          Fabio Franco
          wrote on last edited by
          #24

          cpkilekofp wrote:

          Hmmm, does this count as a rant? :laugh:

          Oh definitely :laugh: . Please don't take this personally :)

          cpkilekofp wrote:

          the worst code was (and may still be) written in C/C++

          Nobody said that the worse code seen was in VB. The joke was about how often the name Ugly Betty comes up whenever we are talking about ugly girls.

          "To alcohol! The cause of, and solution to, all of life's problems" - Homer Simpson

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups