-
Book Overview & Buying
-
Table Of Contents
Hands-On Design Patterns with Kotlin
By :
This design pattern is all about customization and creating objects that are similar but slightly different. To understand it better, we'll start with an example.
Imagine that you have a shop where you sell PCs.
Regular PC consists of the foll:
Most of your customers don't actually care what components you put in this PC. What they do care about is whether this PC will be able to run Magnificent Pilfering Car 7 at 60fps (which is frame per second).
So, you decide to build it like that:
data class PC(val motherboard: String = "Terasus XZ27",
val cpu: String = "Until Atom K500",
val ram: String = "8GB Microcend BBR5",
val graphicCard: String = "nKCF 8100TZ")So when a new customer comes in wanting to try out this game everybody is talking about in the neighborhood, you just do:
val pc = PC()
And they are already off toward home, ready to share their newest experiences from MPC7. Actually, your business...
Change the font size
Change margin width
Change background colour