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. have you ever been stuck on a programming problem

have you ever been stuck on a programming problem

Scheduled Pinned Locked Moved The Lounge
helpdatabasequestion
57 Posts 36 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.
  • B BruceN

    (This will probably result in a ban, but whatever) So bizarre, so obtuse you just can't see the answer? I got blindsided and walked into a legacy project I swear was written by Martians. We have such gems as magic numbers: return code 97. WTF? Or let's change the code based on the return value of a frick'n button that you just changed the text on: Ok becomes Done, for no reason in the thinking universe I've been banging my head against the wall for the last 6 months over a damn print routine, which is called all over the place, but is rewritten 3 different ways. And don't get me started on the database side of things. It's possible, and happens on a daily basis, to enter a completely illogical combination of products, suppliers and customers and insert that into the db in such a way as to f*** everything over for the next thousand years. You'd have to be a floating database guru clad in a white toga and ghandi level of sereneness to fix this [redacted] fustercluck. Edits: [Bertschi]Redacted swearing [/Bertschi]

    S Offline
    S Offline
    sir_download_alot
    wrote on last edited by
    #33

    Sounds more it has been written by some consultant company who deliver something and then run away. Close to Martians but much more greedy. Know this too good and I absolutely feel with you. If I cannot understand how something works within half a day of studying it, I write it new. This isn't always easy or possible but if I can, I do it. Saves me and the company a lot of trouble and reduces risk.

    1 Reply Last reply
    0
    • D Duncan Edwards Jones

      I've spent the last 2 years doing precisely that...and maybe the last 20. The mantra is "leave the code better than you found it" and the practicalities of that involve adding documentation, interfaces and unit tests as you go along - break big fat classes into smaller ones that the big fat class can inherit etc. And primal scream therapy helps.

      J Offline
      J Offline
      jsc42
      wrote on last edited by
      #34

      Duncan Edwards Jones wrote:

      break big fat classes into smaller ones that the big fat class can inherit etc.

      Classes? Is that some new fancy way of programming that hasn't yet filtered down to those of use who support legacy code. In the 'real world'(tm) refactoring consists of adding a blank line after every thousandth line of densely coded unicharacter identifier, zero comment scrawl just so we can fold the line printer paper more easily. And 'code reuse' is using the line printer listing of a mega assembly program as free underlay for carpets. Yes - I genuinely have done this!

      1 Reply Last reply
      0
      • G GuyThiebaut

        One thing I have done in the past when working with legacy code is the following: Ask for a week of no disturbance from others - preferably get an office to yourself or if you can work from home. Then print off all the code you are working on. Lay the code on the floor or table, if you have a big table, and slowly go through it with a pen adding comments as you read through it. I have found this to be very effective in understanding and fixing big coding problems that I did not create(and sometimes for those that I did create). Think of it this way - it can take you a month, or more, to fix it in your normal work time or a week of dedicated time in an office on your own - only a dumb boss would not see the benefit of allowing you the space to go through this on your own.

        “That which can be asserted without evidence, can be dismissed without evidence.”

        ― Christopher Hitchens

        J Offline
        J Offline
        Jorgen Andersson
        wrote on last edited by
        #35

        GuyThiebaut wrote:

        only a dumb boss

        There's always a catch.

        Wrong is evil and must be defeated. - Jeff Ello

        1 Reply Last reply
        0
        • G GuyThiebaut

          One thing I have done in the past when working with legacy code is the following: Ask for a week of no disturbance from others - preferably get an office to yourself or if you can work from home. Then print off all the code you are working on. Lay the code on the floor or table, if you have a big table, and slowly go through it with a pen adding comments as you read through it. I have found this to be very effective in understanding and fixing big coding problems that I did not create(and sometimes for those that I did create). Think of it this way - it can take you a month, or more, to fix it in your normal work time or a week of dedicated time in an office on your own - only a dumb boss would not see the benefit of allowing you the space to go through this on your own.

          “That which can be asserted without evidence, can be dismissed without evidence.”

          ― Christopher Hitchens

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

          :thumbsup:

          1 Reply Last reply
          0
          • F Frank Alviani

            Seems like a pretty normal rant to me. Probably > 100% of the lounge has been there. No reason to ban...

            My long term goal is to live forever. So far, so good...

            O Offline
            O Offline
            OrkoRudro
            wrote on last edited by
            #37

            Plus a significant percentage of them are responsible for others being there ;)

            1 Reply Last reply
            0
            • F Frank Alviani

              Seems like a pretty normal rant to me. Probably > 100% of the lounge has been there. No reason to ban...

              My long term goal is to live forever. So far, so good...

              O Offline
              O Offline
              OrkoRudro
              wrote on last edited by
              #38

              Plus a significant percentage of them are responsible for others being there

              1 Reply Last reply
              0
              • B BruceN

                Thank you so much - I thought it was just me. It's a bit hard down here at the bottom of the world - We here in NZ are so isolated it's hard to know what to do

                G Offline
                G Offline
                glennPattonWork3
                wrote on last edited by
                #39

                Look, I have blown my top in here and still no ban. Just remember Elephant & Sunshine and you will be fine! :) As for the title

                Quote:

                have you ever been stuck on a programming problem

                honestly, who hasn't?

                1 Reply Last reply
                0
                • B BruceN

                  (This will probably result in a ban, but whatever) So bizarre, so obtuse you just can't see the answer? I got blindsided and walked into a legacy project I swear was written by Martians. We have such gems as magic numbers: return code 97. WTF? Or let's change the code based on the return value of a frick'n button that you just changed the text on: Ok becomes Done, for no reason in the thinking universe I've been banging my head against the wall for the last 6 months over a damn print routine, which is called all over the place, but is rewritten 3 different ways. And don't get me started on the database side of things. It's possible, and happens on a daily basis, to enter a completely illogical combination of products, suppliers and customers and insert that into the db in such a way as to f*** everything over for the next thousand years. You'd have to be a floating database guru clad in a white toga and ghandi level of sereneness to fix this [redacted] fustercluck. Edits: [Bertschi]Redacted swearing [/Bertschi]

                  B Offline
                  B Offline
                  Brad Stiles
                  wrote on last edited by
                  #40

                  BruceN wrote:

                  So bizarre, so obtuse you just can't see the answer?

                  I've been with the same company for 20 years now, and I've seen this many times. You know the something even worse? When you realize that you wrote the bizarre, obtuse code in question...

                  M 1 Reply Last reply
                  0
                  • B BruceN

                    (This will probably result in a ban, but whatever) So bizarre, so obtuse you just can't see the answer? I got blindsided and walked into a legacy project I swear was written by Martians. We have such gems as magic numbers: return code 97. WTF? Or let's change the code based on the return value of a frick'n button that you just changed the text on: Ok becomes Done, for no reason in the thinking universe I've been banging my head against the wall for the last 6 months over a damn print routine, which is called all over the place, but is rewritten 3 different ways. And don't get me started on the database side of things. It's possible, and happens on a daily basis, to enter a completely illogical combination of products, suppliers and customers and insert that into the db in such a way as to f*** everything over for the next thousand years. You'd have to be a floating database guru clad in a white toga and ghandi level of sereneness to fix this [redacted] fustercluck. Edits: [Bertschi]Redacted swearing [/Bertschi]

                    U Offline
                    U Offline
                    User 11000607
                    wrote on last edited by
                    #41

                    Congratulations, you've learned a new skill...Real-World Programming. Sorta like Real-Time Programming, except someone else wrote all the code, nothing ever works, so it doesn't matter if the tasks finish within the allotted time slot. Any Real-World programmer knows that return 97 means error 96 with one argument, what's the problem? And yes, that print routine should have been one base class with 23 levels of inheritance piled on, sloppy programming there, sure to bring down your cyclomatic complexity score. Set some realistic goals and all will be well. Myself, I'm working on getting that cyclomatic complexity score to overflow and crash Visual Studio.

                    1 Reply Last reply
                    0
                    • G GuyThiebaut

                      One thing I have done in the past when working with legacy code is the following: Ask for a week of no disturbance from others - preferably get an office to yourself or if you can work from home. Then print off all the code you are working on. Lay the code on the floor or table, if you have a big table, and slowly go through it with a pen adding comments as you read through it. I have found this to be very effective in understanding and fixing big coding problems that I did not create(and sometimes for those that I did create). Think of it this way - it can take you a month, or more, to fix it in your normal work time or a week of dedicated time in an office on your own - only a dumb boss would not see the benefit of allowing you the space to go through this on your own.

                      “That which can be asserted without evidence, can be dismissed without evidence.”

                      ― Christopher Hitchens

                      D Offline
                      D Offline
                      David Days
                      wrote on last edited by
                      #42

                      Had problem like that--"legacy" web app written in some third party take on ASP.NET and JSP. It was "legacy" in that the code was written before we took over a contract by another contractor (so no going back to them without major $$), but it was only a year old. Now that we were responsible, the users were asking that we fix the weird issue of extremely poor performance and daily lockups of the entire system. I was given the task of figuring out how the code worked so I could go through and fix it. When I finally get the source code installed and 3rd party IDE up..."Hmmm...almost zero logic in the code as far as I can tell...these are strange calls..." I go look in the database, and voila! All stored procedures. I tell myself, "Okay, I can work with this!", and start scrolling through a stored procedure... ...and scrolling... ...and scrolling... ...and scrolling... Oh My Elephanting God! One stored procedure (the one that was suspected in causing the lockup) was 12,000 lines! And there were 30 more! Tried printing it out to do a manual refactoring--it was 250 pages of stored procedure SQL, and there was no consistency in anything. My final report back was this: 1. This is a horrible app. 2. If you want it "fixed", I need 6 weeks and the option to just rewrite the whole thing in a more stable and common language (.NET, JSP, assembler, whatever...I didn't care--anything would be better than this nightmarish blend of old ASP and Black Speech). 3. If you want it to run "better", move it to a big iron database (we had several) and don't look at it until you want to rewrite it. They went with option #3. Every 6-8 months, I would be told to take another look, and occasionally I would be able to make a small modification that wouldn't crash the whole system. I left a few years later, and as far as I know, it's still out there, a monument to both Horrible Implementation and "The problem I couldn't crack".

                      vuolsi così colà dove si puote ciò che si vuole, e più non dimandare --The answer to Minos and any question of "Why are we doing it this way?"

                      G 1 Reply Last reply
                      0
                      • F Forogar

                        If you want to talk about revealing ages, I used to play the original Colossal Cave Adventure and Star Trek games on a mainframe using a green screen terminal!

                        - I would love to change the world, but they won’t give me the source code.

                        K Offline
                        K Offline
                        Kirk 10389821
                        wrote on last edited by
                        #43

                        We had a Star Trek game. It was run on PAPER Terminals. I have to admit that I did not have the patience required. I would rather rewrite the system startup routines in Macro-11 Assembler. :-)

                        M 1 Reply Last reply
                        0
                        • B BruceN

                          (This will probably result in a ban, but whatever) So bizarre, so obtuse you just can't see the answer? I got blindsided and walked into a legacy project I swear was written by Martians. We have such gems as magic numbers: return code 97. WTF? Or let's change the code based on the return value of a frick'n button that you just changed the text on: Ok becomes Done, for no reason in the thinking universe I've been banging my head against the wall for the last 6 months over a damn print routine, which is called all over the place, but is rewritten 3 different ways. And don't get me started on the database side of things. It's possible, and happens on a daily basis, to enter a completely illogical combination of products, suppliers and customers and insert that into the db in such a way as to f*** everything over for the next thousand years. You'd have to be a floating database guru clad in a white toga and ghandi level of sereneness to fix this [redacted] fustercluck. Edits: [Bertschi]Redacted swearing [/Bertschi]

                          K Offline
                          K Offline
                          Kirk 10389821
                          wrote on last edited by
                          #44

                          Bruce, You have to be the Yoda! What they did is done. You "get" to clean it up. You "get" to use that brain to figure out what brainless people were doing. You get to be the white hat, and the hero! Everyday, just make something better... And you will leave a legacy! In this case, the code is the stimulus. And the most amazing part of being human, is we get to CHOOSE our response to stimuli... We can get all upset. Lose hope/faith. Cry that it isn't fair. Or, we can take some of these examples, put them aside for a future article/book/training material (as in... If you do this while working for me, you will be fired, and I will publicly post what you did!). And then clean it up. The hardest thing is to be the Jedi that only makes the changes that are required while making things a little better each time. (Most programmers see horrible stuff and want to re-write all of it. That is far easier than understanding illogical code, and fixing it with the smallest, best change possible). Finally... Think of ways that would prevent this in the future. Code Reviews!!! Start having them. Stop the creation of bad code NOW. When I approach it this way, I find it empowering. Otherwise, if your perspective is off, one could reduce fixing "well written" code to "All I do is fix bugs or implement STUPID business changes that they should have put in there already". Which might be accurate, but does nothing to answer the question "How can I become Happier?"

                          1 Reply Last reply
                          0
                          • D David Days

                            Had problem like that--"legacy" web app written in some third party take on ASP.NET and JSP. It was "legacy" in that the code was written before we took over a contract by another contractor (so no going back to them without major $$), but it was only a year old. Now that we were responsible, the users were asking that we fix the weird issue of extremely poor performance and daily lockups of the entire system. I was given the task of figuring out how the code worked so I could go through and fix it. When I finally get the source code installed and 3rd party IDE up..."Hmmm...almost zero logic in the code as far as I can tell...these are strange calls..." I go look in the database, and voila! All stored procedures. I tell myself, "Okay, I can work with this!", and start scrolling through a stored procedure... ...and scrolling... ...and scrolling... ...and scrolling... Oh My Elephanting God! One stored procedure (the one that was suspected in causing the lockup) was 12,000 lines! And there were 30 more! Tried printing it out to do a manual refactoring--it was 250 pages of stored procedure SQL, and there was no consistency in anything. My final report back was this: 1. This is a horrible app. 2. If you want it "fixed", I need 6 weeks and the option to just rewrite the whole thing in a more stable and common language (.NET, JSP, assembler, whatever...I didn't care--anything would be better than this nightmarish blend of old ASP and Black Speech). 3. If you want it to run "better", move it to a big iron database (we had several) and don't look at it until you want to rewrite it. They went with option #3. Every 6-8 months, I would be told to take another look, and occasionally I would be able to make a small modification that wouldn't crash the whole system. I left a few years later, and as far as I know, it's still out there, a monument to both Horrible Implementation and "The problem I couldn't crack".

                            vuolsi così colà dove si puote ciò che si vuole, e più non dimandare --The answer to Minos and any question of "Why are we doing it this way?"

                            G Offline
                            G Offline
                            GuyThiebaut
                            wrote on last edited by
                            #45

                            Thanks for that! 12,000 line of code in one stored procedure - I don't think that pachyderm goes far enough in describing how horrendous that must have been.

                            David Days wrote:

                            no consistency in anything

                            - that's probably the worst part, although anyone who writes a 12,000 line stored procedure is unlikely to be very well organised. Glad they listened to you.

                            “That which can be asserted without evidence, can be dismissed without evidence.”

                            ― Christopher Hitchens

                            1 Reply Last reply
                            0
                            • K Kirk 10389821

                              We had a Star Trek game. It was run on PAPER Terminals. I have to admit that I did not have the patience required. I would rather rewrite the system startup routines in Macro-11 Assembler. :-)

                              M Offline
                              M Offline
                              Member 11369863
                              wrote on last edited by
                              #46

                              An old Ohio(?) Scientific binary adder. My teacher had the kit I think for sometime. One day she just looked at me and said, "Here. This is for you." I've been a geek with a receding hairline since the sixth grade. I've never looked back. Re: That routine CFH - kill, crush, destroy (or refactor/rewrite).

                              M 1 Reply Last reply
                              0
                              • B BruceN

                                (This will probably result in a ban, but whatever) So bizarre, so obtuse you just can't see the answer? I got blindsided and walked into a legacy project I swear was written by Martians. We have such gems as magic numbers: return code 97. WTF? Or let's change the code based on the return value of a frick'n button that you just changed the text on: Ok becomes Done, for no reason in the thinking universe I've been banging my head against the wall for the last 6 months over a damn print routine, which is called all over the place, but is rewritten 3 different ways. And don't get me started on the database side of things. It's possible, and happens on a daily basis, to enter a completely illogical combination of products, suppliers and customers and insert that into the db in such a way as to f*** everything over for the next thousand years. You'd have to be a floating database guru clad in a white toga and ghandi level of sereneness to fix this [redacted] fustercluck. Edits: [Bertschi]Redacted swearing [/Bertschi]

                                P Offline
                                P Offline
                                patbob
                                wrote on last edited by
                                #47

                                Rather than rant, you could just do like me and my coworker did once -- named an award of coding shame after the former engineer and passed it around for years whenever we caught each other, or ourselves, doing something so stupid.

                                We can program with only 1's, but if all you've got are zeros, you've got nothing.

                                1 Reply Last reply
                                0
                                • M Member 11369863

                                  An old Ohio(?) Scientific binary adder. My teacher had the kit I think for sometime. One day she just looked at me and said, "Here. This is for you." I've been a geek with a receding hairline since the sixth grade. I've never looked back. Re: That routine CFH - kill, crush, destroy (or refactor/rewrite).

                                  M Offline
                                  M Offline
                                  Member 11369863
                                  wrote on last edited by
                                  #48

                                  Ok. Maybe it wasn't Ohio Scientific. It looked pretty much like this though:

                                  M 1 Reply Last reply
                                  0
                                  • M Member 11369863

                                    Ok. Maybe it wasn't Ohio Scientific. It looked pretty much like this though:

                                    M Offline
                                    M Offline
                                    Member 11369863
                                    wrote on last edited by
                                    #49

                                    Picture

                                    1 Reply Last reply
                                    0
                                    • B BruceN

                                      (This will probably result in a ban, but whatever) So bizarre, so obtuse you just can't see the answer? I got blindsided and walked into a legacy project I swear was written by Martians. We have such gems as magic numbers: return code 97. WTF? Or let's change the code based on the return value of a frick'n button that you just changed the text on: Ok becomes Done, for no reason in the thinking universe I've been banging my head against the wall for the last 6 months over a damn print routine, which is called all over the place, but is rewritten 3 different ways. And don't get me started on the database side of things. It's possible, and happens on a daily basis, to enter a completely illogical combination of products, suppliers and customers and insert that into the db in such a way as to f*** everything over for the next thousand years. You'd have to be a floating database guru clad in a white toga and ghandi level of sereneness to fix this [redacted] fustercluck. Edits: [Bertschi]Redacted swearing [/Bertschi]

                                      F Offline
                                      F Offline
                                      fglenn
                                      wrote on last edited by
                                      #50

                                      I feel for you. Probably the worst code I ever worked on was a real-time program where the apparently nonsensical sequence of events had a real-world impact that was not immediately obvious. :)

                                      Fletcher Glenn

                                      1 Reply Last reply
                                      0
                                      • B BruceN

                                        (This will probably result in a ban, but whatever) So bizarre, so obtuse you just can't see the answer? I got blindsided and walked into a legacy project I swear was written by Martians. We have such gems as magic numbers: return code 97. WTF? Or let's change the code based on the return value of a frick'n button that you just changed the text on: Ok becomes Done, for no reason in the thinking universe I've been banging my head against the wall for the last 6 months over a damn print routine, which is called all over the place, but is rewritten 3 different ways. And don't get me started on the database side of things. It's possible, and happens on a daily basis, to enter a completely illogical combination of products, suppliers and customers and insert that into the db in such a way as to f*** everything over for the next thousand years. You'd have to be a floating database guru clad in a white toga and ghandi level of sereneness to fix this [redacted] fustercluck. Edits: [Bertschi]Redacted swearing [/Bertschi]

                                        Y Offline
                                        Y Offline
                                        Ygnaiih
                                        wrote on last edited by
                                        #51

                                        Try a project written by a sucksession of contractors all of whom codded differently badly with simple aspx pages with 2k+ line code behinds. The contractors are long gone. Then anyone with even passing knowledge of how the application works doesn't have time to waste on explaining fertilizer ( think organic) to you. Can you get this done by tomorrow?

                                        1 Reply Last reply
                                        0
                                        • B BruceN

                                          (This will probably result in a ban, but whatever) So bizarre, so obtuse you just can't see the answer? I got blindsided and walked into a legacy project I swear was written by Martians. We have such gems as magic numbers: return code 97. WTF? Or let's change the code based on the return value of a frick'n button that you just changed the text on: Ok becomes Done, for no reason in the thinking universe I've been banging my head against the wall for the last 6 months over a damn print routine, which is called all over the place, but is rewritten 3 different ways. And don't get me started on the database side of things. It's possible, and happens on a daily basis, to enter a completely illogical combination of products, suppliers and customers and insert that into the db in such a way as to f*** everything over for the next thousand years. You'd have to be a floating database guru clad in a white toga and ghandi level of sereneness to fix this [redacted] fustercluck. Edits: [Bertschi]Redacted swearing [/Bertschi]

                                          M Offline
                                          M Offline
                                          Member_5893260
                                          wrote on last edited by
                                          #52

                                          Hmmm... If you know what the program's supposed to do, then I'd advise you to delete it and write a new one... by the time you figure out how this crap works, you might as well have done that anyway.

                                          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