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. What was I thinking?

What was I thinking?

Scheduled Pinned Locked Moved The Lounge
cssperformancequestioncode-review
15 Posts 13 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.
  • S Steve Driessens

    Recent threads on hard to maintain code got me thinking: Have any of you looked at code that you wrote in the past and wondered "What the hell was I thinking when I wrote that?" I'm in the middle of updating one of our apps and decided to see if I could improve the speed of one particular area of the program. The original code was written about five years ago and it's always worked reliably, just way too slow. I have no idea of what I must have been smoking at the time, but the code is a joke. After a 20 minute re-write it runs about 10 times faster with a lot less code to boot! I was 35 at the time, so I can't even blame it on being young and stupid. :-) So, am I alone, or does anybody else here find bits of dodgy old code and wonder what evil spirits posessed you when you wrote it? Steve

    J Offline
    J Offline
    James R Twine
    wrote on last edited by
    #6

    > Have any of you looked at code that you wrote in the past and wondered "What > the hell was I thinking when I wrote that?"    Yep!  I found an some old printouts of a "Galaxian"-type game that I wrote a while ago.  But I can take the defense of "young and stupid": It was my first year of college, and I was just starting to really get into C++ coding.    Peace! -=- James.

    1 Reply Last reply
    0
    • S Steve Driessens

      Recent threads on hard to maintain code got me thinking: Have any of you looked at code that you wrote in the past and wondered "What the hell was I thinking when I wrote that?" I'm in the middle of updating one of our apps and decided to see if I could improve the speed of one particular area of the program. The original code was written about five years ago and it's always worked reliably, just way too slow. I have no idea of what I must have been smoking at the time, but the code is a joke. After a 20 minute re-write it runs about 10 times faster with a lot less code to boot! I was 35 at the time, so I can't even blame it on being young and stupid. :-) So, am I alone, or does anybody else here find bits of dodgy old code and wonder what evil spirits posessed you when you wrote it? Steve

      M Offline
      M Offline
      Matt Philmon
      wrote on last edited by
      #7

      It pretty much happens every time I have to go back and fix a bug, add functionality, or make general improvements to an application I have already released. Invariably I learn so many new things from each new project I lead/code I always end up doing it differently the next time and wondering what in the world I was thinking the last time...

      realJSOPR 1 Reply Last reply
      0
      • M Matt Philmon

        It pretty much happens every time I have to go back and fix a bug, add functionality, or make general improvements to an application I have already released. Invariably I learn so many new things from each new project I lead/code I always end up doing it differently the next time and wondering what in the world I was thinking the last time...

        realJSOPR Offline
        realJSOPR Offline
        realJSOP
        wrote on last edited by
        #8

        Here's a concept for you... I remember looking back (5 years ago) at code that was 10 years old and thinking that, and now, I look back at code no more than a few hours old, and think the same thing. At the present rate, I should be able to identify bad code that I will write sometime in the future before I actually write it. :)

        1 Reply Last reply
        0
        • T Tom Archer

          Actually, I'm the opposite! I look at code I wrote a few years ago and think "Damn! I used to be really good. What the hell happened to me?!" :((

          C Offline
          C Offline
          Chris Maunder
          wrote on last edited by
          #9

          *phew*! I was thinking the same thing but thought 'better not tell - they'll think I'm getting old and decrepit' :) cheers, Chris Maunder

          J 1 Reply Last reply
          0
          • S Steve Driessens

            Recent threads on hard to maintain code got me thinking: Have any of you looked at code that you wrote in the past and wondered "What the hell was I thinking when I wrote that?" I'm in the middle of updating one of our apps and decided to see if I could improve the speed of one particular area of the program. The original code was written about five years ago and it's always worked reliably, just way too slow. I have no idea of what I must have been smoking at the time, but the code is a joke. After a 20 minute re-write it runs about 10 times faster with a lot less code to boot! I was 35 at the time, so I can't even blame it on being young and stupid. :-) So, am I alone, or does anybody else here find bits of dodgy old code and wonder what evil spirits posessed you when you wrote it? Steve

            R Offline
            R Offline
            Richard Melton
            wrote on last edited by
            #10

            I looked at code that I just got up and running and think the same thing.........

            1 Reply Last reply
            0
            • S Steve Driessens

              Recent threads on hard to maintain code got me thinking: Have any of you looked at code that you wrote in the past and wondered "What the hell was I thinking when I wrote that?" I'm in the middle of updating one of our apps and decided to see if I could improve the speed of one particular area of the program. The original code was written about five years ago and it's always worked reliably, just way too slow. I have no idea of what I must have been smoking at the time, but the code is a joke. After a 20 minute re-write it runs about 10 times faster with a lot less code to boot! I was 35 at the time, so I can't even blame it on being young and stupid. :-) So, am I alone, or does anybody else here find bits of dodgy old code and wonder what evil spirits posessed you when you wrote it? Steve

              A Offline
              A Offline
              Ajit Jadhav
              wrote on last edited by
              #11

              Unfortunately, as a contract programmer, I don't have the luxury to be able to look back at my code again once the contract ends. So, I have to produce the best that is possible in the present tense, and have to rest my professional reputation right on that. But for the code I write at home, there have been times when I have said to myself, "Wow! I had come so close to that even then!" That is so, typically, for epochal code (written before the current epoch as per Moore's law). For ancient code (by definition, a moving period going back in time for about 1.5+ times Moore's period), I am just amused by what all things I had to deal with. ------- Nature, to be commanded, must be obeyed. (Francis Bacon) Nature, to be apprehended, must be obeyed. (Ayn Rand)

              1 Reply Last reply
              0
              • S Steve Driessens

                Recent threads on hard to maintain code got me thinking: Have any of you looked at code that you wrote in the past and wondered "What the hell was I thinking when I wrote that?" I'm in the middle of updating one of our apps and decided to see if I could improve the speed of one particular area of the program. The original code was written about five years ago and it's always worked reliably, just way too slow. I have no idea of what I must have been smoking at the time, but the code is a joke. After a 20 minute re-write it runs about 10 times faster with a lot less code to boot! I was 35 at the time, so I can't even blame it on being young and stupid. :-) So, am I alone, or does anybody else here find bits of dodgy old code and wonder what evil spirits posessed you when you wrote it? Steve

                A Offline
                A Offline
                Alvaro Mendez
                wrote on last edited by
                #12

                You know, I must be a weird or something, 'cause I don't have that problem. When I go back to old code, I always say, "Wow, that's good stuff!". It's when I go other people's code that I say, "How can this guy be paid to write code like this on a daily basis?". For the past 8 years I've disciplined myself to write efficient, well organized, and well documented code. Once I understood how important it is do so, I started doing it and haven't gone back since. Now, if I could only convince some of my co-workers to do the same, life would be a lot better...

                C 1 Reply Last reply
                0
                • A Alvaro Mendez

                  You know, I must be a weird or something, 'cause I don't have that problem. When I go back to old code, I always say, "Wow, that's good stuff!". It's when I go other people's code that I say, "How can this guy be paid to write code like this on a daily basis?". For the past 8 years I've disciplined myself to write efficient, well organized, and well documented code. Once I understood how important it is do so, I started doing it and haven't gone back since. Now, if I could only convince some of my co-workers to do the same, life would be a lot better...

                  C Offline
                  C Offline
                  Christian Graus
                  wrote on last edited by
                  #13

                  No offence, but I can't help but feel if I thought the code I wrote last year was all good stuff, I would not have progressed. Don't get me wrong, some of it is *damn* cool:), but in the details, there is often something I could have done better/more elegantly. Christian #include "std_disclaimer.h"

                  A 1 Reply Last reply
                  0
                  • C Christian Graus

                    No offence, but I can't help but feel if I thought the code I wrote last year was all good stuff, I would not have progressed. Don't get me wrong, some of it is *damn* cool:), but in the details, there is often something I could have done better/more elegantly. Christian #include "std_disclaimer.h"

                    A Offline
                    A Offline
                    Alvaro Mendez
                    wrote on last edited by
                    #14

                    I suppose you're right. If I were to comb through line by line, I'd surely find spots where I could have worded a comment more clearly or maybe named a function differently. The times when I go back to make something substancially better it's because I've actually planned for it beforehand. In other words, I say, "OK I'm gonna do it this way now but I should revisit it later since it's quite possible that it can be done better." Just recently it happened with a new class I created called CDouble. I did it for the sole purpose of wrapping the double type. I made it a standalone class but I thought to myself, "Hmmm, this should probably be implemented by deriving from a template class so I can use it for other primitive types like int or short". And that's exactly what I did. Some time after I had the CDouble class working in my code, I took a break to go back and implement it using a template class which allowed me to create other type wrappers such as CInt, CUInt, CShort, etc. Bottom line, I don't go back to my code and say "man, what possessed me to write something so abominable?". Those days are over, thank God. Regards, Alvaro

                    1 Reply Last reply
                    0
                    • C Chris Maunder

                      *phew*! I was thinking the same thing but thought 'better not tell - they'll think I'm getting old and decrepit' :) cheers, Chris Maunder

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

                      Sounds wierd I know but I know I'm getting better when I can still look at my old code and laugh at what I wrote. ATL Student :rolleyes:

                      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