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. Isn't it fun when you write something and look back months later and wonder how you did it?

Isn't it fun when you write something and look back months later and wonder how you did it?

Scheduled Pinned Locked Moved The Lounge
csharpalgorithmsquestionannouncement
40 Posts 24 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.
  • J Jorgen Andersson

    Second that!

    Wrong is evil and must be defeated. - Jeff Ello Never stop dreaming - Freddie Kruger

    F Offline
    F Offline
    Forogar
    wrote on last edited by
    #7

    I am in the middle of refactoring to make a thing simpler to understand and all I end up doing is breaking it. I wrote it a few months ago and now need to add to it so i thought, "Well it's refactoring time!" Apparently, that's a bad idea! :~

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

    1 Reply Last reply
    0
    • H honey the codewitch

      I was looking at some of my old code - Glory, a GLR parser generator for .NET - and I'm amazed A) I was able to pick it up and start maintaining it right away despite me having written it in February B) I understand how it works, but I still don't understand how I did it. The code is amazing. What it does is just... The complexity of code like my XbnfConvert.cs file just floors me. It's very very clever to boot. I must have been in one heck of a zone. I don't know if I could do it again. It makes me happy to know I can write code like this. Or at least I can sometimes. At the same time, it kind of worries me that the code feels like it was maybe written by a better version of myself. Does this happen to others, or am I just a lunatic?

      Real programmers use butterflies

      D Offline
      D Offline
      DRHuff
      wrote on last edited by
      #8

      February?!?? Try Tuesday!

      If you can't laugh at yourself - ask me and I will do it for you.

      1 Reply Last reply
      0
      • H honey the codewitch

        I was looking at some of my old code - Glory, a GLR parser generator for .NET - and I'm amazed A) I was able to pick it up and start maintaining it right away despite me having written it in February B) I understand how it works, but I still don't understand how I did it. The code is amazing. What it does is just... The complexity of code like my XbnfConvert.cs file just floors me. It's very very clever to boot. I must have been in one heck of a zone. I don't know if I could do it again. It makes me happy to know I can write code like this. Or at least I can sometimes. At the same time, it kind of worries me that the code feels like it was maybe written by a better version of myself. Does this happen to others, or am I just a lunatic?

        Real programmers use butterflies

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

        What annoys me the most is when I've commented the code but can't even interpret my comments anymore :sigh:

        It does not solve my Problem, but it answers my question Chemists have exactly one rule: there are only exceptions

        1 Reply Last reply
        0
        • F Forogar

          I've done this two or three times. I've written something over the course of a few months and been so in the groove by the end that I produced prodigious amounts of amazingly complex code to perform miracles of processing. Then I look at it year later and wonder who wrote this? Me? I can't do that! ....but apparently I did. I wrote an expert system, in FORTRAN, that was still being used, unchanged, over twenty years later. Apparently someone had ported it from one mainframe to another but hadn't changed it in any basic way; they also said they weren't entirely sure how it worked, it just did. I am currently looking at some code that I have ported from one platform to another three times since I first wrote the basic system in 1992. I started in Rexx on an IBM mainframe, then ported it to C on a PC, then to C++ as a web-hosted application communicated with via email, then to C# as a heavily interactive web-page. I am now making it a hybrid web/desktop for performance reasons but a lot of the innards (in a DLL) are a mystery to me now! Mostly I am changing and expanding the user interface to it. There are a couple of other complex projects I have done that I probably would have no idea how I to even start on them now. ;-) Motivation helps.

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

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

          Ha nice!

          Real programmers use butterflies

          1 Reply Last reply
          0
          • D dandy72

            I've done it, and I hate it. I hate hard-to-understand code. Moreso when I know I wrote it, and then find out a while later can't follow it. When I'm writing new code and realize I'm going down that path, I try my best to get it to work first, then refactor the living crap out of it with simplicity in mind. That said, these two goals are sometimes at odds with each other...

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

            Sometimes code is just complicated because it does something complicated, and division of labor only gets you so far, like LALR table generation, or a compiler for that matter.

            Real programmers use butterflies

            1 Reply Last reply
            0
            • H honey the codewitch

              I was looking at some of my old code - Glory, a GLR parser generator for .NET - and I'm amazed A) I was able to pick it up and start maintaining it right away despite me having written it in February B) I understand how it works, but I still don't understand how I did it. The code is amazing. What it does is just... The complexity of code like my XbnfConvert.cs file just floors me. It's very very clever to boot. I must have been in one heck of a zone. I don't know if I could do it again. It makes me happy to know I can write code like this. Or at least I can sometimes. At the same time, it kind of worries me that the code feels like it was maybe written by a better version of myself. Does this happen to others, or am I just a lunatic?

              Real programmers use butterflies

              R Offline
              R Offline
              rnbergren
              wrote on last edited by
              #12

              rarely do I look back at my old code and am amazed. More likely I am cussing myself because I was an idiot and if I would have only looked at it differently I could have saved myself so much time. But there was that one time at 3am drunk coding. Still not sure why it works or how but it does. Also, not sure what it does either.

              To err is human to really mess up you need a computer

              B 1 Reply Last reply
              0
              • H honey the codewitch

                I was looking at some of my old code - Glory, a GLR parser generator for .NET - and I'm amazed A) I was able to pick it up and start maintaining it right away despite me having written it in February B) I understand how it works, but I still don't understand how I did it. The code is amazing. What it does is just... The complexity of code like my XbnfConvert.cs file just floors me. It's very very clever to boot. I must have been in one heck of a zone. I don't know if I could do it again. It makes me happy to know I can write code like this. Or at least I can sometimes. At the same time, it kind of worries me that the code feels like it was maybe written by a better version of myself. Does this happen to others, or am I just a lunatic?

                Real programmers use butterflies

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

                It's call "flow" (when it happens).

                It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food

                1 Reply Last reply
                0
                • H honey the codewitch

                  I was looking at some of my old code - Glory, a GLR parser generator for .NET - and I'm amazed A) I was able to pick it up and start maintaining it right away despite me having written it in February B) I understand how it works, but I still don't understand how I did it. The code is amazing. What it does is just... The complexity of code like my XbnfConvert.cs file just floors me. It's very very clever to boot. I must have been in one heck of a zone. I don't know if I could do it again. It makes me happy to know I can write code like this. Or at least I can sometimes. At the same time, it kind of worries me that the code feels like it was maybe written by a better version of myself. Does this happen to others, or am I just a lunatic?

                  Real programmers use butterflies

                  D Offline
                  D Offline
                  Daniel Pfeffer
                  wrote on last edited by
                  #14

                  honey the codewitch wrote:

                  I was able to pick it up and start maintaining it right away despite me having written it in February

                  In my case, I look at code from a few years back, think "what turkey wrote this crap?", then discover that it was I. :sigh:

                  honey the codewitch wrote:

                  I understand how it works, but I still don't understand how I did it.

                  Occult powers? :D (You are a witch, are you not?)

                  Freedom is the freedom to say that two plus two make four. If that is granted, all else follows. -- 6079 Smith W.

                  1 Reply Last reply
                  0
                  • H honey the codewitch

                    I was looking at some of my old code - Glory, a GLR parser generator for .NET - and I'm amazed A) I was able to pick it up and start maintaining it right away despite me having written it in February B) I understand how it works, but I still don't understand how I did it. The code is amazing. What it does is just... The complexity of code like my XbnfConvert.cs file just floors me. It's very very clever to boot. I must have been in one heck of a zone. I don't know if I could do it again. It makes me happy to know I can write code like this. Or at least I can sometimes. At the same time, it kind of worries me that the code feels like it was maybe written by a better version of myself. Does this happen to others, or am I just a lunatic?

                    Real programmers use butterflies

                    G Offline
                    G Offline
                    Gary R Wheeler
                    wrote on last edited by
                    #15

                    I can provide a well-aged perspective here. Most of the software I write professionally has a long life. Development typically takes a couple of years and then maintenance lasts for a decade or more. I have an internal tool that got its start in 2000 and I'm still actively developing and maintaining it. In other words, I get to go back and look at code I wrote a long time ago - a lot. Over time my coding and commenting style have matured. I write things as simply as possible. I avoid being clever, and I avoid 'clever' language features. I name things carefully, especially when they are tied to a particular part of the product or hardware. I use comments only to say things the code can't and to link the code to hardware or documentation when necessary. During maintenance I refactor to simplify things or just to improve readability. The worst case is that I branch the code in question and refactor the branch until the cognitive dissonance from it is tolerable. Usually it doesn't go that far, as I'm probably trying to fix a problem, and I'll find it during the refactoring. Often I can just discard the branch, fix the bug in the original code, and go on. Sometimes I'll keep some of the refactoring. It depends upon the scope of the problem, the fix, and the risk associated with them. The end result is that it's fairly rare for me to look back at something I wrote and be baffled or confused by it. The point here is that you only acquire this skill by doing it. If you only write code that you never revisit, you've lost the learning opportunity that arises when you do.

                    Software Zen: delete this;

                    H 1 Reply Last reply
                    0
                    • G Gary R Wheeler

                      I can provide a well-aged perspective here. Most of the software I write professionally has a long life. Development typically takes a couple of years and then maintenance lasts for a decade or more. I have an internal tool that got its start in 2000 and I'm still actively developing and maintaining it. In other words, I get to go back and look at code I wrote a long time ago - a lot. Over time my coding and commenting style have matured. I write things as simply as possible. I avoid being clever, and I avoid 'clever' language features. I name things carefully, especially when they are tied to a particular part of the product or hardware. I use comments only to say things the code can't and to link the code to hardware or documentation when necessary. During maintenance I refactor to simplify things or just to improve readability. The worst case is that I branch the code in question and refactor the branch until the cognitive dissonance from it is tolerable. Usually it doesn't go that far, as I'm probably trying to fix a problem, and I'll find it during the refactoring. Often I can just discard the branch, fix the bug in the original code, and go on. Sometimes I'll keep some of the refactoring. It depends upon the scope of the problem, the fix, and the risk associated with them. The end result is that it's fairly rare for me to look back at something I wrote and be baffled or confused by it. The point here is that you only acquire this skill by doing it. If you only write code that you never revisit, you've lost the learning opportunity that arises when you do.

                      Software Zen: delete this;

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

                      I'm not confused by it. It's actually fairly easy for me to understand, considering what it does. And what it does is complicated, any way you slice it. For starters, it relies on a LALR algorithm which is confusing no matter how you break it down. LALR is just complicated. Furthermore on top of that, I have a non-deterministic worker that finds all possible trees for a parse based on an ambiguous grammar. Again, it's just complicated, but it can be simplified a bit, unlike LALR, and I had simplified it Finally, it has to take all of this and generate code in most major .NET languages (usually C# or VB.NET) It's just a complicated project. I avoid "clever" as well when I don't have to, but some of the features my generator has are implemented cleverly because the alternative is far larger in terms of code, and slower to execute. Edit: Just so you know I'm not blowing smoke, here's an article on what it does: GLR Parsing in C#: How to Use The Most Powerful Parsing Algorithm Known[^]

                      Real programmers use butterflies

                      G 1 Reply Last reply
                      0
                      • H honey the codewitch

                        I'm not confused by it. It's actually fairly easy for me to understand, considering what it does. And what it does is complicated, any way you slice it. For starters, it relies on a LALR algorithm which is confusing no matter how you break it down. LALR is just complicated. Furthermore on top of that, I have a non-deterministic worker that finds all possible trees for a parse based on an ambiguous grammar. Again, it's just complicated, but it can be simplified a bit, unlike LALR, and I had simplified it Finally, it has to take all of this and generate code in most major .NET languages (usually C# or VB.NET) It's just a complicated project. I avoid "clever" as well when I don't have to, but some of the features my generator has are implemented cleverly because the alternative is far larger in terms of code, and slower to execute. Edit: Just so you know I'm not blowing smoke, here's an article on what it does: GLR Parsing in C#: How to Use The Most Powerful Parsing Algorithm Known[^]

                        Real programmers use butterflies

                        G Offline
                        G Offline
                        Gary R Wheeler
                        wrote on last edited by
                        #17

                        In my case, the complication arises from the number of agents acting on a variety of time scales. We build commercial ink-jet printing systems. At one scale, you have a 40,000 foot roll of paper that may take up to an hour to be printed through the machine. At the opposite end of the scale, you are generating and tracking over a billion drops of ink per second, each measuring 6-9pL in volume. In between, that paper is moving through the press at 17 feet per second and a user navigating a touch screen. The agents I mentioned include PLC's, custom processors and hardware managing the press, the actual ink-jet, image quality cameras, and system timing. Our product consists of a UI application and several Windows services which divvy-up responsibilities. All of them including the UI are heavily multithreaded. My point in all this is that complexity in a given project can arise for any number of reasons. My experience has been that the key to managing that complexity is through professionalism and craft. I'm afraid your work hits something of a nerve with me. I've had a couple unfortunate experiences with folks whose work was more computer science than engineering, and had a generally low opinion of coders in the trenches.

                        Software Zen: delete this;

                        H 1 Reply Last reply
                        0
                        • F Forogar

                          I've done this two or three times. I've written something over the course of a few months and been so in the groove by the end that I produced prodigious amounts of amazingly complex code to perform miracles of processing. Then I look at it year later and wonder who wrote this? Me? I can't do that! ....but apparently I did. I wrote an expert system, in FORTRAN, that was still being used, unchanged, over twenty years later. Apparently someone had ported it from one mainframe to another but hadn't changed it in any basic way; they also said they weren't entirely sure how it worked, it just did. I am currently looking at some code that I have ported from one platform to another three times since I first wrote the basic system in 1992. I started in Rexx on an IBM mainframe, then ported it to C on a PC, then to C++ as a web-hosted application communicated with via email, then to C# as a heavily interactive web-page. I am now making it a hybrid web/desktop for performance reasons but a lot of the innards (in a DLL) are a mystery to me now! Mostly I am changing and expanding the user interface to it. There are a couple of other complex projects I have done that I probably would have no idea how I to even start on them now. ;-) Motivation helps.

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

                          B Offline
                          B Offline
                          BobbyStrain
                          wrote on last edited by
                          #18

                          What is a web/desktop?

                          P F 2 Replies Last reply
                          0
                          • G Gary R Wheeler

                            In my case, the complication arises from the number of agents acting on a variety of time scales. We build commercial ink-jet printing systems. At one scale, you have a 40,000 foot roll of paper that may take up to an hour to be printed through the machine. At the opposite end of the scale, you are generating and tracking over a billion drops of ink per second, each measuring 6-9pL in volume. In between, that paper is moving through the press at 17 feet per second and a user navigating a touch screen. The agents I mentioned include PLC's, custom processors and hardware managing the press, the actual ink-jet, image quality cameras, and system timing. Our product consists of a UI application and several Windows services which divvy-up responsibilities. All of them including the UI are heavily multithreaded. My point in all this is that complexity in a given project can arise for any number of reasons. My experience has been that the key to managing that complexity is through professionalism and craft. I'm afraid your work hits something of a nerve with me. I've had a couple unfortunate experiences with folks whose work was more computer science than engineering, and had a generally low opinion of coders in the trenches.

                            Software Zen: delete this;

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

                            I feel I need to clarify that I don't have a low opinion of coders in the trenches. I used to be one. That said, my code I post here isn't bizdev code, or even team developed. I code for the situation I'm in. My professional business software source doesn't look like the source I code in my free time where I can make it look and perform how *I* want to. It takes me less work to do it my way and I find the freedom of it liberating. I think it's weird that you consider my code more CS than engineering, since I've never taken a CS course in my life. :) I learned in the field.

                            Real programmers use butterflies

                            G 1 Reply Last reply
                            0
                            • B BobbyStrain

                              What is a web/desktop?

                              P Offline
                              P Offline
                              Peter_in_2780
                              wrote on last edited by
                              #20

                              The workplace of an Internet Spider[^], of course.

                              Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012

                              1 Reply Last reply
                              0
                              • H honey the codewitch

                                I was looking at some of my old code - Glory, a GLR parser generator for .NET - and I'm amazed A) I was able to pick it up and start maintaining it right away despite me having written it in February B) I understand how it works, but I still don't understand how I did it. The code is amazing. What it does is just... The complexity of code like my XbnfConvert.cs file just floors me. It's very very clever to boot. I must have been in one heck of a zone. I don't know if I could do it again. It makes me happy to know I can write code like this. Or at least I can sometimes. At the same time, it kind of worries me that the code feels like it was maybe written by a better version of myself. Does this happen to others, or am I just a lunatic?

                                Real programmers use butterflies

                                R Offline
                                R Offline
                                Rage
                                wrote on last edited by
                                #21

                                When I look back into code I wrote in the past, I always admire the me-from-the-past. Elegant, lean, well documented. But then, I am a really good coder, this does not come as a surprise. * struggles to remain serious *

                                Do not escape reality : improve reality !

                                H 1 Reply Last reply
                                0
                                • R Rage

                                  When I look back into code I wrote in the past, I always admire the me-from-the-past. Elegant, lean, well documented. But then, I am a really good coder, this does not come as a surprise. * struggles to remain serious *

                                  Do not escape reality : improve reality !

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

                                  In all seriousness, I've been told I'm good before, but I figure as long as there is room for improvement I'd rather think of myself as still learning - I've also been told that humility is the seed of wisdom. :) A lot of my code is pretty lean though, and sometimes elegant. My documentation is spotty when left to my own devices but I'm getting better about it (again). That's not to say I haven't written a lot of WTF code. In fact, my first attempt at doing anything non-trivial in terms of an application is often garbage. I even plan for that. I consider my first attempt a draft. It's that bad sometimes.

                                  Real programmers use butterflies

                                  P 1 Reply Last reply
                                  0
                                  • H honey the codewitch

                                    I was looking at some of my old code - Glory, a GLR parser generator for .NET - and I'm amazed A) I was able to pick it up and start maintaining it right away despite me having written it in February B) I understand how it works, but I still don't understand how I did it. The code is amazing. What it does is just... The complexity of code like my XbnfConvert.cs file just floors me. It's very very clever to boot. I must have been in one heck of a zone. I don't know if I could do it again. It makes me happy to know I can write code like this. Or at least I can sometimes. At the same time, it kind of worries me that the code feels like it was maybe written by a better version of myself. Does this happen to others, or am I just a lunatic?

                                    Real programmers use butterflies

                                    U Offline
                                    U Offline
                                    User 13647980
                                    wrote on last edited by
                                    #23

                                    Many times I've really got into programming with C# Linq or TSQL and then later wondered what the heck it all does. :)

                                    1 Reply Last reply
                                    0
                                    • H honey the codewitch

                                      In all seriousness, I've been told I'm good before, but I figure as long as there is room for improvement I'd rather think of myself as still learning - I've also been told that humility is the seed of wisdom. :) A lot of my code is pretty lean though, and sometimes elegant. My documentation is spotty when left to my own devices but I'm getting better about it (again). That's not to say I haven't written a lot of WTF code. In fact, my first attempt at doing anything non-trivial in terms of an application is often garbage. I even plan for that. I consider my first attempt a draft. It's that bad sometimes.

                                      Real programmers use butterflies

                                      P Offline
                                      P Offline
                                      Peter_in_2780
                                      wrote on last edited by
                                      #24

                                      honey the codewitch wrote:

                                      I consider my first attempt a draft.

                                      The legendary Fred Brooks, in The Mythical Man-Month (1975), p116:

                                      The management question, therefore, is not whether to build a pilot system and throw it away. You will do that. The only question is whether to plan in advance to build a throwaway, or to promise to deliver the throwaway to customers. Seen this way, the answer is much clearer. Delivering that throwaway to customers buys time, but it only does so at the cost of agony for the user, distraction for the builders while they do the redesign, and a bad reputation for the product that the best redesign will find hard to live down. Hence, plan to throw one away; you will, anyhow.

                                      Ain't that the truth!

                                      Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012

                                      H 1 Reply Last reply
                                      0
                                      • H honey the codewitch

                                        I was looking at some of my old code - Glory, a GLR parser generator for .NET - and I'm amazed A) I was able to pick it up and start maintaining it right away despite me having written it in February B) I understand how it works, but I still don't understand how I did it. The code is amazing. What it does is just... The complexity of code like my XbnfConvert.cs file just floors me. It's very very clever to boot. I must have been in one heck of a zone. I don't know if I could do it again. It makes me happy to know I can write code like this. Or at least I can sometimes. At the same time, it kind of worries me that the code feels like it was maybe written by a better version of myself. Does this happen to others, or am I just a lunatic?

                                        Real programmers use butterflies

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

                                        No. It is senile dementia.

                                        1 Reply Last reply
                                        0
                                        • P Peter_in_2780

                                          honey the codewitch wrote:

                                          I consider my first attempt a draft.

                                          The legendary Fred Brooks, in The Mythical Man-Month (1975), p116:

                                          The management question, therefore, is not whether to build a pilot system and throw it away. You will do that. The only question is whether to plan in advance to build a throwaway, or to promise to deliver the throwaway to customers. Seen this way, the answer is much clearer. Delivering that throwaway to customers buys time, but it only does so at the cost of agony for the user, distraction for the builders while they do the redesign, and a bad reputation for the product that the best redesign will find hard to live down. Hence, plan to throw one away; you will, anyhow.

                                          Ain't that the truth!

                                          Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012

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

                                          I used to have a copy of that book.

                                          Real programmers use butterflies

                                          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