sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    🛣️ Road Profile Builder | Generate roads, curbs and pavements easily Download

    Programming Method

    Scheduled Pinned Locked Moved Plugins
    5 Posts 3 Posters 366 Views 3 Watching
    Loading More Posts
    • 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.
    • honoluludesktopH Offline
      honoluludesktop
      last edited by

      At best, the way I program typically involves a primary nested loop, and procedural calls. I also use a ton of "flags" to transmit conditions through out the code. All of this is OK until I begin to patch the program to correct bugs, or add enhancements. After a while the code becomes difficult to follow because I have forgotten the function of the flag, the patch, and the documentation begins to be obtuse.

      Any advice on organization from those with experience?

      1 Reply Last reply Reply Quote 0
      • thomthomT Offline
        thomthom
        last edited by

        Comment Comment Comment - the alpha and omega for maintaining code.

        @honoluludesktop said:

        I also use a ton of "flags" to transmit conditions through out the code.

        Instance variables?
        I used to have a bunch of those as well - but now I try to make more custom classes that takes care of it's own section of the code.

        Thomas Thomassen — SketchUp Monkey & Coding addict
        List of my plugins and link to the CookieWare fund

        1 Reply Last reply Reply Quote 0
        • honoluludesktopH Offline
          honoluludesktop
          last edited by

          Custom Classes? Guess I am not there yet. Just beginning to understand that methods are procedures>_< While I conceptually understand parent child, I don't have a clue as to implementing it. Will I live long enough?-)

          1 Reply Last reply Reply Quote 0
          • J Offline
            Jim
            last edited by

            A concrete example here, but I noticed in your dxf plugin you would benefit from using elsif instead of else if - it would greatly reduce the indenting in a few cases and make the code more read-able.

            Each if requires an end, so using elsif you could eliminate quite a few end statements.

            if condition
              # do this
            elsif condition
              # do that
            elsif condition
              # do the other
            else 
             #  default action
            end
            

            Hi

            1 Reply Last reply Reply Quote 0
            • honoluludesktopH Offline
              honoluludesktop
              last edited by

              Jim, Thanks again:-)

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              • First post
                Last post
              Buy SketchPlus
              Buy SUbD
              Buy WrapR
              Buy eBook
              Buy Modelur
              Buy Vertex Tools
              Buy SketchCuisine
              Buy FormFonts

              Advertisement