June 2018
Intermediate to advanced
310 pages
6h 32m
English
Let's try a fluent setter approach, instead. We'll have only mandatory fields in our constructor, and all of the others will become setters. So to create a new email, we no longer need to do the following:
val mail = Mail("manager@company.com")
mail.title("Ping")
mail.cc(listOf<String>())
Instead, we will do the following:
Mail("manager@company.com").title("Ping").cc(listOf<String>())
Fluent setters allow us to chain one set call to another.
That's a lot nicer for a couple of reasons:
Read now
Unlock full access