[RAILS] How to separate words in names in classes, methods, and variables

Question

When naming classes, methods, and variables, I don't understand the difference in word delimiters

Conclusion

Use upper camel case for classes and snake case for methods and variables.

Explanation

(ex) Take as an example when you want to name "user tweet creator"

・ When naming a class UserTweetCreator Name it like this

-When naming methods and variables user_tweet_creator Name it like this

In other words Upper camel case Capitalize the first letter and capitalize word breaks

Snake case Word breaks are represented by _

It will be. Methods and variables use the snake case and are all lowercase.

Summary

By observing the naming convention, I think it will be easier to communicate the meaning of the code with the team members. I would appreciate it if you could refer to it.

Recommended Posts

How to separate words in names in classes, methods, and variables
How to call classes and methods
How to use classes in Java?
How to name variables in Java
How to use environment variables in RubyOnRails
How to use substring and substr methods
How to execute and mock methods using JUnit
How to separate .scss by controller in Rails
How to access Java Private methods and fields
Ruby variables and methods
How to embed JavaScript variables in HTML with Thymeleaf
Use variables for class and id names in haml
Java classes and instances to understand in the figure
How to convert A to a and a to A using AND and OR in Java
How to handle TSV files and CSV files in Ruby
How to launch Swagger UI and Swagger Editor in Docker
How to specify character code and line feed code in JAXB
(Note) Java classes / variables / methods
[Java] Generics classes and generics methods
[Forge] How to register your own Entity and Entity Render in 1.13.2
[Rails] How to define macros in Rspec and standardize processing
How to set character code and line feed code in Eclipse
[Rails] Differences between redirect_to and render methods and how to output render methods
What happened in "Java 8 to Java 11" and how to build an environment
How to set and describe environment variables using Rails zsh
How to call and use API in Java (Spring Boot)
How to develop and register a Sota app in Java
How to use Java variables
Differences in how to handle strings between Java and Perl
[Ruby] Singular methods and singular classes
How to install PHP 7.4 and SQL Server drivers in CentOS 7.7
Ruby variables and functions (methods)
Ruby methods and classes (basic)
[Xcode] How to arrange Xcode and Simulator screens in full screen
Java abstract methods and classes
How to include PKCE Code_Verifier and Code_Challenge in JMeter requests
How to dynamically switch between FIN and RST in Netty
[Ruby] Singular methods and singular classes
How to POST JSON in Java-Method using OkHttp3 and method using HttpUrlConnection-
[Webpacker] Summary of how to install Bootstrap and jQuery in Rails 6.0
Basics of Java development ~ How to write programs (variables and types) ~
How to set and use profile in annotation-based Configuration in Spring framework
[jOOQ] How to CASE WHEN in the WHERE / AND / OR clause
How to delete large amounts of data in Rails and concerns
How to install the language used in Ubuntu and how to build the environment
How to get and add data from Firebase Firestore in Ruby
Measure the bottleneck! How to trace only slow methods in AspectJ
How to call multiple names at once in the same category
How to encrypt and decrypt with RSA public key in Java
How to use Lombok in Spring
How to use StringBurrer and Arrays.toString.
How to run JUnit in Eclipse
How to use EventBus3 and ThreadMode
How to iterate infinitely in Ruby
[Rails] How to write in Japanese
How to run Ant in Gradle
How to master programming in 3 months
How to learn JAVA in 7 days
How to get parameters in Spark
Organize classes, instances, and instance variables
How to use equality and equality (how to use equals)