Dron Bhattacharya
02/20/2023, 4:54 PMAlejandro Rios
02/20/2023, 4:55 PMDron Bhattacharya
02/20/2023, 5:04 PMPoisonedYouth
02/20/2023, 5:05 PMsubrat prasad
02/20/2023, 7:37 PMDron Bhattacharya
02/21/2023, 10:27 AMCode to an interface rather than to an implementation.Can anyone explain this? Examples will also be helpful.
Sam
02/21/2023, 10:35 AMList
(an interface) instead of ArrayList
(a specific class that implements that interface). That makes your code more reusable and versatile, as it will be able to work with all types of lists.
fun printValues(items: List<String>) { ... } // good
fun printValues(items: ArrayList<String>) {... } // less good
Dron Bhattacharya
02/21/2023, 10:38 AMCLOVIS
02/21/2023, 10:38 AMSam
02/21/2023, 10:41 AMTies
02/21/2023, 11:06 AMDron Bhattacharya
02/21/2023, 1:38 PMsomeClass.someProperty
to access it.
Why need those get-methods in the class diagrams?Sam
02/21/2023, 1:39 PMget
and set
method, and the underlying field will be private.CLOVIS
02/21/2023, 1:39 PMTies
02/21/2023, 1:40 PMCLOVIS
02/21/2023, 1:41 PM/foo
, which in Kotlin are properties without a backing field (or with a backing field different enough that you can consider it's something else)object
, by
, DSLs…) it's rare to use a "proper design pattern"Dron Bhattacharya
02/21/2023, 1:46 PM