Method -- Best Naming Techniques
-
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:
- getVerticesFromFaces(ent)
- get_vertices_from_faces(ent)
- 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.
-
#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-guideI'd go for what the community uses for the most part. Makes the code more interchangeable.
-
#2 is the Ruby way.
(#1 is Javascript or VisualBasic)
[#3 is noway!]
Advertisement