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. The Lounge
  3. Laziest code you've seen this week?

Laziest code you've seen this week?

Scheduled Pinned Locked Moved The Lounge
asp-netjavascriptvisual-studioarchitecturequestion
24 Posts 19 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.
  • C Offline
    C Offline
    Chris Maunder
    wrote on last edited by
    #1

    I have deadlines and I have code to write, and that means I'm constantly doing the devil vs angel "but no one will notice" conversation with code. Maybe I do var count = GetCount(); which seems fine except it's lazy and GetCount() actually returns a long not an int and so the next person comes along wanting to punch you because they have to do a cast. Or instead of using a repeater in a WebForms app* I just inline the logic directly into the ASPX page. Or I do

    string output = "value1";
    output += "value2";
    output += "value2";
    ...
    output += "valueN";

    return output;

    Another 4 hrs till beer o'clock and I know things will go downhill properly before then. So what's the worst you've seen done. Or done yourself? * And yes, the real laziness here is not rewriting the entire WebForms app in MVC. Or Angular. Or Blazor. Or ...

    cheers Chris Maunder

    OriginalGriffO K Sander RosselS L R 18 Replies Last reply
    0
    • C Chris Maunder

      I have deadlines and I have code to write, and that means I'm constantly doing the devil vs angel "but no one will notice" conversation with code. Maybe I do var count = GetCount(); which seems fine except it's lazy and GetCount() actually returns a long not an int and so the next person comes along wanting to punch you because they have to do a cast. Or instead of using a repeater in a WebForms app* I just inline the logic directly into the ASPX page. Or I do

      string output = "value1";
      output += "value2";
      output += "value2";
      ...
      output += "valueN";

      return output;

      Another 4 hrs till beer o'clock and I know things will go downhill properly before then. So what's the worst you've seen done. Or done yourself? * And yes, the real laziness here is not rewriting the entire WebForms app in MVC. Or Angular. Or Blazor. Or ...

      cheers Chris Maunder

      OriginalGriffO Offline
      OriginalGriffO Offline
      OriginalGriff
      wrote on last edited by
      #2

      Chris Maunder wrote:

      So what's the worst you've seen done. Or done yourself?

      Writing self-modifying Z80 assembler code to process caps lock on a VDT? Yes, that was me ... in my defence it was a long time ago and the VDT's are almost certainly crumbled to dust by now. Anyone seen a Lynwood Alpha or Beta? Or even heard of 'em?

      Sent from my Amstrad PC 1640 Never throw anything away, Griff Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

      1 Reply Last reply
      0
      • C Chris Maunder

        I have deadlines and I have code to write, and that means I'm constantly doing the devil vs angel "but no one will notice" conversation with code. Maybe I do var count = GetCount(); which seems fine except it's lazy and GetCount() actually returns a long not an int and so the next person comes along wanting to punch you because they have to do a cast. Or instead of using a repeater in a WebForms app* I just inline the logic directly into the ASPX page. Or I do

        string output = "value1";
        output += "value2";
        output += "value2";
        ...
        output += "valueN";

        return output;

        Another 4 hrs till beer o'clock and I know things will go downhill properly before then. So what's the worst you've seen done. Or done yourself? * And yes, the real laziness here is not rewriting the entire WebForms app in MVC. Or Angular. Or Blazor. Or ...

        cheers Chris Maunder

        K Offline
        K Offline
        kmoorevs
        wrote on last edited by
        #3

        Chris Maunder wrote:

        So what's the worst you've seen done. Or done yourself?

        Probably coding a specific logic for a specific customer 'cause it's a one-off or I don't have time to do a proper option. Excuse me, I now have to return to a webform with two sets of nested repeaters, and a few dynamic tables thrown in for fun! For more fun, let's keep subtotals at every level and page totals using javascript. :laugh:

        "Go forth into the source" - Neal Morse

        1 Reply Last reply
        0
        • C Chris Maunder

          I have deadlines and I have code to write, and that means I'm constantly doing the devil vs angel "but no one will notice" conversation with code. Maybe I do var count = GetCount(); which seems fine except it's lazy and GetCount() actually returns a long not an int and so the next person comes along wanting to punch you because they have to do a cast. Or instead of using a repeater in a WebForms app* I just inline the logic directly into the ASPX page. Or I do

          string output = "value1";
          output += "value2";
          output += "value2";
          ...
          output += "valueN";

          return output;

          Another 4 hrs till beer o'clock and I know things will go downhill properly before then. So what's the worst you've seen done. Or done yourself? * And yes, the real laziness here is not rewriting the entire WebForms app in MVC. Or Angular. Or Blazor. Or ...

          cheers Chris Maunder

          Sander RosselS Offline
          Sander RosselS Offline
          Sander Rossel
          wrote on last edited by
          #4

          I had to get something working for a test and demo two weeks ago. I was running out of time so I hard-coded an ID and a secret into the application to connect to some services :D In my defense, it'll never see production (I'm not even sure if I believe that myself :laugh: )

          Best, Sander sanderrossel.com Continuous Integration, Delivery, and Deployment arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly

          R 1 Reply Last reply
          0
          • C Chris Maunder

            I have deadlines and I have code to write, and that means I'm constantly doing the devil vs angel "but no one will notice" conversation with code. Maybe I do var count = GetCount(); which seems fine except it's lazy and GetCount() actually returns a long not an int and so the next person comes along wanting to punch you because they have to do a cast. Or instead of using a repeater in a WebForms app* I just inline the logic directly into the ASPX page. Or I do

            string output = "value1";
            output += "value2";
            output += "value2";
            ...
            output += "valueN";

            return output;

            Another 4 hrs till beer o'clock and I know things will go downhill properly before then. So what's the worst you've seen done. Or done yourself? * And yes, the real laziness here is not rewriting the entire WebForms app in MVC. Or Angular. Or Blazor. Or ...

            cheers Chris Maunder

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

            those, and sometimes in SQL statements concatenating user input string/varchar values but only pre-release / personal test - never in release (probably a bit anal about it but I'll purposely work longer to fix these things before knocking off for the day/night ...SQL parameters, clean up strings / use stringbuilder, replace every single var with the proper type.)

            Message Signature (Click to edit ->)

            1 Reply Last reply
            0
            • Sander RosselS Sander Rossel

              I had to get something working for a test and demo two weeks ago. I was running out of time so I hard-coded an ID and a secret into the application to connect to some services :D In my defense, it'll never see production (I'm not even sure if I believe that myself :laugh: )

              Best, Sander sanderrossel.com Continuous Integration, Delivery, and Deployment arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly

              R Offline
              R Offline
              Rick York
              wrote on last edited by
              #6

              I have been bitten by that a few times. Eventually I resorted to adding little booby traps that would prevent things from being deployed as a self-defense mechanism. The first time they discovered one I told them I did that so you wouldn't do what you just did - try to use it in production. They didn't like it when I asked them, "what part of not ready for production do you not understand?" in front of three levels of bosses.

              "They have a consciousness, they have a life, they have a soul! Damn you! Let the rabbits wear glasses! Save our brothers! Can I get an amen?"

              Sander RosselS 1 Reply Last reply
              0
              • C Chris Maunder

                I have deadlines and I have code to write, and that means I'm constantly doing the devil vs angel "but no one will notice" conversation with code. Maybe I do var count = GetCount(); which seems fine except it's lazy and GetCount() actually returns a long not an int and so the next person comes along wanting to punch you because they have to do a cast. Or instead of using a repeater in a WebForms app* I just inline the logic directly into the ASPX page. Or I do

                string output = "value1";
                output += "value2";
                output += "value2";
                ...
                output += "valueN";

                return output;

                Another 4 hrs till beer o'clock and I know things will go downhill properly before then. So what's the worst you've seen done. Or done yourself? * And yes, the real laziness here is not rewriting the entire WebForms app in MVC. Or Angular. Or Blazor. Or ...

                cheers Chris Maunder

                R Offline
                R Offline
                RickZeeland
                wrote on last edited by
                #7

                A quick and dirty 'CleanupTool' I wrote in C# for use on our builder, it accepts up to three command line parameters, the start path, the directory to delete (bin), and a range of exclusions. It works with the directories we have, but don't have any expectations beyond that :-\

                1 Reply Last reply
                0
                • C Chris Maunder

                  I have deadlines and I have code to write, and that means I'm constantly doing the devil vs angel "but no one will notice" conversation with code. Maybe I do var count = GetCount(); which seems fine except it's lazy and GetCount() actually returns a long not an int and so the next person comes along wanting to punch you because they have to do a cast. Or instead of using a repeater in a WebForms app* I just inline the logic directly into the ASPX page. Or I do

                  string output = "value1";
                  output += "value2";
                  output += "value2";
                  ...
                  output += "valueN";

                  return output;

                  Another 4 hrs till beer o'clock and I know things will go downhill properly before then. So what's the worst you've seen done. Or done yourself? * And yes, the real laziness here is not rewriting the entire WebForms app in MVC. Or Angular. Or Blazor. Or ...

                  cheers Chris Maunder

                  S Offline
                  S Offline
                  Slacker007
                  wrote on last edited by
                  #8

                  Funny you mention, I am currently writing some mighty fine lazy code. Most assuredly will have to refactor everything I am writing...on Monday. :laugh:

                  1 Reply Last reply
                  0
                  • R Rick York

                    I have been bitten by that a few times. Eventually I resorted to adding little booby traps that would prevent things from being deployed as a self-defense mechanism. The first time they discovered one I told them I did that so you wouldn't do what you just did - try to use it in production. They didn't like it when I asked them, "what part of not ready for production do you not understand?" in front of three levels of bosses.

                    "They have a consciousness, they have a life, they have a soul! Damn you! Let the rabbits wear glasses! Save our brothers! Can I get an amen?"

                    Sander RosselS Offline
                    Sander RosselS Offline
                    Sander Rossel
                    wrote on last edited by
                    #9

                    I've done something like that once. It required some dubious unit tests, but they did what they should on the build server :D Everyone on the team was quite happy with them, because we did actually check in some test code a few times.

                    Best, Sander sanderrossel.com Continuous Integration, Delivery, and Deployment arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly

                    1 Reply Last reply
                    0
                    • C Chris Maunder

                      I have deadlines and I have code to write, and that means I'm constantly doing the devil vs angel "but no one will notice" conversation with code. Maybe I do var count = GetCount(); which seems fine except it's lazy and GetCount() actually returns a long not an int and so the next person comes along wanting to punch you because they have to do a cast. Or instead of using a repeater in a WebForms app* I just inline the logic directly into the ASPX page. Or I do

                      string output = "value1";
                      output += "value2";
                      output += "value2";
                      ...
                      output += "valueN";

                      return output;

                      Another 4 hrs till beer o'clock and I know things will go downhill properly before then. So what's the worst you've seen done. Or done yourself? * And yes, the real laziness here is not rewriting the entire WebForms app in MVC. Or Angular. Or Blazor. Or ...

                      cheers Chris Maunder

                      C Offline
                      C Offline
                      CPallini
                      wrote on last edited by
                      #10

                      Kidding Chris, kidding :-D

                      G 1 Reply Last reply
                      0
                      • C Chris Maunder

                        I have deadlines and I have code to write, and that means I'm constantly doing the devil vs angel "but no one will notice" conversation with code. Maybe I do var count = GetCount(); which seems fine except it's lazy and GetCount() actually returns a long not an int and so the next person comes along wanting to punch you because they have to do a cast. Or instead of using a repeater in a WebForms app* I just inline the logic directly into the ASPX page. Or I do

                        string output = "value1";
                        output += "value2";
                        output += "value2";
                        ...
                        output += "valueN";

                        return output;

                        Another 4 hrs till beer o'clock and I know things will go downhill properly before then. So what's the worst you've seen done. Or done yourself? * And yes, the real laziness here is not rewriting the entire WebForms app in MVC. Or Angular. Or Blazor. Or ...

                        cheers Chris Maunder

                        H Offline
                        H Offline
                        honey the codewitch
                        wrote on last edited by
                        #11

                        the laziest code i see is always my own. usually if my code was done the right way it's because i'm too lazy to want to have to fix it later. :laugh:

                        When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

                        1 Reply Last reply
                        0
                        • C Chris Maunder

                          I have deadlines and I have code to write, and that means I'm constantly doing the devil vs angel "but no one will notice" conversation with code. Maybe I do var count = GetCount(); which seems fine except it's lazy and GetCount() actually returns a long not an int and so the next person comes along wanting to punch you because they have to do a cast. Or instead of using a repeater in a WebForms app* I just inline the logic directly into the ASPX page. Or I do

                          string output = "value1";
                          output += "value2";
                          output += "value2";
                          ...
                          output += "valueN";

                          return output;

                          Another 4 hrs till beer o'clock and I know things will go downhill properly before then. So what's the worst you've seen done. Or done yourself? * And yes, the real laziness here is not rewriting the entire WebForms app in MVC. Or Angular. Or Blazor. Or ...

                          cheers Chris Maunder

                          H Offline
                          H Offline
                          honey the codewitch
                          wrote on last edited by
                          #12

                          bool _IsIndirectlyLeftRecursive(CfgRule rule)
                          {
                          // TODO: FIX
                          return false;
                          if (_IsLeftRecursive(rule, null))
                          return false;
                          if (FillLeftDescendants(rule).Contains(rule.Left))
                          return true;
                          return false;
                          }

                          It's not even this routine that's broken. This is to short circuit the routine that *calls it* because that fork of the conditional is broken.

                          When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

                          1 Reply Last reply
                          0
                          • C Chris Maunder

                            I have deadlines and I have code to write, and that means I'm constantly doing the devil vs angel "but no one will notice" conversation with code. Maybe I do var count = GetCount(); which seems fine except it's lazy and GetCount() actually returns a long not an int and so the next person comes along wanting to punch you because they have to do a cast. Or instead of using a repeater in a WebForms app* I just inline the logic directly into the ASPX page. Or I do

                            string output = "value1";
                            output += "value2";
                            output += "value2";
                            ...
                            output += "valueN";

                            return output;

                            Another 4 hrs till beer o'clock and I know things will go downhill properly before then. So what's the worst you've seen done. Or done yourself? * And yes, the real laziness here is not rewriting the entire WebForms app in MVC. Or Angular. Or Blazor. Or ...

                            cheers Chris Maunder

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

                            Chris Maunder wrote:

                            Laziest code you've seen this week?

                            The fix for:

                            [ISC-Bugs #29769]
                            Inbound packets with UDP checksums of 0xffff now validate correctly rather than being dropped.

                            Best Wishes, -David Delaune

                            H 1 Reply Last reply
                            0
                            • C Chris Maunder

                              I have deadlines and I have code to write, and that means I'm constantly doing the devil vs angel "but no one will notice" conversation with code. Maybe I do var count = GetCount(); which seems fine except it's lazy and GetCount() actually returns a long not an int and so the next person comes along wanting to punch you because they have to do a cast. Or instead of using a repeater in a WebForms app* I just inline the logic directly into the ASPX page. Or I do

                              string output = "value1";
                              output += "value2";
                              output += "value2";
                              ...
                              output += "valueN";

                              return output;

                              Another 4 hrs till beer o'clock and I know things will go downhill properly before then. So what's the worst you've seen done. Or done yourself? * And yes, the real laziness here is not rewriting the entire WebForms app in MVC. Or Angular. Or Blazor. Or ...

                              cheers Chris Maunder

                              R Offline
                              R Offline
                              Rajesh R Subramanian
                              wrote on last edited by
                              #14

                              This is from about a week ago. I wrote a routine that captures the user comments about certain states of a map (like, an actual map of a city). This routine is then supposed to store it to be read by another piece of code that generates reports. Out of my superior wisdom, I elected that the path to the map images captured, the associated comments, etc. should be stored as a CSV file (don't ask - it was 5.40PM). I spent the next morning trying to figure out why the report generation was tripping up. Of course, the user could enter commas in their comments (the strings aren't quoted) and that did horrible things to the naive CSV parser. I have since cleaned up traces of my idiocy and all data now properly goes into a database table from where it gets read.

                              1 Reply Last reply
                              0
                              • C Chris Maunder

                                I have deadlines and I have code to write, and that means I'm constantly doing the devil vs angel "but no one will notice" conversation with code. Maybe I do var count = GetCount(); which seems fine except it's lazy and GetCount() actually returns a long not an int and so the next person comes along wanting to punch you because they have to do a cast. Or instead of using a repeater in a WebForms app* I just inline the logic directly into the ASPX page. Or I do

                                string output = "value1";
                                output += "value2";
                                output += "value2";
                                ...
                                output += "valueN";

                                return output;

                                Another 4 hrs till beer o'clock and I know things will go downhill properly before then. So what's the worst you've seen done. Or done yourself? * And yes, the real laziness here is not rewriting the entire WebForms app in MVC. Or Angular. Or Blazor. Or ...

                                cheers Chris Maunder

                                T Offline
                                T Offline
                                Tim Deveaux
                                wrote on last edited by
                                #15

                                Chris Maunder wrote:

                                And yes, the real laziness here is not rewriting the entire WebForms app in MVC. Or Angular. Or Blazor. Or ...

                                PHP?

                                1 Reply Last reply
                                0
                                • C Chris Maunder

                                  I have deadlines and I have code to write, and that means I'm constantly doing the devil vs angel "but no one will notice" conversation with code. Maybe I do var count = GetCount(); which seems fine except it's lazy and GetCount() actually returns a long not an int and so the next person comes along wanting to punch you because they have to do a cast. Or instead of using a repeater in a WebForms app* I just inline the logic directly into the ASPX page. Or I do

                                  string output = "value1";
                                  output += "value2";
                                  output += "value2";
                                  ...
                                  output += "valueN";

                                  return output;

                                  Another 4 hrs till beer o'clock and I know things will go downhill properly before then. So what's the worst you've seen done. Or done yourself? * And yes, the real laziness here is not rewriting the entire WebForms app in MVC. Or Angular. Or Blazor. Or ...

                                  cheers Chris Maunder

                                  K Offline
                                  K Offline
                                  KarstenK
                                  wrote on last edited by
                                  #16

                                  If no problem with lazy code, but with some people which write big work around with new flags and handling for one special case as my mate proposed on friday afternoon . X| I replies on friday afternoon I dont start new coding tasks.:cool:

                                  Press F1 for help or google it. Greetings from Germany

                                  1 Reply Last reply
                                  0
                                  • L Lost User

                                    Chris Maunder wrote:

                                    Laziest code you've seen this week?

                                    The fix for:

                                    [ISC-Bugs #29769]
                                    Inbound packets with UDP checksums of 0xffff now validate correctly rather than being dropped.

                                    Best Wishes, -David Delaune

                                    H Offline
                                    H Offline
                                    honey the codewitch
                                    wrote on last edited by
                                    #17

                                    there's just gotta be an exploit in there somewhere.

                                    When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

                                    1 Reply Last reply
                                    0
                                    • C Chris Maunder

                                      I have deadlines and I have code to write, and that means I'm constantly doing the devil vs angel "but no one will notice" conversation with code. Maybe I do var count = GetCount(); which seems fine except it's lazy and GetCount() actually returns a long not an int and so the next person comes along wanting to punch you because they have to do a cast. Or instead of using a repeater in a WebForms app* I just inline the logic directly into the ASPX page. Or I do

                                      string output = "value1";
                                      output += "value2";
                                      output += "value2";
                                      ...
                                      output += "valueN";

                                      return output;

                                      Another 4 hrs till beer o'clock and I know things will go downhill properly before then. So what's the worst you've seen done. Or done yourself? * And yes, the real laziness here is not rewriting the entire WebForms app in MVC. Or Angular. Or Blazor. Or ...

                                      cheers Chris Maunder

                                      M Offline
                                      M Offline
                                      Member 9167057
                                      wrote on last edited by
                                      #18

                                      The worst I've done was low-level parsing in the high-level part of my parser. The low-level part I inherited is, understandably, somewhat complex and I was running low on time so I've made a low-level distinction between two values in the high-level part framed with a comment about how sorry I am.

                                      1 Reply Last reply
                                      0
                                      • C Chris Maunder

                                        I have deadlines and I have code to write, and that means I'm constantly doing the devil vs angel "but no one will notice" conversation with code. Maybe I do var count = GetCount(); which seems fine except it's lazy and GetCount() actually returns a long not an int and so the next person comes along wanting to punch you because they have to do a cast. Or instead of using a repeater in a WebForms app* I just inline the logic directly into the ASPX page. Or I do

                                        string output = "value1";
                                        output += "value2";
                                        output += "value2";
                                        ...
                                        output += "valueN";

                                        return output;

                                        Another 4 hrs till beer o'clock and I know things will go downhill properly before then. So what's the worst you've seen done. Or done yourself? * And yes, the real laziness here is not rewriting the entire WebForms app in MVC. Or Angular. Or Blazor. Or ...

                                        cheers Chris Maunder

                                        S Offline
                                        S Offline
                                        Simon Hart 0
                                        wrote on last edited by
                                        #19

                                        I wrote a C++ program to close a dialog which is left open by another program when it loses it's connectionto SQL Server, which it does on a not infrequent basis. In my defence: 1. The offending program is written in VB6 and I am not refactoring that. 2. It is running on Windows 7. Not an actual server OS. (Until last year when the physical hardware got vitualised it was XP) 3. No one else here really knows C++ so that will be my lasting gift to them :-D

                                        1 Reply Last reply
                                        0
                                        • C CPallini

                                          Kidding Chris, kidding :-D

                                          G Offline
                                          G Offline
                                          Gary Wheeler
                                          wrote on last edited by
                                          #20

                                          :laugh:

                                          Software Zen: delete this;

                                          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