Last active
May 21, 2019 08:57
-
-
Save yogacp/cfb6e21791021541348fe8c5ecd856d8 to your computer and use it in GitHub Desktop.
Sample of how to create meaningful names
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Bad variables naming | |
var a = 0 // user ages | |
var w = 0 // user weight | |
var h = 0 // user height | |
// Bad functions naming | |
fun age() | |
fun weight() | |
fun height() | |
// Bad classes naming to get user data | |
class UserInfo() | |
// Best practices varibales naming | |
var userAge = 0 | |
var userWeight = 0 | |
var userHeight = 0 | |
// Best practices functions naming | |
fun setUserAge() | |
fun setUserWeight() | |
fun setUserHeight() | |
// Best practices classes naming to get user data | |
class User() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Also, maybe you should change signature of "setUser..." and insert parameters. Like: