TIL

아이템 16 프로퍼티는 동작이 아니라 상태를 나타내야 한다

var name: String? = null
	get() = field?.toUpperCase()
	set(value) {
		if (!value.isNullOrBlank()) {
			field = value
		}
	}
var date: Date
	get() = Date(mills)
	set(value) {
		mills = value.time
	}
interface Person {
	val name: String
}
val Context.preferences: SharedPreferences
	get() = PreferenceManager.getDefaultSharedPreferences(this)
val Tree<Int>.sum: Int
	get() = when(this) {
		is Leaf -> value
		is Node -> left.sum + right.sum
	}