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. Other Discussions
  3. The Weird and The Wonderful
  4. 750 Line function

750 Line function

Scheduled Pinned Locked Moved The Weird and The Wonderful
14 Posts 11 Posters 106 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.
  • T Tristan Rhodes

    Where i work, we have an aspx page with a single 750 line function for page load. It works by posting querystring data back to itself, and It's order of execution is backwards, i.e. the first bit of executed logic is at the end of the function, and in some cases it goes 12 branch statements deep. Fun :S

    ------------------------------- Carrier Bags - 21st Century Tumbleweed.

    P Offline
    P Offline
    Prakash Nadar
    wrote on last edited by
    #5

    Sounds like some sort of automated test cases being run one after the other.


    -Prakash

    1 Reply Last reply
    0
    • T Tristan Rhodes

      no, it posts back to the user each time, and then doing stuff posts BACK to the page again with whatever QS arguments were attatched to the link.

      ------------------------------- Carrier Bags - 21st Century Tumbleweed.

      B Offline
      B Offline
      Brady Kelly
      wrote on last edited by
      #6

      Oh, so basically the whole page is implemented in Page_Load? Hey, Ajax is overrated any way, and so is OO for that matter. Even structured programming pales before the Monolith.

      1 Reply Last reply
      0
      • T Tristan Rhodes

        Where i work, we have an aspx page with a single 750 line function for page load. It works by posting querystring data back to itself, and It's order of execution is backwards, i.e. the first bit of executed logic is at the end of the function, and in some cases it goes 12 branch statements deep. Fun :S

        ------------------------------- Carrier Bags - 21st Century Tumbleweed.

        P Offline
        P Offline
        Pete OHanlon
        wrote on last edited by
        #7

        Oh wow. Who needs method calls anyway? Goto and Gosub should be more than enough for real programmers.

        Deja View - the feeling that you've seen this post before.

        P 1 Reply Last reply
        0
        • C Christian Graus

          Wow - that sounds like two problems in one. 750 lines ? Apart from the fact that no function should come within cooee of that size, how do you get 750 lines in the code behind, unless there's no business logic layer ?

          Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

          T Offline
          T Offline
          Tristan Rhodes
          wrote on last edited by
          #8

          Layers? Now that's a funny idea :(

          ------------------------------- Carrier Bags - 21st Century Tumbleweed.

          1 Reply Last reply
          0
          • P Pete OHanlon

            Oh wow. Who needs method calls anyway? Goto and Gosub should be more than enough for real programmers.

            Deja View - the feeling that you've seen this post before.

            P Offline
            P Offline
            Paul Conrad
            wrote on last edited by
            #9

            Pete O'Hanlon wrote:

            Goto and Gosub should be more than enough for real programmers

            :laugh:

            1 Reply Last reply
            0
            • T Tristan Rhodes

              Where i work, we have an aspx page with a single 750 line function for page load. It works by posting querystring data back to itself, and It's order of execution is backwards, i.e. the first bit of executed logic is at the end of the function, and in some cases it goes 12 branch statements deep. Fun :S

              ------------------------------- Carrier Bags - 21st Century Tumbleweed.

              C Offline
              C Offline
              Collin Parker
              wrote on last edited by
              #10

              Wow, maybe you should submit that to Guinness, it may be a new world record for a page_load!

              1 Reply Last reply
              0
              • T Tristan Rhodes

                Where i work, we have an aspx page with a single 750 line function for page load. It works by posting querystring data back to itself, and It's order of execution is backwards, i.e. the first bit of executed logic is at the end of the function, and in some cases it goes 12 branch statements deep. Fun :S

                ------------------------------- Carrier Bags - 21st Century Tumbleweed.

                W Offline
                W Offline
                WhiteSpy
                wrote on last edited by
                #11

                Sounds like a software version of a Rube Goldberg machine...:laugh:

                1 Reply Last reply
                0
                • T Tristan Rhodes

                  Where i work, we have an aspx page with a single 750 line function for page load. It works by posting querystring data back to itself, and It's order of execution is backwards, i.e. the first bit of executed logic is at the end of the function, and in some cases it goes 12 branch statements deep. Fun :S

                  ------------------------------- Carrier Bags - 21st Century Tumbleweed.

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

                  I disagree with what everyone said. I can think of a lot of things that would justify a long Page_Load function like that. There is nothing inherently wrong with a really long function. It usually indicates that something needs to be re-factored, but that is not always the case. If everything in the function is atomic, unique, and well-formed... then there's no reason to make it even longer by breaking it up into multiple parts, which would only serve to decrease performance by the amount of the function-calling overhead. I would rather read an if..else structure that had 50 branches, than dive into 50 separate functions which are only called one time.

                  "Quality Software since 1983!"
                  http://www.smoothjazzy.com/ - see the "Programming" section for freeware tools and articles.

                  J 1 Reply Last reply
                  0
                  • J Jasmine2501

                    I disagree with what everyone said. I can think of a lot of things that would justify a long Page_Load function like that. There is nothing inherently wrong with a really long function. It usually indicates that something needs to be re-factored, but that is not always the case. If everything in the function is atomic, unique, and well-formed... then there's no reason to make it even longer by breaking it up into multiple parts, which would only serve to decrease performance by the amount of the function-calling overhead. I would rather read an if..else structure that had 50 branches, than dive into 50 separate functions which are only called one time.

                    "Quality Software since 1983!"
                    http://www.smoothjazzy.com/ - see the "Programming" section for freeware tools and articles.

                    J Offline
                    J Offline
                    John R Shaw
                    wrote on last edited by
                    #13

                    I hope you are kidding! It usually indicates that it is way too complicated and needs to be broken down in to smaller chunks. Of course there are acceptations, but they are far and few between.

                    INTP "Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra

                    J 1 Reply Last reply
                    0
                    • J John R Shaw

                      I hope you are kidding! It usually indicates that it is way too complicated and needs to be broken down in to smaller chunks. Of course there are acceptations, but they are far and few between.

                      INTP "Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra

                      J Offline
                      J Offline
                      Jasmine2501
                      wrote on last edited by
                      #14

                      No I wasn't joking. It's rare, but a long a function isn't always wrong. If everything is only done once, why push the stack and everything else you have to do? You're right though, it usually indicates something that hasn't been thought out properly.

                      "Quality Software since 1983!"
                      http://www.smoothjazzy.com/ - see the "Programming" section for freeware tools and articles.

                      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