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. Your longuest function!

Your longuest function!

Scheduled Pinned Locked Moved The Lounge
csharpc++swift
44 Posts 14 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 Super Lloyd

    Well I haven't pay attention to how long mine are. But the fact is, I'm porting my boss's MacOSX application to Windows and I routinely found method over... ... ... 1300 lines of code! :doh: To tone done this fact I should mention it's written in Objective-C which, like C and C++, is quite verbose. And there are (a few) comments. Yet, it's long.... That the size of a class for me! Sometimes I found it tiresome to "translate it" to proper C#...

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

    Yep, 1460 lines in one of my functions. Its a switch statement that handles LCP requests, all written in C. The file itself is 5000 lines plus. Longest file I ever saw was over 90,000 lines. It was auto generated code consisting of a class constructor. (Yes, just one constructor). It was generated from an excell file that defined the data layout of a particular RAM pack.

    Truth is the subjection of reality to an individuals perception

    S 1 Reply Last reply
    0
    • L Lost User

      Yep, 1460 lines in one of my functions. Its a switch statement that handles LCP requests, all written in C. The file itself is 5000 lines plus. Longest file I ever saw was over 90,000 lines. It was auto generated code consisting of a class constructor. (Yes, just one constructor). It was generated from an excell file that defined the data layout of a particular RAM pack.

      Truth is the subjection of reality to an individuals perception

      S Offline
      S Offline
      Super Lloyd
      wrote on last edited by
      #3

      Perhaps I should say your longuest, manually typed, non-repitive function! big switch or auto generated obviously don't qualify! (they could be very long, yet very clear) speaking of autogenerate code, for this project I auto generated 4 files. one of them is 1 MB, 400.000 line of Managed C++ ;P

      L 1 Reply Last reply
      0
      • S Super Lloyd

        Well I haven't pay attention to how long mine are. But the fact is, I'm porting my boss's MacOSX application to Windows and I routinely found method over... ... ... 1300 lines of code! :doh: To tone done this fact I should mention it's written in Objective-C which, like C and C++, is quite verbose. And there are (a few) comments. Yet, it's long.... That the size of a class for me! Sometimes I found it tiresome to "translate it" to proper C#...

        A Offline
        A Offline
        Anna Jayne Metcalfe
        wrote on last edited by
        #4

        It sounds like your boss needs educating in how to code in a maintainable fashion. I'd not let a method longer than about 100 lines through QA, and only then with harsh criticism and a promise to refactor it as soon as practical. If it can't fit on one sheet of A4 comfortably, it's far too long.

        Anna :rose: Currently working mostly on: Visual Lint :cool: Anna's Place | Tears and Laughter "Be yourself - not what others think you should be" - Marcia Graesch "Anna's just a sexy-looking lesbian tart" - A friend, trying to wind me up. It didn't work.

        S C R L J 7 Replies Last reply
        0
        • S Super Lloyd

          Perhaps I should say your longuest, manually typed, non-repitive function! big switch or auto generated obviously don't qualify! (they could be very long, yet very clear) speaking of autogenerate code, for this project I auto generated 4 files. one of them is 1 MB, 400.000 line of Managed C++ ;P

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

          The 1400 line function was manually typed, in C, as is the whole file.

          Truth is the subjection of reality to an individuals perception

          S 1 Reply Last reply
          0
          • S Super Lloyd

            Well I haven't pay attention to how long mine are. But the fact is, I'm porting my boss's MacOSX application to Windows and I routinely found method over... ... ... 1300 lines of code! :doh: To tone done this fact I should mention it's written in Objective-C which, like C and C++, is quite verbose. And there are (a few) comments. Yet, it's long.... That the size of a class for me! Sometimes I found it tiresome to "translate it" to proper C#...

            F Offline
            F Offline
            Frank Kerrigan
            wrote on last edited by
            #6

            12 Years of marriage! does that count ? -- modified at 4:10 Tuesday 1st August, 2006


            Look where you want to go not where you don't want to crash. Bikers Bible

            S G 2 Replies Last reply
            0
            • F Frank Kerrigan

              12 Years of marriage! does that count ? -- modified at 4:10 Tuesday 1st August, 2006


              Look where you want to go not where you don't want to crash. Bikers Bible

              S Offline
              S Offline
              Super Lloyd
              wrote on last edited by
              #7

              that depends... ;P

              1 Reply Last reply
              0
              • A Anna Jayne Metcalfe

                It sounds like your boss needs educating in how to code in a maintainable fashion. I'd not let a method longer than about 100 lines through QA, and only then with harsh criticism and a promise to refactor it as soon as practical. If it can't fit on one sheet of A4 comfortably, it's far too long.

                Anna :rose: Currently working mostly on: Visual Lint :cool: Anna's Place | Tears and Laughter "Be yourself - not what others think you should be" - Marcia Graesch "Anna's just a sexy-looking lesbian tart" - A friend, trying to wind me up. It didn't work.

                S Offline
                S Offline
                Super Lloyd
                wrote on last edited by
                #8

                Indeed!! :-D

                1 Reply Last reply
                0
                • A Anna Jayne Metcalfe

                  It sounds like your boss needs educating in how to code in a maintainable fashion. I'd not let a method longer than about 100 lines through QA, and only then with harsh criticism and a promise to refactor it as soon as practical. If it can't fit on one sheet of A4 comfortably, it's far too long.

                  Anna :rose: Currently working mostly on: Visual Lint :cool: Anna's Place | Tears and Laughter "Be yourself - not what others think you should be" - Marcia Graesch "Anna's just a sexy-looking lesbian tart" - A friend, trying to wind me up. It didn't work.

                  C Offline
                  C Offline
                  Colin Angus Mackay
                  wrote on last edited by
                  #9

                  Anna-Jayne Metcalfe wrote:

                  If it can't fit on one sheet of A4 comfortably, it's far too long

                  Absolutely - My longest methods tend to be unit tests where they set up the environment before running the test code and then testing the results afterwards. For production code a few lines is typical, maybe two or three dozen at most.


                  Scottish Developers events: * .NET debugging, tracing and instrumentation by Duncan Edwards Jones and Code Coverage in .NET by Craig Murphy * Developer Day Scotland: are you interested in speaking or attending? My: Website | Blog

                  A 1 Reply Last reply
                  0
                  • A Anna Jayne Metcalfe

                    It sounds like your boss needs educating in how to code in a maintainable fashion. I'd not let a method longer than about 100 lines through QA, and only then with harsh criticism and a promise to refactor it as soon as practical. If it can't fit on one sheet of A4 comfortably, it's far too long.

                    Anna :rose: Currently working mostly on: Visual Lint :cool: Anna's Place | Tears and Laughter "Be yourself - not what others think you should be" - Marcia Graesch "Anna's just a sexy-looking lesbian tart" - A friend, trying to wind me up. It didn't work.

                    R Offline
                    R Offline
                    Ray Kinsella
                    wrote on last edited by
                    #10

                    needs one serious dose of QACPP me thinks ...

                    Regards Ray "Je Suis Mort De Rire" Blogging @ Keratoconus Watch

                    A 1 Reply Last reply
                    0
                    • A Anna Jayne Metcalfe

                      It sounds like your boss needs educating in how to code in a maintainable fashion. I'd not let a method longer than about 100 lines through QA, and only then with harsh criticism and a promise to refactor it as soon as practical. If it can't fit on one sheet of A4 comfortably, it's far too long.

                      Anna :rose: Currently working mostly on: Visual Lint :cool: Anna's Place | Tears and Laughter "Be yourself - not what others think you should be" - Marcia Graesch "Anna's just a sexy-looking lesbian tart" - A friend, trying to wind me up. It didn't work.

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

                      "It has to fit on one page". Then the boss orders a poster size printer... X|

                      The tigress is here :-D

                      A 1 Reply Last reply
                      0
                      • A Anna Jayne Metcalfe

                        It sounds like your boss needs educating in how to code in a maintainable fashion. I'd not let a method longer than about 100 lines through QA, and only then with harsh criticism and a promise to refactor it as soon as practical. If it can't fit on one sheet of A4 comfortably, it's far too long.

                        Anna :rose: Currently working mostly on: Visual Lint :cool: Anna's Place | Tears and Laughter "Be yourself - not what others think you should be" - Marcia Graesch "Anna's just a sexy-looking lesbian tart" - A friend, trying to wind me up. It didn't work.

                        J Offline
                        J Offline
                        J Dunlap
                        wrote on last edited by
                        #12

                        :-O I've got a method about 230 lines long (with a lot of comments). It's the main method for a full-fledged table layout algorithm that has: * col/row width options such as fit-to-content, percent, and absolute * the ability to choose which rows/cols get "crushed" or get collapsed when things don't fit * choice of which rows/cols if any are widened to fit the remaining layout area * space prioritization for rows/cols * repeating rows/cols * at least several other features I've broken up the functionality into at least 15 methods, but the main function is still too big for my liking. -- modified at 5:03 Tuesday 1st August, 2006

                        S 1 Reply Last reply
                        0
                        • S Super Lloyd

                          Well I haven't pay attention to how long mine are. But the fact is, I'm porting my boss's MacOSX application to Windows and I routinely found method over... ... ... 1300 lines of code! :doh: To tone done this fact I should mention it's written in Objective-C which, like C and C++, is quite verbose. And there are (a few) comments. Yet, it's long.... That the size of a class for me! Sometimes I found it tiresome to "translate it" to proper C#...

                          V Offline
                          V Offline
                          V 0
                          wrote on last edited by
                          #13

                          longest class I've ever seen was over 13000 lines long. It contained 8 classes with all the functions scattered through one another. It was VC++. It was the kind of program that gets you the response: "Don't touch that, it works." response. :laugh:

                          I've found a living worth working for, but I haven't found work worth living for. :beer:
                          :jig:

                          S G 2 Replies Last reply
                          0
                          • V V 0

                            longest class I've ever seen was over 13000 lines long. It contained 8 classes with all the functions scattered through one another. It was VC++. It was the kind of program that gets you the response: "Don't touch that, it works." response. :laugh:

                            I've found a living worth working for, but I haven't found work worth living for. :beer:
                            :jig:

                            S Offline
                            S Offline
                            Super Lloyd
                            wrote on last edited by
                            #14

                            Not bad hey! ;)

                            1 Reply Last reply
                            0
                            • C Colin Angus Mackay

                              Anna-Jayne Metcalfe wrote:

                              If it can't fit on one sheet of A4 comfortably, it's far too long

                              Absolutely - My longest methods tend to be unit tests where they set up the environment before running the test code and then testing the results afterwards. For production code a few lines is typical, maybe two or three dozen at most.


                              Scottish Developers events: * .NET debugging, tracing and instrumentation by Duncan Edwards Jones and Code Coverage in .NET by Craig Murphy * Developer Day Scotland: are you interested in speaking or attending? My: Website | Blog

                              A Offline
                              A Offline
                              Anna Jayne Metcalfe
                              wrote on last edited by
                              #15

                              I often find the length of the method banner (particularly if it has full Doxygen commenting and notes on the usage of the method) is a significant proportion of that of the method itself...:doh:

                              Anna :rose: Currently working mostly on: Visual Lint :cool: Anna's Place | Tears and Laughter "Be yourself - not what others think you should be" - Marcia Graesch "Anna's just a sexy-looking lesbian tart" - A friend, trying to wind me up. It didn't work.

                              G 1 Reply Last reply
                              0
                              • R Ray Kinsella

                                needs one serious dose of QACPP me thinks ...

                                Regards Ray "Je Suis Mort De Rire" Blogging @ Keratoconus Watch

                                A Offline
                                A Offline
                                Anna Jayne Metcalfe
                                wrote on last edited by
                                #16

                                Yep...and probably a large shotgun. ;)

                                Anna :rose: Currently working mostly on: Visual Lint :cool: Anna's Place | Tears and Laughter "Be yourself - not what others think you should be" - Marcia Graesch "Anna's just a sexy-looking lesbian tart" - A friend, trying to wind me up. It didn't work.

                                1 Reply Last reply
                                0
                                • A Anna Jayne Metcalfe

                                  I often find the length of the method banner (particularly if it has full Doxygen commenting and notes on the usage of the method) is a significant proportion of that of the method itself...:doh:

                                  Anna :rose: Currently working mostly on: Visual Lint :cool: Anna's Place | Tears and Laughter "Be yourself - not what others think you should be" - Marcia Graesch "Anna's just a sexy-looking lesbian tart" - A friend, trying to wind me up. It didn't work.

                                  G Offline
                                  G Offline
                                  Graham Shanks
                                  wrote on last edited by
                                  #17

                                  Often I find that it is much larger than the method. By the time you add examples of use, pre and post conditions, etc., etc. Graham

                                  A 1 Reply Last reply
                                  0
                                  • F Frank Kerrigan

                                    12 Years of marriage! does that count ? -- modified at 4:10 Tuesday 1st August, 2006


                                    Look where you want to go not where you don't want to crash. Bikers Bible

                                    G Offline
                                    G Offline
                                    Gizzo
                                    wrote on last edited by
                                    #18

                                    Frank Kerrigan wrote:

                                    12 Years of marriage! does that count ?

                                    I agree, it's the most difficult part, and you can not debug any line.

                                    1 Reply Last reply
                                    0
                                    • V V 0

                                      longest class I've ever seen was over 13000 lines long. It contained 8 classes with all the functions scattered through one another. It was VC++. It was the kind of program that gets you the response: "Don't touch that, it works." response. :laugh:

                                      I've found a living worth working for, but I haven't found work worth living for. :beer:
                                      :jig:

                                      G Offline
                                      G Offline
                                      Gizzo
                                      wrote on last edited by
                                      #19

                                      18000 lines in 1 class over here...:~

                                      1 Reply Last reply
                                      0
                                      • G Graham Shanks

                                        Often I find that it is much larger than the method. By the time you add examples of use, pre and post conditions, etc., etc. Graham

                                        A Offline
                                        A Offline
                                        Anna Jayne Metcalfe
                                        wrote on last edited by
                                        #20

                                        They can be. A great deal depends on the size and requirements of the interface.

                                        Anna :rose: Currently working mostly on: Visual Lint :cool: Anna's Place | Tears and Laughter "Be yourself - not what others think you should be" - Marcia Graesch "Anna's just a sexy-looking lesbian tart" - A friend, trying to wind me up. It didn't work.

                                        1 Reply Last reply
                                        0
                                        • L Lost User

                                          "It has to fit on one page". Then the boss orders a poster size printer... X|

                                          The tigress is here :-D

                                          A Offline
                                          A Offline
                                          Anna Jayne Metcalfe
                                          wrote on last edited by
                                          #21

                                          That's why I said A4 ;P

                                          Anna :rose: Currently working mostly on: Visual Lint :cool: Anna's Place | Tears and Laughter "Be yourself - not what others think you should be" - Marcia Graesch "Anna's just a sexy-looking lesbian tart" - A friend, trying to wind me up. It didn't work.

                                          E 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