It was literally like that. I had a script of about 310 lines and the main function was like 10-20 lines of code. I had a very nice Setup of objects that handled all functionality possible behaviours independent and so my main function was just receiving a user input from another function and add accordingly which included like 3-4 different scenarios that are being handled in the main function.

    • da_cow (she/her)@feddit.orgOP
      link
      fedilink
      arrow-up
      1
      ·
      1 month ago

      Its also very nice, when you spend hours writing everything else and then once all of it has been tested you write a few lines of code in the main function and 10 minutes later everything works as it should.

  • kryptonianCodeMonkey@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    1 month ago

    I mean… that is just good design. The main function should be the initializer and orchestrator of the logic. You should be able to look at the main function and tell, at a high level, what the program is doing. It should be usually pretty basic and procedural. Other functions handle the details and complexity.