sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Method -- Best Naming Techniques

    Scheduled Pinned Locked Moved Developers' Forum
    3 Posts 3 Posters 267 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.
    • A Offline
      Anton_S
      last edited by

      A have a question that has been bothering me for a quite of time. Lets say I want to create a method that will return all vertices of the faces of the group. Which of these method naming techniques would be best:

      1. getVerticesFromFaces(ent)
      2. get_vertices_from_faces(ent)
      3. getverticesfromfaces(ent)

      The first technique has each word capitalized, except for the first, leading word.
      The second one has underscores, separating each word.
      I'm pretty sure the third one can be thrown out πŸ˜’ .

      I think the first one would be best because it is the shortest and easy to read, but it doesn't match the naming techniques of SketchUp API methods. SketchUp API has each word separated by the underscore; the second technique. I think using the identical naming techniques in all methods will make the library/plugin neat.

      The question remains, what is the best technique to use. The first one, the second or a mixture of both?

      Edit: I changed my mind. The first one may look too sloppy in some cases. I guess the second technique is the one to use.

      1 Reply Last reply Reply Quote 0
      • tt_suT Offline
        tt_su
        last edited by

        #2 is what the GitHub style guide describes: https://github.com/styleguide/ruby
        The GitHub style guide is a shorter version of the community driven styleguide: https://github.com/bbatsov/ruby-style-guide

        I'd go for what the community uses for the most part. Makes the code more interchangeable.

        1 Reply Last reply Reply Quote 0
        • Dan RathbunD Offline
          Dan Rathbun
          last edited by

          #2 is the Ruby way.

          (#1 is Javascript or VisualBasic)

          [#3 is noway!] πŸ˜›

          I'm not here much anymore.

          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