Using "m" prefix for variable names became usual in programming, mainly in Android, but since Kotlin arrived, this minor thing bothers me a bit.
Setting and getting variables with "m" prefix doesn't seem really nice, because in Java we create (and name) our setters and getters, so we can omit the "m", but this doesn't happen in Kotlin, unless we walk in the opposite of conventions and repeat Java's technique.
Java:
public class Foo {
private String mName;
public void setName(String name) {
mName = name;
}
public String getName() {
return mName;
}
}
public class Main {
public static void main(String[] args) {
Foo foo = new Foo();
foo.setName("Foo");
}
}
Kotlin :
data class Foo(val mName: String)
fun main(args: Array<String>) {
val foo = Foo()
foo.mName = "Foo" // "m" prefix doesn't fit
}
What should we do? Is there a new convention to follow?