does anybody have a good intro to properties for 1...
# announcements
g
does anybody have a good intro to properties for 100% java programmers?
m
groostav: in Java, get/set is property interface emulation, field is property implementation
g
lol, yes im well aware, I'm looking for a blog post or walk-through to explain the advantages of this strategy
s
i found the docs to be pretty helpful
g
their not bad, I was just looking at them, but they dont explain why kotlin has properties
s
for starters, many modern languages do and that's a bit expected
i would've thought the reason was clear though? you can do a lot of nice things concisely, caching and things
and java always had a ton of boilerplate for simply writing their own limited "properties"
g
I just had a kotlin-newbie pull request a change
Copy code
class Thingy{
  var property: Model
    private set;
}
to
Copy code
class Thingy{
  var property: Model
    private set;

  fun updateProperty(newModel: Model) {
    property = newModel
  }
}
because he didn't understand what
two methods have the same JVM signature
meant as an error message when he tried to call it
fun setPropety
🙃 2
m
why
Many things IDE generates for Java (Constructors, Getters and Setters) can be just written in Kotlin, that's why 🙂
g
so what i want to do is give this kotlin newbie something to read
what would you guys suggest?
s
that particular thing sounds like a spot the compiler could be more helpful at, as a side note 😉
if there isn't one, maybe you should file a youtrack issue