An instance of the WalletView
class without the walletModel
data member being set is invalid. So, it is better to set it in the constructor.
Establishing one more WalletView
class’s invariant in constructor:
- allows to drop all of checks of the
walletModel
in member functions - makes reasoning about the code that uses instances of the
WalletView
class easier
Possible follow ups could extend this approach to other classes, e.g., OverviewPage
, TransactionView
, ReceiveCoinsDialog
, SendCoinsDialog
, AddressBookPage
.