One Of Those Weeks …

      60 Comments on One Of Those Weeks …

The fun part of being a programmer is creating something new, especially something that saves the end-users a lot of tedious work.  I was quite happy, for example, when I managed to find a way to extract data from PDFs and spreadsheets with different layouts.  Until I came up with that one, people at our office processed the data by looking at the PDF or spreadsheet and keying the information into a database screen.  Very, very time-consuming.  I received a lot of kudos (and some free drinks) when my solution worked.

The not-so-fun part of being a programmer is when I have to take over maintaining a big-ass system I didn’t create in the first place.  Then I have to read through reams of code and try to figure out what the @#$% the original programmer was thinking … or more likely, what the previous three or four programmers were thinking.  I always leave copious comments in my code explaining what I’m doing and why.  Some of my predecessors weren’t so kind.

A system was dumped in my lap recently, and the programmer who designed much of it is long gone.  So of course, that system decided to misbehave this week, probably because the Super Bowl is coming up in a few days.  During Super Bowl week a few years ago, I had to fix a different misbehaving system on a tight deadline.  I ended up coding right up until kickoff, watching the game, then jumping back into the coding.

I’d like to avoid a repeat of that weekend, so I’ll be working late instead of writing a post … again.

 

Share

60 thoughts on “One Of Those Weeks …

  1. Tom Welsh

    “Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it”.

    – Brian W. Kernighan

    I also like the slogan, associated with the Ada language, that “a program is written once but read many times”. That justifies a clear, simple, well-documented style.

    Unfortunately the misinterpretation of “agile” development includes an aversion to any kind of documentation. Maybe the somewhat arrogant advocates of this point of view have also misinterpreted that well-known agile maxim – YAGNI (“You Ain’t Gonna Need It).

    Reply
    1. Tom Naughton

      Anyone who thinks code doesn’t need documentation is dreaming. Or just an idiot.

      Some years ago, I read a book titled “Big Blues,” about the partnership and eventual split of Microsoft and IBM. What became Windows began as a joint effort, but the Microsoft and IBM coders couldn’t get along. After the split, IBM produced a piece-of-crap operating system named OS/2, which quickly died because it was slow as molasses and pretty much everyone hated it.

      One of the major sources of conflict was that IBM coders would write a huge chunk of code, then the Microsoft people would analyze it, shake their heads, and recreate the same functions while reducing the lines of code by up to 90%. Apparently the IBM coders thought the more complex it is, the better it is. If you’ve been stuck using any IBM software, you know they still have that attitude.

      Every time I create something new, the first question I ask myself is if there’s a simpler way to accomplish the same task.

      In the system I just updated, there was a routine to retrieve data that looked ridiculously complicated to me when I examined the code. It also took about six minutes to get the data. So I experimented with a couple of different and much simpler methods. The one I ended up using retrieves the same data in three seconds.

      Reply
  2. Firebird7478

    I hope you get to watch the Super Bowl. We’re pretty confident around here that the Eagles can win. Most pundits believe they can, too, but remain cautious due to the Brady/Belichick factor.

    Still, can’t wait to tell the world to finally shut up over the Eagles never winning a Super Bowl — as if their three NFL championships don’t account for anything. SMH

    Reply
    1. Tom Naughton

      I never want to bet against Tom Brady — look at last year’s comeback — but I’m rooting for the Eagles.

      Reply
  3. Michael Hall

    25 years in large Mainframe environments as a contractor brought in to prop up or redesign rewrite 35 year old systems for Army, Navy, IRS etc. Of course zero documentation on what the Systems were even designed for. Good luck in the Object Oriented World where the programmers that wrote and designed those applications had enough problems looking at their code and figuring what they were thinking when the wrote that part. Good luck.

    Reply
    1. Tom Naughton

      I once had to rewrite a major portion of a system that was so convoluted, with code jumping all over different classes, I couldn’t wrap my head around it until I created an index card for each object and procedure within each class, laid the index cards all over my living room floor, then connected them with straws to map out the (ahem) logic.

      Reply
  4. Geoff

    I know the feeling, I’m my own worst enemy. I create games as a hobby and have the bad habit of not commenting my code, so going back to figure out what I’ve done is equally frustrating…but I swear I’ll comment my code from now on. Never happens xD

    Reply
    1. Tom Naughton

      That’s one of the reasons I leave detailed comments. Never mind being kind to whoever takes over the system after me; when I revisit something I wrote a year or two later, I need those comments to remind me what I was thinking.

      Reply
  5. Tom Welsh

    “Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it”.

    – Brian W. Kernighan

    I also like the slogan, associated with the Ada language, that “a program is written once but read many times”. That justifies a clear, simple, well-documented style.

    Unfortunately the misinterpretation of “agile” development includes an aversion to any kind of documentation. Maybe the somewhat arrogant advocates of this point of view have also misinterpreted that well-known agile maxim – YAGNI (“You Ain’t Gonna Need It).

    Reply
    1. Tom Naughton Post author

      Anyone who thinks code doesn’t need documentation is dreaming. Or just an idiot.

      Some years ago, I read a book titled “Big Blues,” about the partnership and eventual split of Microsoft and IBM. What became Windows began as a joint effort, but the Microsoft and IBM coders couldn’t get along. After the split, IBM produced a piece-of-crap operating system named OS/2, which quickly died because it was slow as molasses and pretty much everyone hated it.

      One of the major sources of conflict was that IBM coders would write a huge chunk of code, then the Microsoft people would analyze it, shake their heads, and recreate the same functions while reducing the lines of code by up to 90%. Apparently the IBM coders thought the more complex it is, the better it is. If you’ve been stuck using any IBM software, you know they still have that attitude.

      Every time I create something new, the first question I ask myself is if there’s a simpler way to accomplish the same task.

      In the system I just updated, there was a routine to retrieve data that looked ridiculously complicated to me when I examined the code. It also took about six minutes to get the data. So I experimented with a couple of different and much simpler methods. The one I ended up using retrieves the same data in three seconds.

      Reply
        1. Tom Naughton Post author

          Yup, programmers received bonuses based on how many lines of code they wrote per year. So of course, they had no incentive (actually a disincentive) to write efficient code. Management didn’t care that IBM programs were huge memory hogs, because it induced customers to buy more memory to speed up the slow processing.

          Reply
  6. Firebird7478

    I hope you get to watch the Super Bowl. We’re pretty confident around here that the Eagles can win. Most pundits believe they can, too, but remain cautious due to the Brady/Belichick factor.

    Still, can’t wait to tell the world to finally shut up over the Eagles never winning a Super Bowl — as if their three NFL championships don’t account for anything. SMH

    Reply
    1. Tom Naughton Post author

      I never want to bet against Tom Brady — look at last year’s comeback — but I’m rooting for the Eagles.

      Reply
        1. Tom Naughton Post author

          We treat Super Bowl Sunday as a guilt-free day as far as diet. I’ll be eating chips and pizza and drinking Guinness.

          Reply
          1. Firebird7478

            Let’s hope that today isn’t the day some crazy vegan activists storm the field and grab all the footballs in protest of the animal skin covering.

            Reply
            1. Tom Naughton Post author

              Kudos to Pederson for recognizing that the only way to beat the Patriots is to fight for every point. It’s not as if you can get a lead and then count on your defense to stop Tom Brady. Just ask the Falcons.

            2. Tom Naughton Post author

              Brilliant play by the team, and brilliant coaching by Pederson. He knew you don’t beat Tom Brady by playing it safe, so he made the gutsy fourth-down decisions when he had to.

            3. Firebird7478

              That trick play at the goal line featured a ball snap to an undrafted rookie, who tossed it to a third string wide receiver who then throws a TD pass to the back up QB.

              Pederson has been bold all year.

              Now I’m hearing it from people in New England because a handful of people got out of control celebrating in the streets last night, as if Philly was like Sherman going through Atlanta. SMH

            4. Tom Naughton Post author

              Gutsy play, although I believe the announcers said the third-string wide receiver played QB in college. I would have been more worried about Foles catching it than the receiver throwing it.

              Let the New England fans criticize your fans all they want. Your team won.

  7. Michael Hall

    25 years in large Mainframe environments as a contractor brought in to prop up or redesign rewrite 35 year old systems for Army, Navy, IRS etc. Of course zero documentation on what the Systems were even designed for. Good luck in the Object Oriented World where the programmers that wrote and designed those applications had enough problems looking at their code and figuring what they were thinking when the wrote that part. Good luck.

    Reply
    1. Tom Naughton Post author

      I once had to rewrite a major portion of a system that was so convoluted, with code jumping all over different classes, I couldn’t wrap my head around it until I created an index card for each object and procedure within each class, laid the index cards all over my living room floor, then connected them with straws to map out the (ahem) logic.

      Reply
  8. The Older Brother

    Back in the day, had a former client fly me in to implement some system mods they wanted done which my former company didn’t have resources for in the time frame they needed them. I’d done several mods for them previously when we first installed and rolled out their system.

    The client, who I’d worked with pretty closely during the initial install, told me she’d just been at a training/info session the month before and the person doing the presentation put up a screen of code. She asked who had written the code and the presenter said he had written it. Then she said “He was lying. I knew you’d written it because all of the code was formatted and commented!”

    [As not a big football fan anyway, I’ll most likely be “taking a knee” for the Super Bowl. At this point, I don’t think we’re even going to turn it on for the commercials.]

    Cheers!

    Reply
    1. Tom Naughton

      We’re heading into the part of the year I like least. Football season ends, then Daylight Saving Time returns.

      Reply
  9. Geoff

    I know the feeling, I’m my own worst enemy. I create games as a hobby and have the bad habit of not commenting my code, so going back to figure out what I’ve done is equally frustrating…but I swear I’ll comment my code from now on. Never happens xD

    Reply
    1. Tom Naughton Post author

      That’s one of the reasons I leave detailed comments. Never mind being kind to whoever takes over the system after me; when I revisit something I wrote a year or two later, I need those comments to remind me what I was thinking.

      Reply
  10. The Older Brother

    Back in the day, had a former client fly me in to implement some system mods they wanted done which my former company didn’t have resources for in the time frame they needed them. I’d done several mods for them previously when we first installed and rolled out their system.

    The client, who I’d worked with pretty closely during the initial install, told me she’d just been at a training/info session the month before and the person doing the presentation put up a screen of code. She asked who had written the code and the presenter said he had written it. Then she said “He was lying. I knew you’d written it because all of the code was formatted and commented!”

    [As not a big football fan anyway, I’ll most likely be “taking a knee” for the Super Bowl. At this point, I don’t think we’re even going to turn it on for the commercials.]

    Cheers!

    Reply
    1. Tom Naughton Post author

      We’re heading into the part of the year I like least. Football season ends, then Daylight Saving Time returns.

      Reply
      1. Dianne

        As a big fan of both baseball and DST, I’m starting to get excited! However, I am a little bummed that Ash Wednesday falls on Valentine’s Day (when I might ordinarily allow myself a special sweet treat) this year.

        Reply
          1. Dianne

            Imagine that you are an elderly lady with lousy night vision, and that DST gives you an extra hour’s driving time at the end of the day. Or if you prefer, imagine you are an elderly man with lousy night vision.

            Reply
            1. Dianne

              No, but since people tend to schedule dinners out, or evening church services or Bible classes, or minor league baseball games (here in Texas, at any rate) for the same evening hours regardless of the time of year, later in the day is when I need to be able to drive. Besides, I had enough of getting up at (and before) the crack of dawn during the many decades of my working life.

          2. Desmond

            As much as I consider myself a DST hater, it seems to me our ancestors normally woke up around dawn and went to bed when they got tired. So a little tinkering with our artificial clocks to keep dawn around the same time almost makes sense to me… for maybe 4 months maximum (May thro’ August in the mid northern latitudes).

            What I don’t get is how legislators found “extra” daylight in 8 out of 12 months. The math don’t work.

            Reply
            1. Tom Naughton Post author

              I think monkeying with the clock at all is goofy. People can always just choose to get up earlier if that’s what they want. But yeah, if we’re going to switch to DST, at least wait until something like summer is approaching.

  11. Ulfric Douglas

    Tom “Anyone who thinks code doesn’t need documentation is dreaming. Or just an idiot.”
    BUT it looks so much smaller without the REMs!

    Reply
    1. Tom Naughton

      Unfortunately, some of my predecessors believed a ton of code with no comments was better than an efficient bit of code with a few comments.

      Some ding-dong who coded one of our systems created a class to hold a whopping four variables to feed into a procedure. The class object was used exactly once. Same for the procedure.

      So instead of simply coding RunSomeTask(v1, v2, v3, v4), he went to the trouble to create a new class, define four private fields for the variables, and write a public get/set pair of methods for each of them. To run the procedure, he instantiated the class, fed in the four variables, then passed the object to the procedure, then wrote code in the procedure to retrieve the four variables from the object.

      It was one of those head-scratching, bang-head-on-desk, “what the @#$% were you thinking?!” moments when I stumbled across that one.

      Reply
      1. Walter

        Some people have a religious objections to non objectified variables?!

        Or someone being paid by lines of code?

        Reply
        1. Tom Naughton

          No idea what would make someone think creating an object to pass four variables is a good idea.

          Reply
  12. Ulfric Douglas

    Tom “Anyone who thinks code doesn’t need documentation is dreaming. Or just an idiot.”
    BUT it looks so much smaller without the REMs!

    Reply
    1. Tom Naughton Post author

      Unfortunately, some of my predecessors believed a ton of code with no comments was better than an efficient bit of code with a few comments.

      Some ding-dong who coded one of our systems created a class to hold a whopping four variables to feed into a procedure. The class object was used exactly once. Same for the procedure.

      So instead of simply coding RunSomeTask(v1, v2, v3, v4), he went to the trouble to create a new class, define four private fields for the variables, and write a public get/set pair of methods for each of them. To run the procedure, he instantiated the class, fed in the four variables, then passed the object to the procedure, then wrote code in the procedure to retrieve the four variables from the object.

      It was one of those head-scratching, bang-head-on-desk, “what the @#$% were you thinking?!” moments when I stumbled across that one.

      Reply
  13. Nick S

    Other people’s code is what made me quit development and get edumacated to be a consultant/project manager.

    During an internship, I had to try and fix a pile of code written with minimal, useless documentation by someone who was no longer with the company. I had to throw things away as often as I could actually reuse them. It may have been faster to simply start from scratch.

    Reply
    1. Tom Naughton

      I’ve had to lobby hard a couple of times to just start over instead of wrapping more bandages around a pile of crappy code. The first time, my supervisor asked me to fix a service that writes millions of rows of relational data to a flat-file dtSearch index that can be searched with fuzzy logic. When I tried to track down the errors, I saw that the code was insane. One of the only comments was by a programmer complaining that the server was running out of memory before finishing. Well, no @#$%! That will happen when you make things geometrically more complex than necessary.

      I told my supervisor it was garbage and I needed to just rewrite it. He hemmed and hawed but finally agreed. When I was done, the service ran in six hours instead of 44. He trusted me after that when I said I needed to rip out crap code and start over. Then he left and I had to go through the same process again with another supervisor.

      Reply
      1. Nurse Dave

        And now you know why Nurse Dave decided to go into nursing! Having to explain that a modification to code X was going to take a couple of weeks, where a rewrite would take 2 days, to a person that REALLY should’ve been able to figure it out on their own was just more than my sanity could take. About the only good that came out of the Great Recession (from my perspective, anyway) was it forced me to take a good, hard look at my life at that point, and realize it was time for a change. Reverse-engineering the Atkins diet & independently deriving the core of the Alternative Hypothesis was just part of the fun. 🙂

        Reply
        1. Tom Naughton

          Makes sense. Although at my age, the only career change I’m considering is become a full-time content producer if the book and film take off.

          Reply
  14. Nick S

    Other people’s code is what made me quit development and get edumacated to be a consultant/project manager.

    During an internship, I had to try and fix a pile of code written with minimal, useless documentation by someone who was no longer with the company. I had to throw things away as often as I could actually reuse them. It may have been faster to simply start from scratch.

    Reply
    1. Tom Naughton Post author

      I’ve had to lobby hard a couple of times to just start over instead of wrapping more bandages around a pile of crappy code. The first time, my supervisor asked me to fix a service that writes millions of rows of relational data to a flat-file dtSearch index that can be searched with fuzzy logic. When I tried to track down the errors, I saw that the code was insane. One of the only comments was by a programmer complaining that the server was running out of memory before finishing. Well, no @#$%! That will happen when you make things geometrically more complex than necessary.

      I told my supervisor it was garbage and I needed to just rewrite it. He hemmed and hawed but finally agreed. When I was done, the service ran in six hours instead of 44. He trusted me after that when I said I needed to rip out crap code and start over. Then he left and I had to go through the same process again with another supervisor.

      Reply
      1. Nurse Dave

        And now you know why Nurse Dave decided to go into nursing! Having to explain that a modification to code X was going to take a couple of weeks, where a rewrite would take 2 days, to a person that REALLY should’ve been able to figure it out on their own was just more than my sanity could take. About the only good that came out of the Great Recession (from my perspective, anyway) was it forced me to take a good, hard look at my life at that point, and realize it was time for a change. Reverse-engineering the Atkins diet & independently deriving the core of the Alternative Hypothesis was just part of the fun. 🙂

        Reply
        1. Tom Naughton Post author

          Makes sense. Although at my age, the only career change I’m considering is become a full-time content producer if the book and film take off.

          Reply
  15. Mike

    I know this pain. Jumping into 15 years old code with database with all tables without relationship which have been maintained in the code by values not primary keys:). Oh, and most variables global. Oh, comments …. there was a few.

    Reply
  16. Mike

    I know this pain. Jumping into 15 years old code with database with all tables without relationship which have been maintained in the code by values not primary keys:). Oh, and most variables global. Oh, comments …. there was a few.

    Reply

Leave a Reply to Nick S Cancel reply

Your email address will not be published.