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. My friend has written a function 831 lines long.

My friend has written a function 831 lines long.

Scheduled Pinned Locked Moved The Lounge
question
43 Posts 25 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.
  • H Hoornet93

    In my company i got the task to modify something in my friend Visual C code. Imagine my surprise when I saw a function 831 linel long!!! Do u know a longer function? Love is the law, love under will.

    N Offline
    N Offline
    Nick Parker
    wrote on last edited by
    #33

    Hoornet@Job wrote: Do u know a longer function? I actually have a nice* stored procedure that does a huge compare process against two data sets in SQL Server that is at exactly 1311 lines long. I made sure I left a comment at the top something like this:

    /*=================================================================
    XXXXXXXXXXXXXXXXXXXXX
    XXX -- WARNING -- XXX

                     Do NOT modify this procedure unless 
                     you absolutely know what you are doing.
    

    ==================================================================*/

    *nice - otherwise known as a pain in the butt to write. Nick Parker
    May your glass be ever full. May the roof over your head be always strong. And may you be in heaven half an hour before the devil knows you’re dead. - Irish Blessing


    P 1 Reply Last reply
    0
    • C Chris Meech

      Not only have I come across functions with a greater number of lines, how's about what the functions were to do! I took over a DB reporting app that had a CView derived class that generated SQL on the fly, queried the database, built a huge array of strings to hold all the data. Only problem was it did this all in the OnDraw() method. Guess what happened whenever you tried to scroll the window? :) Or printed a report. Chris Meech "what makes CP different is the people and sense of community, things people will only discover if they join up and join in." Christian Graus Nov 14, 2002. "AAAAAAAAAHHHHHH!!!!! Those leaks are driving me crazy! How does one finds a memory leak in a garbage collected environment ??! Daniel Turini Nov. 2, 2002.

      N Offline
      N Offline
      Nick Parker
      wrote on last edited by
      #34

      Chris Meech wrote: Guess what happened whenever you tried to scroll the window? Or printed a report. Absolutely hilarious. :laugh: Nick Parker
      May your glass be ever full. May the roof over your head be always strong. And may you be in heaven half an hour before the devil knows you’re dead. - Irish Blessing


      1 Reply Last reply
      0
      • P Paul Watson

        Daniel Turini wrote: If he closed the connection right after using it, sorry to say, but he was right. The IIS will manage a ADO connection pool and "closing" a connection returns it more quickly to the pool. I think Jason meant there was a connection object for each query, not one re-used connection object. e.g.

        set oconn1 = server.create....
        set rs1 = server.create...

        set oconn2 = server.create....
        set rs2 = server.create...

        set oconn3 = server.create....
        set rs3 = server.create...

        That surely cannot be right.

        Paul Watson
        Bluegrass
        Cape Town, South Africa

        Colin Davies wrote: ...can you imagine a John Simmons stalker !

        N Offline
        N Offline
        Nick Parker
        wrote on last edited by
        #35

        Paul Watson wrote: That surely cannot be right. Don't doubt yourself mate. ;) Nick Parker
        May your glass be ever full. May the roof over your head be always strong. And may you be in heaven half an hour before the devil knows you’re dead. - Irish Blessing


        1 Reply Last reply
        0
        • P Pete Bassett

          Sorry guys, but I've got you all beat. I only heard about this after the fact but a colleague of mine in another department was given the task of writting a function which, given one "name" would return a shorter equivalent. Weeks later he emerged triumphant and presented the world with a VB function which consisted of one long Select statement. I dont know how many lines long the function was, but we printed it out onto A4 sheets. It took over half an hour and the stack was 2 inches thick. Now thats a function! Needless to say, someone wrote a 5 line equivalent that just did a look up in an Access table. Pete


          Insert Sig. Here!

          N Offline
          N Offline
          Nick Parker
          wrote on last edited by
          #36

          Pete Bassett wrote: Weeks later he emerged triumphant and presented the world with a VB function Quick, I think I see the problem.... ;P Nick Parker
          May your glass be ever full. May the roof over your head be always strong. And may you be in heaven half an hour before the devil knows you’re dead. - Irish Blessing


          1 Reply Last reply
          0
          • C Chris Losinger

            sure. i have a couple that are easily over 1100 lines. -c


            A conclusion is simply the place where someone got tired of thinking.

            Smaller Animals Software

            N Offline
            N Offline
            Nick Parker
            wrote on last edited by
            #37

            Chris Losinger wrote: i have a couple that are easily over 1100 lines. How would that look in C#, just kidding with you Chris... Nick Parker
            May your glass be ever full. May the roof over your head be always strong. And may you be in heaven half an hour before the devil knows you’re dead. - Irish Blessing


            1 Reply Last reply
            0
            • H Hoornet93

              In my company i got the task to modify something in my friend Visual C code. Imagine my surprise when I saw a function 831 linel long!!! Do u know a longer function? Love is the law, love under will.

              T Offline
              T Offline
              Thomas Freudenberg
              wrote on last edited by
              #38

              One guy in our company has written a function 5317 lines long :omg: Not that maintainable... Regards Thomas Sonork id: 100.10453 Thömmi


              Disclaimer:
              Because of heavy processing requirements, we are currently using some of your unused brain capacity for backup processing. Please ignore any hallucinations, voices or unusual dreams you may experience. Please avoid concentration-intensive tasks until further notice. Thank you.

              1 Reply Last reply
              0
              • H Hoornet93

                In my company i got the task to modify something in my friend Visual C code. Imagine my surprise when I saw a function 831 linel long!!! Do u know a longer function? Love is the law, love under will.

                R Offline
                R Offline
                RichardGrimmer
                wrote on last edited by
                #39

                Sure do - I work for a GIS company on a Gazetteer product (Glorified Address book), and the main search function (FindAddress()) is a grand total of 1366 lines - and can prove it if no one believes me! To be fair though it's one of those situations where stuff has been added over the past few years as quickly and as simply as possible, so the API that contains it has a .c file that at the last look was erm...(sounds of ruffling while I check..) OMG! 36832 lines! Maybe we should do something about it!

                1 Reply Last reply
                0
                • N Nick Parker

                  Hoornet@Job wrote: Do u know a longer function? I actually have a nice* stored procedure that does a huge compare process against two data sets in SQL Server that is at exactly 1311 lines long. I made sure I left a comment at the top something like this:

                  /*=================================================================
                  XXXXXXXXXXXXXXXXXXXXX
                  XXX -- WARNING -- XXX

                                   Do NOT modify this procedure unless 
                                   you absolutely know what you are doing.
                  

                  ==================================================================*/

                  *nice - otherwise known as a pain in the butt to write. Nick Parker
                  May your glass be ever full. May the roof over your head be always strong. And may you be in heaven half an hour before the devil knows you’re dead. - Irish Blessing


                  P Offline
                  P Offline
                  Patje
                  wrote on last edited by
                  #40

                  That reminds my of my old Apple IIc system. One of the manuals came with the sources for the ProDOS system and on one of the assembly lines the following comment was added (if I remember well): Changing this line will cause the earth to shake, volcanoes to erupt, and ProDOS not to boot. Enjoy life, this is not a rehearsal !!!

                  1 Reply Last reply
                  0
                  • H Hoornet93

                    In my company i got the task to modify something in my friend Visual C code. Imagine my surprise when I saw a function 831 linel long!!! Do u know a longer function? Love is the law, love under will.

                    B Offline
                    B Offline
                    Bjoern Graf
                    wrote on last edited by
                    #41

                    I have to maintain a project that has been converted from VB to MFC :suss: And most of its functions have way more than 831 lines :omg:

                    1 Reply Last reply
                    0
                    • J Jason Gerard

                      I worked with someone that did that. The page was at least 5000 lines. I also worked with someone that used multiple connection objects in an ASP page to run multiple queries. A new connection for every query, and there were quite a few queries. It was all connecting to the same database. Quite sad actually. Jason Gerard "This almost never matters, except quite often."

                      Richard DeemingR Offline
                      Richard DeemingR Offline
                      Richard Deeming
                      wrote on last edited by
                      #42

                      I took over a site from another company a couple of years ago. There were a few administration pages - just basic add, edit and delete. All of the variables were supposed to be page-level variables X| , and some mong had written a Sub to declare them all. Just:

                      Sub DeclareVariables
                      Dim oConnection
                      Dim oRecordset
                      Dim oImSuchAStupidT*sser
                      ...
                      End Sub

                      Worse than that was the update procedures: To add a record, they would open a recordset on the whole table, call AddNew, set the columns, and then Update. To edit a record, they would open a recordset on the whole table, move through each record until they found the one they wanted, Edit, update the columns, then Update. To delete a record, they would open up a recordset on the whole table, move through each record until they found the one they wanted, and call Delete. The pages were so similar, this had to be a standard template. And this company was (and still is) promoting their web-development services! :omg: :wtf: I had to laugh, after I'd stopped screaming. :-D


                      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                      "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

                      J 1 Reply Last reply
                      0
                      • Richard DeemingR Richard Deeming

                        I took over a site from another company a couple of years ago. There were a few administration pages - just basic add, edit and delete. All of the variables were supposed to be page-level variables X| , and some mong had written a Sub to declare them all. Just:

                        Sub DeclareVariables
                        Dim oConnection
                        Dim oRecordset
                        Dim oImSuchAStupidT*sser
                        ...
                        End Sub

                        Worse than that was the update procedures: To add a record, they would open a recordset on the whole table, call AddNew, set the columns, and then Update. To edit a record, they would open a recordset on the whole table, move through each record until they found the one they wanted, Edit, update the columns, then Update. To delete a record, they would open up a recordset on the whole table, move through each record until they found the one they wanted, and call Delete. The pages were so similar, this had to be a standard template. And this company was (and still is) promoting their web-development services! :omg: :wtf: I had to laugh, after I'd stopped screaming. :-D


                        "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                        J Offline
                        J Offline
                        Jason Gerard
                        wrote on last edited by
                        #43

                        Well, since we're trading horror stories of other peoples code. I worked with another fellow who, among other things, took 2 week to create a single ASP page with a form. The problem is, he used design time controls for everything and he named them intuitively a, b, c, aa, a1, etc... Needless to say, we had to rewrite it. It truly is amazing how other people code. Jason Gerard "This almost never matters, except quite often."

                        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