October 2018
Intermediate to advanced
370 pages
9h 15m
English
If a class has a complex interface, we can use the facade pattern. According to this pattern, we should create a new class that contains an instance of a class that we want to use. The following diagram demonstrates when we want to use the Preferences API (https://docs.oracle.com/javase/8/docs/technotes/guides/preferences/overview.html) to persist the state of the User class:

The preceding diagram contains the User class, which is responsible for simplifying a public interface of the Preference class. The end user works with an instance of the User class instead of Preference.
The User class may look like this:
data class User( private ...
Read now
Unlock full access