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. Other Discussions
  3. The Weird and The Wonderful
  4. C# confessions - Oh man I would be embarassed - if it wasn't so funny.

C# confessions - Oh man I would be embarassed - if it wasn't so funny.

Scheduled Pinned Locked Moved The Weird and The Wonderful
csharplearning
15 Posts 6 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.
  • G Offline
    G Offline
    GuyThiebaut
    wrote on last edited by
    #1

    Just tidying up some code I wrote when I started learning C#(some four months ago). I found the following two horrors:

    itemDups += 0;
    
    goto Skip;
    

    So I thought I better fess up and hang my head in shame. Oh the shame... :sigh: :laugh:

    Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
    CPalliniC L O T 4 Replies Last reply
    0
    • G GuyThiebaut

      Just tidying up some code I wrote when I started learning C#(some four months ago). I found the following two horrors:

      itemDups += 0;
      
      goto Skip;
      

      So I thought I better fess up and hang my head in shame. Oh the shame... :sigh: :laugh:

      Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
      CPalliniC Offline
      CPalliniC Offline
      CPallini
      wrote on last edited by
      #2

      Well, not horrors:

      GuyThiebaut wrote:

      itemDups += 0;

      Simply exploiting sum neutral element.

      GuyThiebaut wrote:

      goto Skip;

      Time-travel to find out C# roots. :)

      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

      In testa che avete, signor di Ceprano?

      1 Reply Last reply
      0
      • G GuyThiebaut

        Just tidying up some code I wrote when I started learning C#(some four months ago). I found the following two horrors:

        itemDups += 0;
        
        goto Skip;
        

        So I thought I better fess up and hang my head in shame. Oh the shame... :sigh: :laugh:

        Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Embarassed? What for? You will always find some interesting things when taking a close look at your older code. It simply means you have made some progress since then.

        G 1 Reply Last reply
        0
        • L Lost User

          Embarassed? What for? You will always find some interesting things when taking a close look at your older code. It simply means you have made some progress since then.

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

          Thanks, I think embarrassed because I have been coding for twenty years and I did not think I still wrote code like this. You are right though , what is important is progress, we all have to start somewhere.

          Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
          L 1 Reply Last reply
          0
          • G GuyThiebaut

            Thanks, I think embarrassed because I have been coding for twenty years and I did not think I still wrote code like this. You are right though , what is important is progress, we all have to start somewhere.

            Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            What shall I say? The little program I work on right now is a top candidate for this effect. The boss wanted a quick and dirty solution which will have to do until we come up with a better one. Along the way several things did not worke well and sometimes I had to take a step back and try something else. The code is full of quick and dirty code to try out different approaches and also some remains of previous experiments. The whole structure and design has suffered from this tinkering. Now I'm cleaning it up a little, but still there will remain a lot to be improved. In a few weeks I will probaly plan the real solution and take this as a prototype. No doubt there will be many things which can be solved in a less error prone and better designed fashion. But as I wrote, this little project has to be working quickly. In a few weeks it will have served its purpose and the encountered issues will help when planing the real solution. Quick and dirty is not always a bad thing. You just have to take it for what it's worth.

            CPalliniC 1 Reply Last reply
            0
            • L Lost User

              What shall I say? The little program I work on right now is a top candidate for this effect. The boss wanted a quick and dirty solution which will have to do until we come up with a better one. Along the way several things did not worke well and sometimes I had to take a step back and try something else. The code is full of quick and dirty code to try out different approaches and also some remains of previous experiments. The whole structure and design has suffered from this tinkering. Now I'm cleaning it up a little, but still there will remain a lot to be improved. In a few weeks I will probaly plan the real solution and take this as a prototype. No doubt there will be many things which can be solved in a less error prone and better designed fashion. But as I wrote, this little project has to be working quickly. In a few weeks it will have served its purpose and the encountered issues will help when planing the real solution. Quick and dirty is not always a bad thing. You just have to take it for what it's worth.

              CPalliniC Offline
              CPalliniC Offline
              CPallini
              wrote on last edited by
              #6

              CDP1802 wrote:

              Quick and dirty is not always a bad thing

              Definitely. But then you have to discard it and build the real one, exploiting acquired knowledge. :)

              If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
              This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

              In testa che avete, signor di Ceprano?

              L 1 Reply Last reply
              0
              • CPalliniC CPallini

                CDP1802 wrote:

                Quick and dirty is not always a bad thing

                Definitely. But then you have to discard it and build the real one, exploiting acquired knowledge. :)

                If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

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

                Usually I do that by redesigning the whole thing as a reusable module where it makes sense. In future projects I then can rely on code which has already proven it's worth.

                CPalliniC 1 Reply Last reply
                0
                • L Lost User

                  Usually I do that by redesigning the whole thing as a reusable module where it makes sense. In future projects I then can rely on code which has already proven it's worth.

                  CPalliniC Offline
                  CPalliniC Offline
                  CPallini
                  wrote on last edited by
                  #8

                  Very good. :)

                  If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                  This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

                  In testa che avete, signor di Ceprano?

                  L 1 Reply Last reply
                  0
                  • CPalliniC CPallini

                    Very good. :)

                    If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                    This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

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

                    Luckily I have a boss who gives me time to do such things. A while ago he asked me what he should have printed on my business cards. I said 'Wizard'. I read books which nobody else understand. Then I do something which nobody understands. After that the computer does something which nobody understands. When asked I say things about the results which nobody understands. But everybody expects miracles from me on a regular basis. Looks to me like the classical definition of a wizard.

                    L 1 Reply Last reply
                    0
                    • G GuyThiebaut

                      Just tidying up some code I wrote when I started learning C#(some four months ago). I found the following two horrors:

                      itemDups += 0;
                      
                      goto Skip;
                      

                      So I thought I better fess up and hang my head in shame. Oh the shame... :sigh: :laugh:

                      Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
                      O Offline
                      O Offline
                      Oshtri Deka
                      wrote on last edited by
                      #10

                      Hehe, you should see the wonders I've coded on my first coding job. And I was paid for that. No one is immune from writing bad\weird code, but some folk just insist they are right, and the rest of us gather here :) I wonder how nobody hasn't put some of my early gems here.

                      L 1 Reply Last reply
                      0
                      • O Oshtri Deka

                        Hehe, you should see the wonders I've coded on my first coding job. And I was paid for that. No one is immune from writing bad\weird code, but some folk just insist they are right, and the rest of us gather here :) I wonder how nobody hasn't put some of my early gems here.

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

                        Luckily, for all of us, code is examined less often the older it is. And, over time, someone else may have had to work on it and disposed of the evidence :)

                        1 Reply Last reply
                        0
                        • L Lost User

                          Luckily I have a boss who gives me time to do such things. A while ago he asked me what he should have printed on my business cards. I said 'Wizard'. I read books which nobody else understand. Then I do something which nobody understands. After that the computer does something which nobody understands. When asked I say things about the results which nobody understands. But everybody expects miracles from me on a regular basis. Looks to me like the classical definition of a wizard.

                          L Offline
                          L Offline
                          Luca Leonardo Scorcia
                          wrote on last edited by
                          #12

                          Your last sentence is definitely signature material! :-D

                          Luca The Price of Freedom is Eternal Vigilance. -- Wing Commander IV En Það Besta Sem Guð Hefur Skapað, Er Nýr Dagur. (But the best thing God has created, is a New Day.) -- Sigur Ròs - Viðrar vel til loftárása

                          L 1 Reply Last reply
                          0
                          • G GuyThiebaut

                            Just tidying up some code I wrote when I started learning C#(some four months ago). I found the following two horrors:

                            itemDups += 0;
                            
                            goto Skip;
                            

                            So I thought I better fess up and hang my head in shame. Oh the shame... :sigh: :laugh:

                            Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
                            T Offline
                            T Offline
                            ToreUp
                            wrote on last edited by
                            #13

                            Everyone pontificates about lofty and complicated concepts such as declarative programming, boxing, garbage collection, IDL, delegates, generics, etc. But I like your bold use of some very simple and perfectly legal constructs. Too bad the VisStudio compiler abhors this common contruct: itemDups /= 0; :omg:

                            G 1 Reply Last reply
                            0
                            • T ToreUp

                              Everyone pontificates about lofty and complicated concepts such as declarative programming, boxing, garbage collection, IDL, delegates, generics, etc. But I like your bold use of some very simple and perfectly legal constructs. Too bad the VisStudio compiler abhors this common contruct: itemDups /= 0; :omg:

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

                              rokhead wrote:

                              itemDups /= 0

                              Yeah, my code won't even compile with this. Talk about VS being Stooooooopid. Maybe I will post a question on the C# forum saying: Plz Help Why does this code not work itemDups /= 0 You write code for me, now, urgent :laugh:

                              Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
                              1 Reply Last reply
                              0
                              • L Luca Leonardo Scorcia

                                Your last sentence is definitely signature material! :-D

                                Luca The Price of Freedom is Eternal Vigilance. -- Wing Commander IV En Það Besta Sem Guð Hefur Skapað, Er Nýr Dagur. (But the best thing God has created, is a New Day.) -- Sigur Ròs - Viðrar vel til loftárása

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

                                Wait until I post a picture of my new outfit. :) How about a dark robe, covered with mystic symbols like the hex codes from 00 to FF. A matching pointy hat and some kind of staff or wand. Growing the obligatory beard my take a while :) Edit: Just for fun, I just took it as my signature

                                modified on Thursday, May 15, 2008 5:32 AM

                                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