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. Largest Code File?

Largest Code File?

Scheduled Pinned Locked Moved The Lounge
question
35 Posts 27 Posters 1 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.
  • R realJSOP

    The largest file I've ever encountered was 32,000 lines. The true horror was that it was a partial class extension with nothing but ONE method that implemented a giant switch statement. Yes, a 32,000 line switch statement. 32,000 lines!

    ".45 ACP - because shooting twice is just silly" - JSOP, 2010
    -----
    You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
    -----
    When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

    M Offline
    M Offline
    MarkTJohnson
    wrote on last edited by
    #26

    how many cases within the switch?

    R 1 Reply Last reply
    0
    • M MarkTJohnson

      how many cases within the switch?

      R Offline
      R Offline
      realJSOP
      wrote on last edited by
      #27

      It was years ago, and I never counted, but "hundreds" comes to mind. There were a handful with 300-500 lines.

      ".45 ACP - because shooting twice is just silly" - JSOP, 2010
      -----
      You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
      -----
      When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

      1 Reply Last reply
      0
      • M michaelbarb

        I was recently given a Windows form application to work on. It was done as a single form with over 24,000 lines in the code behind file. I was taught that no file should be over 1,000 lines. Maybe 2,000 if a lot of repetition was required. What do others feel about the maximum size of a single file? Not also the single form had nested tab containers with over 600 controls on this singe form. They went as much as 5 deep. It was an abuse of the Window Forms framework in many aspects. My question is only about code file size.

        So many years of programming I have forgotten more languages than I know.

        A Offline
        A Offline
        Asday
        wrote on last edited by
        #28

        A function should never be taller than my screen (~100 lines). Other than that, there's no real need to set these arbitrary numbers. SLOC can be indicative of an issue, but it's not an issue in and of itself. > if a lot of repetition was required Repetition is _never_ required.

        P 1 Reply Last reply
        0
        • B BillWoodruff

          Th combination of jumbo file size and gazillion controls suggests to me a programmer strategy called "lifetime employment insurance." cheers, Bill

          «One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali

          M Offline
          M Offline
          michaelbarb
          wrote on last edited by
          #29

          I vote this the best comment in the whole thread.

          So many years of programming I have forgotten more languages than I know.

          1 Reply Last reply
          0
          • enhzflepE enhzflep

            I'd hoped to read a tale that resembled mine. Fortunately, you've supplied the fun by talking about a file that will just fit into a 16bit seg. I tried to save my file one day and *pow* no-go. I'd also hit the 64k limit and now had to transition to some other text editor since my syntax-highlighting one could no longer chew on what I fed it. CRAP! Bloody Notepad it is then for this x86 assembly.

            K Offline
            K Offline
            kmoorevs
            wrote on last edited by
            #30

            Actually, now that I think about it, that 64k limit was for a proc/function. :-O This really only equated to about 1400 lines of code. Sorry for the confusion.

            "Go forth into the source" - Neal Morse

            1 Reply Last reply
            0
            • A Asday

              A function should never be taller than my screen (~100 lines). Other than that, there's no real need to set these arbitrary numbers. SLOC can be indicative of an issue, but it's not an issue in and of itself. > if a lot of repetition was required Repetition is _never_ required.

              P Offline
              P Offline
              PIEBALDconsult
              wrote on last edited by
              #31

              Asday wrote:

              Repetition is never required.

              You can say that again.

              A 1 Reply Last reply
              0
              • R realJSOP

                On really busy/complex forms, I make heavy use of partial classes, separating constructors, event handlers, and helper methods. On objects, I do the same thing when something complex is a viably separate concern. I try to keep line counts to less that 1000 where practical.

                ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                -----
                You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                -----
                When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

                B Offline
                B Offline
                BillWoodruff
                wrote on last edited by
                #32

                #realJSOP wrote:

                On really busy/complex forms, I make heavy use of partial classes, separating constructors, event handlers, and helper methods. On objects, I do the same thing when something complex is a viably separate concern. I try to keep line counts to less that 1000 where practical.

                :thumbsup:

                «One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali

                1 Reply Last reply
                0
                • P PIEBALDconsult

                  Asday wrote:

                  Repetition is never required.

                  You can say that again.

                  A Offline
                  A Offline
                  Asday
                  wrote on last edited by
                  #33

                  You need to cease. Especially seeing as that email notification somehow got to me twice.

                  1 Reply Last reply
                  0
                  • B BillWoodruff

                    Th combination of jumbo file size and gazillion controls suggests to me a programmer strategy called "lifetime employment insurance." cheers, Bill

                    «One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali

                    G Offline
                    G Offline
                    grralph1
                    wrote on last edited by
                    #34

                    I will second michaelbarb's Motion. A perfect comment and gets my vote for the best.

                    "Rock journalism is people who can't write interviewing people who can't talk for people who can't read." Frank Zappa 1980

                    1 Reply Last reply
                    0
                    • M michaelbarb

                      I was recently given a Windows form application to work on. It was done as a single form with over 24,000 lines in the code behind file. I was taught that no file should be over 1,000 lines. Maybe 2,000 if a lot of repetition was required. What do others feel about the maximum size of a single file? Not also the single form had nested tab containers with over 600 controls on this singe form. They went as much as 5 deep. It was an abuse of the Window Forms framework in many aspects. My question is only about code file size.

                      So many years of programming I have forgotten more languages than I know.

                      C Offline
                      C Offline
                      charlieg
                      wrote on last edited by
                      #35

                      I agree with the "size is arbitrary" view. My beef is that large files tend to collect multiple sets of application work. On a project with multiple developers, it becomes difficult to manage everyone pounding on the same source code. True, today's version control systems make it easier to merge, but my preference is break up the processing logically (into separate files) which aids in tracking changes through the system.

                      Charlie Gilley <italic>Stuck in a dysfunctional matrix from which I must escape... "Where liberty dwells, there is my country." B. Franklin, 1783 “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759

                      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