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. 9000 lines of ...

9000 lines of ...

Scheduled Pinned Locked Moved The Weird and The Wonderful
csharpasp-netjsonquestion
16 Posts 9 Posters 0 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.
  • L Lost User

    ... stuff like this:

    switch (Session["Benutzer_Firma"].ToString()) // calling ToString() may cause a null reference exception
    {
    case "ABC":
    lblManipulation.Text = "Some text in a label";
    break;

    case "DEF":
        lblManipulation.Text = "Some other text in a label";
        break;
    
    case "Default":
        lblManipulation.Text = "The default text for the label";
        break;
    
    default:
        goto case "Default";  // from what planet does this guy come from?
        break;                // unreachable code
    

    }

    I just found this in a 9000 line ASP.Net page and the rest of it is not a bit better than this. The only things I have changed are the literal strings because the company was mentioned there several times. Especially the lines with the switch statement and the default case are inspiring. And am I too harsh if I want to have the 'developer' thrown out of the guild, tarred, feathered and then chased out of the city?

    I'm invincible, I can't be vinced

    S Offline
    S Offline
    Sean Holm
    wrote on last edited by
    #4

    ITS OVER NINE THOUSAAAAAAAAAAAANND http://www.youtube.com/watch?v=SiMHTK15Pik[^] *goes back to lurking*

    "What bug? It runs fine on my workstation"

    1 Reply Last reply
    0
    • L Lost User

      ... stuff like this:

      switch (Session["Benutzer_Firma"].ToString()) // calling ToString() may cause a null reference exception
      {
      case "ABC":
      lblManipulation.Text = "Some text in a label";
      break;

      case "DEF":
          lblManipulation.Text = "Some other text in a label";
          break;
      
      case "Default":
          lblManipulation.Text = "The default text for the label";
          break;
      
      default:
          goto case "Default";  // from what planet does this guy come from?
          break;                // unreachable code
      

      }

      I just found this in a 9000 line ASP.Net page and the rest of it is not a bit better than this. The only things I have changed are the literal strings because the company was mentioned there several times. Especially the lines with the switch statement and the default case are inspiring. And am I too harsh if I want to have the 'developer' thrown out of the guild, tarred, feathered and then chased out of the city?

      I'm invincible, I can't be vinced

      B Offline
      B Offline
      BobJanova
      wrote on last edited by
      #5

      :sigh:

      1 Reply Last reply
      0
      • L Lost User

        ... stuff like this:

        switch (Session["Benutzer_Firma"].ToString()) // calling ToString() may cause a null reference exception
        {
        case "ABC":
        lblManipulation.Text = "Some text in a label";
        break;

        case "DEF":
            lblManipulation.Text = "Some other text in a label";
            break;
        
        case "Default":
            lblManipulation.Text = "The default text for the label";
            break;
        
        default:
            goto case "Default";  // from what planet does this guy come from?
            break;                // unreachable code
        

        }

        I just found this in a 9000 line ASP.Net page and the rest of it is not a bit better than this. The only things I have changed are the literal strings because the company was mentioned there several times. Especially the lines with the switch statement and the default case are inspiring. And am I too harsh if I want to have the 'developer' thrown out of the guild, tarred, feathered and then chased out of the city?

        I'm invincible, I can't be vinced

        F Offline
        F Offline
        fjdiewornncalwe
        wrote on last edited by
        #6

        At least this developer understands "how" to use switch statement syntax. I have had the experience of working on code where the developer clearly didn't understand this construct, or simple loops for that matter. It was commonplace to see the good old if...else approach instead of switch statements where they could be applied.

        I wasn't, now I am, then I won't be anymore.

        L E 2 Replies Last reply
        0
        • F fjdiewornncalwe

          At least this developer understands "how" to use switch statement syntax. I have had the experience of working on code where the developer clearly didn't understand this construct, or simple loops for that matter. It was commonplace to see the good old if...else approach instead of switch statements where they could be applied.

          I wasn't, now I am, then I won't be anymore.

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #7

          Wow. You actually found something the good man did right. But believe me, it's of little help. You can see by the 9000 lines in one single .aspx what kind of redundant spaghetti code he likes to produce. He practically tries to do everything with strings (why do they always have to do that?). All the code is written as if nothing can ever go wrong. When one of the abundant exceptions is thrown, it usually is not handled in any way. Here and there he uses try and catch, but only to sweep the errors under the rug and go on as if nothing has happened. This man has never heard of OOP and he uses only static methods, probably because he also never heard anything about classes and instances. Please believe me, the whole thing is a chaotic unmaintainable mess.

          I'm invincible, I can't be vinced

          F 1 Reply Last reply
          0
          • L Lost User

            Wow. You actually found something the good man did right. But believe me, it's of little help. You can see by the 9000 lines in one single .aspx what kind of redundant spaghetti code he likes to produce. He practically tries to do everything with strings (why do they always have to do that?). All the code is written as if nothing can ever go wrong. When one of the abundant exceptions is thrown, it usually is not handled in any way. Here and there he uses try and catch, but only to sweep the errors under the rug and go on as if nothing has happened. This man has never heard of OOP and he uses only static methods, probably because he also never heard anything about classes and instances. Please believe me, the whole thing is a chaotic unmaintainable mess.

            I'm invincible, I can't be vinced

            F Offline
            F Offline
            fjdiewornncalwe
            wrote on last edited by
            #8

            CDP1802 wrote:

            Here and there he uses try and catch, but only to sweep the errors under the rug and go on as if nothing has happened. This man has never heard of OOP and he uses only static methods, probably because he also never heard anything about classes and instances.

            I'm thinking we know the same developer here. :) I figure that if you are a professional developer for more than 1 year you will run into code like this and know a developer who likes to make spaghetti.

            CDP1802 wrote:

            Please believe me, the whole thing is a chaotic unmaintainable mess.

            You're preaching to the choir here. I totally agree that it would be.

            I wasn't, now I am, then I won't be anymore.

            L J 2 Replies Last reply
            0
            • L Lost User

              ... stuff like this:

              switch (Session["Benutzer_Firma"].ToString()) // calling ToString() may cause a null reference exception
              {
              case "ABC":
              lblManipulation.Text = "Some text in a label";
              break;

              case "DEF":
                  lblManipulation.Text = "Some other text in a label";
                  break;
              
              case "Default":
                  lblManipulation.Text = "The default text for the label";
                  break;
              
              default:
                  goto case "Default";  // from what planet does this guy come from?
                  break;                // unreachable code
              

              }

              I just found this in a 9000 line ASP.Net page and the rest of it is not a bit better than this. The only things I have changed are the literal strings because the company was mentioned there several times. Especially the lines with the switch statement and the default case are inspiring. And am I too harsh if I want to have the 'developer' thrown out of the guild, tarred, feathered and then chased out of the city?

              I'm invincible, I can't be vinced

              S Offline
              S Offline
              Stefan_Lang
              wrote on last edited by
              #9

              Only 9000 lines of switch cases? :zzz: I once found a database update function in a client-server app that had >10000 lines of if/else statements containing hardcoded table and database fieldnames, and field types. (I was supposed to fix it so it would reflect a recent change of the database scheme). The person responsible for that later got hired by a head hunter. No kidding! :omg:

              L 1 Reply Last reply
              0
              • S Stefan_Lang

                Only 9000 lines of switch cases? :zzz: I once found a database update function in a client-server app that had >10000 lines of if/else statements containing hardcoded table and database fieldnames, and field types. (I was supposed to fix it so it would reflect a recent change of the database scheme). The person responsible for that later got hired by a head hunter. No kidding! :omg:

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #10

                Stefan_Lang wrote:

                Only 9000 lines of switch cases? :zzz:

                No, that would just be boring. The switch was just a small sample from that spaghetti bowl. There is a Save() method, 1000 lines long, where he cobbles together a dataset. He begins by selecting some data from each table and then throwing away the results of his queries to get a DataSet with empty DataTables. Then he adds or removes some columns here and there and starts filling the newly configured DataSet with new rows and then finally tweaking the DataSet into storing this mess. At times I think this guy was a saboteur who deliberately tried to write the worst possible code. I could not come up with anything like that even if I wanted to.

                I'm invincible, I can't be vinced

                E 1 Reply Last reply
                0
                • F fjdiewornncalwe

                  CDP1802 wrote:

                  Here and there he uses try and catch, but only to sweep the errors under the rug and go on as if nothing has happened. This man has never heard of OOP and he uses only static methods, probably because he also never heard anything about classes and instances.

                  I'm thinking we know the same developer here. :) I figure that if you are a professional developer for more than 1 year you will run into code like this and know a developer who likes to make spaghetti.

                  CDP1802 wrote:

                  Please believe me, the whole thing is a chaotic unmaintainable mess.

                  You're preaching to the choir here. I totally agree that it would be.

                  I wasn't, now I am, then I won't be anymore.

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #11

                  Our intern is a beginner. He makes mistakes, but he also is a smart young guy and really interested in learning. He makes progress and one day will be a good man in any team. I hope he does not read this :) The fellow who wrote this stuff here has produced several websites, one more horrible than the next. There is no sign of learning at all. The first application of his we replaced was so bad that we wanted to post the complete source of it in this forum or publish it as a book (with critical annotations). In a way I pity him. Having to work without obviously knowing what he was doing and having to deliver something that at least appears to work on time must have been a nightmare. And every time I have to keep his stuff working without getting to replace it altogether I swear to drown him in the river should he ever cross my path.

                  I'm invincible, I can't be vinced

                  1 Reply Last reply
                  0
                  • F fjdiewornncalwe

                    At least this developer understands "how" to use switch statement syntax. I have had the experience of working on code where the developer clearly didn't understand this construct, or simple loops for that matter. It was commonplace to see the good old if...else approach instead of switch statements where they could be applied.

                    I wasn't, now I am, then I won't be anymore.

                    E Offline
                    E Offline
                    ekolis
                    wrote on last edited by
                    #12

                    What's so bad about if/else? I actually prefer using it in place of switch, just because switch is so ugly - you need a "break" after each case's statements? Seriously? I suppose it's not so bad in VB, where you're already using "end" statements instead of curly braces, but in C#, it just looks bad...

                    1 Reply Last reply
                    0
                    • L Lost User

                      Stefan_Lang wrote:

                      Only 9000 lines of switch cases? :zzz:

                      No, that would just be boring. The switch was just a small sample from that spaghetti bowl. There is a Save() method, 1000 lines long, where he cobbles together a dataset. He begins by selecting some data from each table and then throwing away the results of his queries to get a DataSet with empty DataTables. Then he adds or removes some columns here and there and starts filling the newly configured DataSet with new rows and then finally tweaking the DataSet into storing this mess. At times I think this guy was a saboteur who deliberately tried to write the worst possible code. I could not come up with anything like that even if I wanted to.

                      I'm invincible, I can't be vinced

                      E Offline
                      E Offline
                      ekolis
                      wrote on last edited by
                      #13

                      Adding and removing COLUMNS in a dataset while attempting to SAVE? Dear God, is he running ALTER TABLE statements in a save routine? Or just removing columns he doesn't actually want to persist?

                      L 1 Reply Last reply
                      0
                      • E ekolis

                        Adding and removing COLUMNS in a dataset while attempting to SAVE? Dear God, is he running ALTER TABLE statements in a save routine? Or just removing columns he doesn't actually want to persist?

                        L Offline
                        L Offline
                        Lost User
                        wrote on last edited by
                        #14

                        Perhaps that's perfectly normal on some obscure planet where he comes from. It rally truned out that he casually binds the dataset to a report before saving, so that you can print that out. The columns are added or removed according to the user's role and are perhaps added again after opening the report. Ahh, yes, he had to fill the some values into the newly added columns. He only does that in the first rows of the tables and ignores all others. That's also a common pattern in one of his other creations. He always assumes that datatables are filled with exactly one row, no more, no less. Anyway, he must have discovered that he needed an XML schema of the dataset, so he simply saves it after finishing his manipulation. Great idea. This way the schema is always accurate, no matter which route we took through the spaghetti code. My best guess is that the report was added later and that he needed two or three slightly different reports, depending on the user's role. Anybody exept him would have clicked together a schema, created a typed dataset from it and added different queries to fill it for the different roles. Filling and binding it would have been something around 15 lines of code. But don't worry too much about the database. Not a single table had a primary key and of course no foreign keys or other constraints. Why should he need them since he apparently believes that his queries always return exactly one row? I would not put it beyond him to simply reverse his manipulations in the dataset before saving. I honestly will not look if I don't have to.

                        I'm invincible, I can't be vinced

                        1 Reply Last reply
                        0
                        • F fjdiewornncalwe

                          CDP1802 wrote:

                          Here and there he uses try and catch, but only to sweep the errors under the rug and go on as if nothing has happened. This man has never heard of OOP and he uses only static methods, probably because he also never heard anything about classes and instances.

                          I'm thinking we know the same developer here. :) I figure that if you are a professional developer for more than 1 year you will run into code like this and know a developer who likes to make spaghetti.

                          CDP1802 wrote:

                          Please believe me, the whole thing is a chaotic unmaintainable mess.

                          You're preaching to the choir here. I totally agree that it would be.

                          I wasn't, now I am, then I won't be anymore.

                          J Offline
                          J Offline
                          JackDingler
                          wrote on last edited by
                          #15

                          I got chewed out by a boss once, who said it's impossible not to write spaghetti code. So we should always write spaghetti code, and write the best spaghetti code we can. I also got a bad review for the following: 1. Too many classes in my code. 2. Too much code. 3. The code is too structured. Toward the end of my employment there, he made a rule that no bug fix, or new feature could go over three lines of code...

                          T 1 Reply Last reply
                          0
                          • J JackDingler

                            I got chewed out by a boss once, who said it's impossible not to write spaghetti code. So we should always write spaghetti code, and write the best spaghetti code we can. I also got a bad review for the following: 1. Too many classes in my code. 2. Too much code. 3. The code is too structured. Toward the end of my employment there, he made a rule that no bug fix, or new feature could go over three lines of code...

                            T Offline
                            T Offline
                            theMadCoder
                            wrote on last edited by
                            #16

                            I hate when the boss is a complete idiot

                            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