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. Fighting a monster

Fighting a monster

Scheduled Pinned Locked Moved The Lounge
question
68 Posts 34 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.
  • M MadGerbil

    I think the opposite situation is even worse. You get some abstraction/interface monkey at the keyboard and you may find yourself jumping through a dozen different 5 line files to get to the actual code that adds X + Y. Tons and tons of code written to handle the unlikely event that your boss is going to walk into your office one day and say, "Hey, let switch from Oracle to SQL". I understand some vended products feel the need to support that, but they don't.

    W Offline
    W Offline
    wapiti64
    wrote on last edited by
    #53

    I once had to dabble in a Fortran project with over 5000 files. It was mind boggling.

    1 Reply Last reply
    0
    • E englebart

      Was it an HP? HP seemed to love Octal. 12bit bytes/words work well with Octal.

      T Offline
      T Offline
      trønderen
      wrote on last edited by
      #54

      The company was called Norsk Data (when established: "Norsk Data-Elektronikk", "Norwegian Computer Electronics". The machines were named Nord-1, Nord-5 (the 32 bit ones), then Nord-10 and Nord-50. At the time of the story I told, they were ND-100 and ND-500. Later came an ND-5000, but I don't think there ever was any ND-1000. The fun thing about octal for the ND-100 is that it really didn't fit the instruction format at all: Most instructions was built from 4 fields, each 4 bits. In the same period, the MC68K was about to enter the market: With 8 registers, 8 addressing modes, always the low bits, only uppermost opcode field was of 4 bits. Yet binary MC68K instructions was always presented in hexadecimal format (unless, of course, the bit pattern was shown - which often was the case).

      1 Reply Last reply
      0
      • W WPerkins

        In the COBOL days 20K lines per source was not uncommon. But then, that was COBOL.

        T Offline
        T Offline
        trønderen
        wrote on last edited by
        #55

        One "Hacker's dictionary" listed "Cobol Fingers" as "Fingers worn down to a single joint". :-)

        W 1 Reply Last reply
        0
        • M Mircea Neacsu

          dandy72 wrote:

          decided to take it upon himself to "write it in a weekend"

          Hey, I heard of another CEO who wrote FAT on an airplane, for heaven's sake[^] :laugh:

          Mircea

          T Offline
          T Offline
          trønderen
          wrote on last edited by
          #56

          I sure like the ending of that story! (The Old New Thing is always worth reading!)

          1 Reply Last reply
          0
          • M MadGerbil

            I think the opposite situation is even worse. You get some abstraction/interface monkey at the keyboard and you may find yourself jumping through a dozen different 5 line files to get to the actual code that adds X + Y. Tons and tons of code written to handle the unlikely event that your boss is going to walk into your office one day and say, "Hey, let switch from Oracle to SQL". I understand some vended products feel the need to support that, but they don't.

            T Offline
            T Offline
            trønderen
            wrote on last edited by
            #57

            My rule-of-thumb for creating functions (/methods/procedures/...): If it represents another level of abstraction, then create it. If it doesn't, write it as inline code. It really is obvious. Yet, I often see code where the programmer obviously went "Ooops! Max line count reached! I'll have to put the lines above this point into a function, and create another function for the remaining lines." Functions representing nothing but some sequence of statements with no common purpose or meaning of life. Of course this is more prominent with junior programmers. But a fair share of programmers never grow up.

            1 Reply Last reply
            0
            • S Sri Krishna

              Around 10 years back, I joined my first company, where I was introduced to a codebase which was in Java/XML, kind of an Android Application. I saw files having 12k lines. It was a nightmare situation for me to even navigate the code and to follow up on a bug we were supposed to fix! As we progressed through the years, we found lower lines per file, saw IDE limiters on number of lines in a File(Max 1000), saw Coding Architectures like MVX(MVP, MVVM, MVI, etc.) asking us to break up code blocks into smaller more testable modules, saw Testing Tooling and other advice from many asking us to test a smallest unit. Overall, the experience is a very rewarding, at each step we learnt the mistake we did previously, made amends and then made some more mistakes :laugh: and then fixed them in the coming months.

              T Offline
              T Offline
              trønderen
              wrote on last edited by
              #58

              Sri Krishna wrote:

              at each step we learnt the mistake we did previously, made amends and then made some more mistakes

              Experience is the ability to recognize a mistake when you repeat it.

              1 Reply Last reply
              0
              • M Mircea Neacsu

                I started to dive in a new (for me) very large code base. One of the files is 9500 lines. Got me wondering: what's the largest single source file you ever met? I'm not talking about automatically generated source files, but those written by humans. On the same note, when do you think it's time to break a file in smaller pieces? For me, it is somewhere around 1000 lines.

                Mircea

                D Offline
                D Offline
                destynova
                wrote on last edited by
                #59

                I was tasked with "tidying up" a killer demo hacked up by a data scientist on our team during his holidays. After looking at the single 15k line Javascript file he produced, I suggested we rewrite the demo frontend from scratch since it was going to be difficult to work on (even though it looked really polished). That suggestion was shot down as unnecessary engineering, but when I looked closer it became clear that he'd "borrowed" a complete demo published by another company -- a single minified Javascript file -- and swapped out of a few pieces so it called his own prototype backend running on a laptop (that bit at least was entirely his own work). At that point I suggested this might be a good reason for us to proceed with the frontend rewrite, and that I wouldn't be comfortable putting my name on another company's pilfered and tweaked demo. The DS seemed relieved and immediately agreed. He was a good guy, but probably crumpling under delivery pressure from management, and he never really intended for an internal proof-of-concept to suddenly become a user-facing feature of the site, but by then it was hard to backpedal until I forced the issue.

                1 Reply Last reply
                0
                • M Mircea Neacsu

                  I started to dive in a new (for me) very large code base. One of the files is 9500 lines. Got me wondering: what's the largest single source file you ever met? I'm not talking about automatically generated source files, but those written by humans. On the same note, when do you think it's time to break a file in smaller pieces? For me, it is somewhere around 1000 lines.

                  Mircea

                  C Offline
                  C Offline
                  Cezar Lamann
                  wrote on last edited by
                  #60

                  12k lines in Program.cs for a console/batch processing application running at a government authority where I used to work. It was for validating and processing Financial Transactions (MiFID II) The original developer was on extended maternity leave+vacation (1.5 year). No one wanted to give maintenance to it (neither the original dev, when she came back 8 months after I was hired) because it was too unwieldy to do anything there. I was hired specifically to deal with it. Took around two months to have it on my mind to actually start breaking it down. Since no one was interested in working on the beast, I kinda grew fond of the project because it was important, and no one bothered/pressured me when I told them that improving things would take time. Also, I was free to perform any needed refactorings to the thing. I managed to improve its performance by several times first (to remove processing bottlenecks), and then started refactoring it, bit by bit. It was a pity I had to leave that project behind and go back to my home country. Since I was a contractor, and it was before the pandemic started, so people were not very fond of offering me to work remotely.

                  1 Reply Last reply
                  0
                  • G Getulio_Domingues

                    Here in Brazil sales taxes are Lovecraftian levels of nightmarish. We have a form in a shared Windows Forms library that we use in several of our "of the shelf" products that deals with invoicing and taxes of product sales that is 17K lines in and of itself, no counting helpers and specialized components and dialogs. Most of that code it to manage the interacion between the UI and the rules and calculations for taxes. You sometimes see people complaining about doing income tax declarations, they have no idea how it is like to sell a simple piece of candy in Brazil.

                    C Offline
                    C Offline
                    Cezar Lamann
                    wrote on last edited by
                    #61

                    não é reddit, mas r/suddenlycaralho ! Que vai querer no print, meu bom companheiro Dev BR, sofredor com cálculo de IPI/PIS/COFINS?

                    1 Reply Last reply
                    0
                    • M Mircea Neacsu

                      I started to dive in a new (for me) very large code base. One of the files is 9500 lines. Got me wondering: what's the largest single source file you ever met? I'm not talking about automatically generated source files, but those written by humans. On the same note, when do you think it's time to break a file in smaller pieces? For me, it is somewhere around 1000 lines.

                      Mircea

                      U Offline
                      U Offline
                      User 11907673
                      wrote on last edited by
                      #62

                      Probably not a reasonable answer because this is from back in the mainframe days but I seem to recall the Unisys A-Series operating System MCP (yes we laughed when Tron came out) was a million - ish lines of code. And not assembly code, written in NEWP, an Algol loke language.

                      1 Reply Last reply
                      0
                      • Sander RosselS Sander Rossel

                        Slacker007 wrote:

                        If all the code is concise and organized well and has purpose

                        Which is almost never the case in a 9k lines file ;)

                        Best, Sander Azure DevOps Succinctly (free eBook) Azure Serverless Succinctly (free eBook) Migrating Apps to the Cloud with Azure arrgh.js - Bringing LINQ to JavaScript

                        D Offline
                        D Offline
                        David ONeil
                        wrote on last edited by
                        #63

                        Probably has five recursive functions buried in the middle of the file, which calls all of the other functions. Each recursion is controlled by a different combination of global variables defined and controlled in other units.

                        Our Forgotten Astronomy | Object Oriented Programming with C++ | Wordle solver

                        1 Reply Last reply
                        0
                        • Sander RosselS Sander Rossel

                          Slacker007 wrote:

                          If all the code is concise and organized well and has purpose

                          Which is almost never the case in a 9k lines file ;)

                          Best, Sander Azure DevOps Succinctly (free eBook) Azure Serverless Succinctly (free eBook) Migrating Apps to the Cloud with Azure arrgh.js - Bringing LINQ to JavaScript

                          T Offline
                          T Offline
                          trønderen
                          wrote on last edited by
                          #64

                          A frightening large fraction of modern programmers believe that putting each method/function into its own individual file, headed by a 90 line open-source license statement, magically solves those problems.

                          Sander RosselS 1 Reply Last reply
                          0
                          • T trønderen

                            A frightening large fraction of modern programmers believe that putting each method/function into its own individual file, headed by a 90 line open-source license statement, magically solves those problems.

                            Sander RosselS Offline
                            Sander RosselS Offline
                            Sander Rossel
                            wrote on last edited by
                            #65

                            Those guys are posers. I put every word in a separate file. I use a build script that concats all necessary files so it becomes a compilable script again. That way, I never write a single word twice, so it's completely DRY! Let the build server handle the complexities. Also, when a function is compiled it becomes its own service, because a service should do one thing only. Naturally, I'm using Kubernetes to deploy all my services. It's completely SOLID I tell you :D

                            Best, Sander Azure DevOps Succinctly (free eBook) Azure Serverless Succinctly (free eBook) Migrating Apps to the Cloud with Azure arrgh.js - Bringing LINQ to JavaScript

                            1 Reply Last reply
                            0
                            • M Mircea Neacsu

                              I started to dive in a new (for me) very large code base. One of the files is 9500 lines. Got me wondering: what's the largest single source file you ever met? I'm not talking about automatically generated source files, but those written by humans. On the same note, when do you think it's time to break a file in smaller pieces? For me, it is somewhere around 1000 lines.

                              Mircea

                              J Offline
                              J Offline
                              jschell
                              wrote on last edited by
                              #66

                              Mircea Neacsu wrote:

                              what's the largest single source file you ever met?

                              File? I found a C++ class which spanned 3 source files - at least. It had 20,000 lines of code and at least 200 attributes and 200 methods. Years later I read the book "AntiPatterns" in which it described the God Pattern. That is what that class was.

                              1 Reply Last reply
                              0
                              • M MadGerbil

                                I think the opposite situation is even worse. You get some abstraction/interface monkey at the keyboard and you may find yourself jumping through a dozen different 5 line files to get to the actual code that adds X + Y. Tons and tons of code written to handle the unlikely event that your boss is going to walk into your office one day and say, "Hey, let switch from Oracle to SQL". I understand some vended products feel the need to support that, but they don't.

                                J Offline
                                J Offline
                                jschell
                                wrote on last edited by
                                #67

                                MadGerbil wrote:

                                "Hey, let switch from Oracle to SQL".

                                To be fair that actually happened to me. But from SQL Server to Oracle. It took me, by myself, a bit less than two weeks and had no impact at all on any other developer. Customer mandated it. The boss that just delivered the news was rather skeptical about what impact it would have. There was a very specific DB API although without a lot of layers. Contrast with the more recent job where the required change from SQL Server to MySQL is closing in on 2 years now. And still not done. That didn't have a DB API layer. It has a mismash of various idioms and misuses of various APIs over years.

                                1 Reply Last reply
                                0
                                • T trønderen

                                  One "Hacker's dictionary" listed "Cobol Fingers" as "Fingers worn down to a single joint". :-)

                                  W Offline
                                  W Offline
                                  WPerkins
                                  wrote on last edited by
                                  #68

                                  Still... a well written COBOL program is elegant AND I can open any damn pickle jar I encounter.

                                  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